Changeset - r1780:3dca839502b1
[Not reviewed]
master
0 1 0
Darkvater - 19 years ago 2005-05-08 21:00:56
darkvater@openttd.org
(svn r2284) - Fix (regression): [ 1197177 ] Scenario editor: desert add/remove tool removes industries. Fixed a bit too agressive desert generator. It still does remove the industry (sand's a bitch on machinery), but at least it does it cleanly :)
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
terraform_gui.c
Show inline comments
 
@@ -29,49 +29,49 @@ static void GenericRaiseLowerLand(uint t
 
		DoCommandP(tile, 8, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_AUTO | CMD_MSG(STR_0809_CAN_T_LOWER_LAND_HERE));
 
	}
 
}
 

	
 
/** Scenario editor command that generates desert areas */
 
static void GenerateDesertArea(TileIndex end, TileIndex start)
 
{
 
	int size_x, size_y;
 
	int sx = TileX(start);
 
	int sy = TileY(start);
 
	int ex = TileX(end);
 
	int ey = TileY(end);
 

	
 
	if (_game_mode != GM_EDITOR) return;
 

	
 
	if (ex < sx) intswap(ex, sx);
 
	if (ey < sy) intswap(ey, sy);
 
	size_x = (ex - sx) + 1;
 
	size_y = (ey - sy) + 1;
 

	
 
	_generating_world = true;
 
	BEGIN_TILE_LOOP(tile, size_x, size_y, TILE_XY(sx, sy)) {
 
		if (GetTileType(tile) != MP_WATER) {
 
			SetMapExtraBits(tile, (_ctrl_pressed) ? 0 : 1);
 
			DoClearSquare(tile);
 
			DoCommandP(tile, 0, 0, NULL, CMD_LANDSCAPE_CLEAR);
 
			MarkTileDirtyByTile(tile);
 
		}
 
	} END_TILE_LOOP(tile, size_x, size_y, 0);
 
	_generating_world = false;
 
}
 

	
 
/**
 
 * A central place to handle all X_AND_Y dragged GUI functions.
 
 * @param we @WindowEvent variable holding in its higher bits (excluding the lower
 
 * 4, since that defined the X_Y drag) the type of action to be performed
 
 * @return Returns true if the action was found and handled, and false otherwise. This
 
 * allows for additional implements that are more local. For example X_Y drag
 
 * of convertrail which belongs in rail_gui.c and not terraform_gui.c
 
 **/
 
bool GUIPlaceProcDragXY(const WindowEvent *we)
 
{
 
	TileIndex start_tile = we->place.starttile;
 
	TileIndex end_tile = we->place.tile;
 

	
 
	switch (we->place.userdata >> 4) {
 
	case GUI_PlaceProc_DemolishArea >> 4:
 
		DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
 
		break;
 
	case GUI_PlaceProc_LevelArea >> 4:
0 comments (0 inline, 0 general)