SLIC-Reference : Terraform
CTP2 Bureau
The Modding
Knowledgebase
WePlayCiv: CtP2 Downloads
WePlayCiv: Call To Power forum
Apolyton Call To Power forums
Civilization Fanatics: Call To Power

SLIC-Reference : : Terraform  

Arguments: location, terrain Type: void

Change location into a different terrain type

Changes location into a different terrain type. Possible values for terrain are:
0 TERRAIN_TYPE_FOREST
1 TERRAIN_TYPE_PLAINS
2 TERRAIN_TYPE_TUNDRA
3 TERRAIN_TYPE_GLACIER
4 TERRAIN_TYPE_GRASSLAND
5 TERRAIN_TYPE_DESERT
6 TERRAIN_TYPE_SWAMP
7 TERRAIN_TYPE_JUNGLE
8 TERRAIN_TYPE_MOUNTAIN
9 TERRAIN_TYPE_HILL
10 TERRAIN_TYPE_WATER_SHALLOW
11 TERRAIN_TYPE_WATER_DEEP
12 TERRAIN_TYPE_WATER_VOLCANO
13 TERRAIN_TYPE_SPACE
14 TERRAIN_TYPE_WATER_BEACH
15 TERRAIN_TYPE_WATER_SHELF
16 TERRAIN_TYPE_WATER_TRENCH
17 TERRAIN_TYPE_WATER_RIFT
18 TERRAIN_TYPE_DEAD
19 TERRAIN_TYPE_BROWN_HILL
20 TERRAIN_TYPE_BROWN_MOUNTAIN
21 TERRAIN_TYPE_WHITE_HILL
22 TERRAIN_TYPE_WHITE_MOUNTAIN
23 TERRAIN_TYPE_DEAD_HILL
Mods may allow more terrain type depending on their terrain.txt.

tested   working  

Source:

SFN_ERROR Slic_Terraform::Call(SlicArgList *args)
{
	if(args->Count() != 2)
		return SFN_ERROR_NUM_ARGS;
	
	MapPoint tpos, pos;
	if(!args->GetPos(0, tpos)) {
		return SFN_ERROR_TYPE_ARGS;
	}

	sint32 terrain;
	if(!args->GetInt(1, terrain)) {
		return SFN_ERROR_TYPE_ARGS;
	}

	if(terrain < 0 || terrain >= g_theTerrainDB->NumRecords()) {
		return SFN_ERROR_OUT_OF_RANGE;
	}

	g_theWorld->SmartSetTerrain(tpos, terrain, 0);
#if 0
	Cell *cell = g_theWorld->GetCell(tpos);
	cell->SetTerrain(terrain);
	cell->SetEnv(cell->GetEnv() & ~(k_MASK_ENV_ROAD |
										  k_MASK_ENV_IRRIGATION |
										  k_MASK_ENV_MINE | 
										  k_MASK_ENV_CITY | 
										  k_MASK_ENV_INSTALLATION |
										  k_MASK_ENV_CITY_RADIUS |
										  k_MASK_ENV_GOOD));
	DynamicArray instArray;
	g_theInstallationTree->RemoveAt(tpos, instArray);
	instArray.KillList();

	switch(terrain) {
		case TERRAIN_FOREST:
		case TERRAIN_PLAINS:
		case TERRAIN_TUNDRA:
		case TERRAIN_GLACIER:
		case TERRAIN_GRASSLAND:
		case TERRAIN_DESERT:
		case TERRAIN_SWAMP:
		case TERRAIN_JUNGLE:
		case TERRAIN_HILL:
		case TERRAIN_DEAD:
		case TERRAIN_BROWN_HILL:
		case TERRAIN_WHITE_HILL:
		case TERRAIN_DEAD_HILL:
			g_theWorld->SetMovementType(tpos.x, tpos.y, k_MOVEMENT_TYPE_LAND);
			break;
		case TERRAIN_MOUNTAIN:
		case TERRAIN_BROWN_MOUNTAIN:
		case TERRAIN_WHITE_MOUNTAIN:
			g_theWorld->SetMovementType(tpos.x, tpos.y, k_MOVEMENT_TYPE_MOUNTAIN);
			break;
		case TERRAIN_WATER_SHALLOW:
		case TERRAIN_WATER_BEACH:
			g_theWorld->SetMovementType(tpos.x, tpos.y, k_MOVEMENT_TYPE_SHALLOW_WATER | k_MOVEMENT_TYPE_WATER);
			break;
		case TERRAIN_WATER_DEEP:
		case TERRAIN_WATER_VOLCANO:
		case TERRAIN_WATER_SHELF:
		case TERRAIN_WATER_TRENCH:
		case TERRAIN_WATER_RIFT:
			g_theWorld->SetMovementType(tpos.x, tpos.y, k_MOVEMENT_TYPE_WATER);
			break;
		case TERRAIN_SPACE:
			g_theWorld->SetMovementType(tpos.x, tpos.y, k_MOVEMENT_TYPE_SPACE);
			break;
	}

	g_tiledMap->PostProcessTile(tpos, g_theWorld->GetTileInfo(tpos));
	g_tiledMap->TileChanged(tpos);
	for(WORLD_DIRECTION d = NORTH; d < UP; d = (WORLD_DIRECTION)((sint32)d + 1)) {
		if(tpos.GetNeighborPosition(d, pos)) {
			g_tiledMap->PostProcessTile(pos, g_theWorld->GetTileInfo(pos));
			g_tiledMap->TileChanged(pos);
			g_tiledMap->RedrawTile(&pos);
		}
	}
	g_tiledMap->RedrawTile(&tpos);
#endif
	return SFN_ERROR_OK;
}

Information last updated by BureauBert on 23.11.2010

User Comments:

Using this form you may add your own observations concerning the above item, e.g. additional hints for usage, limitations, oddities etc. Please note this is not the place for asking questions or carrying out discussions about modding - please refer to the Apolyton CTP2 Modification Forum on that purpose.

Subject / Title*:
Text:*
(A maximum of characters left)
Your name:*
Your website (URL):

*) Required fields

Error including libraries: Can't locate config.cfg in @INC (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /home/www/ctp2.info/cgi-bin/comments.cgi line 4. Make sure they exist, permissions are set properly, and paths are set correctly.
  Administration
This site is currently maintained by: BureauBert (Webmaster)  Maquiladora (Manager)  Legal Notice: Legal Notice Statistics: 71242 unique users since 02.05.2004 (» Site Statistics) Hosted by: WebhostOne
Share this page:  VK Facebook Twitter LiveJournal OK MR Google+ LinkedIn tumblr Pinterest Blogger Digg Evernote