CTP2 Bureau
The Modding
Knowledgebase
Apolyton CTP2 forums
Apolyton CTP2 archives
Source Code Project SVN

Actions

Pages

Recent Changes Search

Create a new page:

AE Modding Wiki : Functions : CreateBuilding

New SLIC-function: CreateBuilding(city, building)

The difference with the same event is that the function doesn't effect stored production in a city.

//----------------------------------------------------------------------------
//
// Authored   : Maq
//
// Name       : Slic_CreateBuilding
//
// Description: Function to create a building in a city.
//
// Parameters : SlicArg 0: city
//		SlicArg 1: buildingdb index
//
// Globals    : -
//
// Returns    : SFN_ERROR		: execution result
//
//----------------------------------------------------------------------------
SFN_ERROR Slic_CreateBuilding::Call(SlicArgList *args)
{
	if (args->Count() != 2) {
		return SFN_ERROR_NUM_ARGS;
	}

	Unit city;
	sint32 type;
	if(!args->GetCity(0, city)) {
		return SFN_ERROR_TYPE_BUILTIN;
	}

	if(!args->GetInt(1, type))
		return SFN_ERROR_TYPE_ARGS;

	if(!g_theUnitPool->IsValid(city)) {
		return SFN_ERROR_OK;
	}

	if(type < 0 || type >= g_theBuildingDB->NumRecords())
		return SFN_ERROR_OUT_OF_RANGE;

	city.CD()->AddImprovement(type);
	return SFN_ERROR_OK;

}
Page last modified on July 17, 2009, at 06:16 PM
  Administration
AE Modding Wiki built with PmWiki Design: BureauBert
Share this page:  VK Facebook Twitter LiveJournal OK MR Google+ LinkedIn tumblr Pinterest Blogger Digg Evernote