Changeset - r10707:8a385eb35ca8
[Not reviewed]
master
0 5 0
smatz - 15 years ago 2009-01-12 19:49:23
smatz@openttd.org
(svn r15039) -Codechange: fix comments regarding old AI, remove one old AI hack
5 files changed with 8 insertions and 19 deletions:
0 comments (0 inline, 0 general)
src/command.cpp
Show inline comments
 
@@ -445,16 +445,12 @@ error:
 
		return CMD_ERROR;
 
	}
 

	
 
	/* if toplevel, subtract the money. */
 
	if (--_docommand_recursive == 0 && !(flags & DC_BANKRUPT)) {
 
		SubtractMoneyFromCompany(res);
 
		/* XXX - Old AI hack which doesn't use DoCommandP; update last build coord of company */
 
		if (tile != 0 && IsValidCompanyID(_current_company)) {
 
			GetCompany(_current_company)->last_build_coordinate = tile;
 
		}
 
	}
 

	
 
	return res;
 
}
 

	
 
/*!
src/command_type.h
Show inline comments
 
@@ -298,16 +298,15 @@ enum {
 
enum {
 
	DC_EXEC            = 0x001, ///< execute the given command
 
	DC_AUTO            = 0x002, ///< don't allow building on structures
 
	DC_QUERY_COST      = 0x004, ///< query cost only,  don't build.
 
	DC_NO_WATER        = 0x008, ///< don't allow building on water
 
	DC_NO_RAIL_OVERLAP = 0x010, ///< don't allow overlap of rails (used in buildrail)
 
	DC_AI_BUILDING     = 0x020, ///< special building rules for AI
 
	DC_NO_TOWN_RATING  = 0x040, ///< town rating does not disallow you from building
 
	DC_BANKRUPT        = 0x080, ///< company bankrupts, skip money check, skip vehicle on tile check in some cases
 
	DC_AUTOREPLACE     = 0x100, ///< autoreplace/autorenew is in progress, this shall disable vehicle limits when building, and ignore certain restrictions when undoing things (like vehicle attach callback)
 
	DC_NO_TOWN_RATING  = 0x020, ///< town rating does not disallow you from building
 
	DC_BANKRUPT        = 0x040, ///< company bankrupts, skip money check, skip vehicle on tile check in some cases
 
	DC_AUTOREPLACE     = 0x080, ///< autoreplace/autorenew is in progress, this shall disable vehicle limits when building, and ignore certain restrictions when undoing things (like vehicle attach callback)
 
};
 

	
 
/**
 
 * Used to combine a StringID with the command.
 
 *
 
 * This macro can be used to add a StringID (the error message to show) on a command-id
src/rail_cmd.cpp
Show inline comments
 
@@ -780,16 +780,15 @@ CommandCost CmdBuildTrainDepot(TileIndex
 
	tileh = GetTileSlope(tile, NULL);
 

	
 
	DiagDirection dir = Extract<DiagDirection, 0>(p2);
 

	
 
	/* Prohibit construction if
 
	 * The tile is non-flat AND
 
	 * 1) The AI is "old-school"
 
	 * 2) build-on-slopes is disabled
 
	 * 3) the tile is steep i.e. spans two height levels
 
	 * 4) the exit points in the wrong direction
 
	 * 1) build-on-slopes is disabled
 
	 * 2) the tile is steep i.e. spans two height levels
 
	 * 3) the exit points in the wrong direction
 
	 */
 

	
 
	if (tileh != SLOPE_FLAT && (
 
				!_settings_game.construction.build_on_slopes ||
 
				IsSteepSlope(tileh) ||
 
				!CanBuildDepotByTileh(dir, tileh)
src/road_cmd.cpp
Show inline comments
 
@@ -920,14 +920,13 @@ static CommandCost RemoveRoadDepot(TileI
 
static CommandCost ClearTile_Road(TileIndex tile, byte flags)
 
{
 
	switch (GetRoadTileType(tile)) {
 
		case ROAD_TILE_NORMAL: {
 
			RoadBits b = GetAllRoadBits(tile);
 

	
 
			/* Clear the road if only one piece is on the tile OR the AI tries
 
			 * to clear town road OR we are not using the DC_AUTO flag */
 
			/* Clear the road if only one piece is on the tile OR we are not using the DC_AUTO flag */
 
			if ((CountBits(b) == 1 && GetRoadBits(tile, ROADTYPE_TRAM) == ROAD_NONE) || !(flags & DC_AUTO)) {
 
				RoadTypes rts = GetRoadTypes(tile);
 
				CommandCost ret(EXPENSES_CONSTRUCTION);
 
				for (RoadType rt = ROADTYPE_ROAD; rt < ROADTYPE_END; rt++) {
 
					if (HasBit(rts, rt)) {
 
						CommandCost tmp_ret = RemoveRoad(tile, flags, GetRoadBits(tile, rt), rt, true);
src/station_cmd.cpp
Show inline comments
 
@@ -736,17 +736,13 @@ CommandCost CheckFlatLandBelow(TileIndex
 

	
 
		uint z;
 
		Slope tileh = GetTileSlope(tile_cur, &z);
 

	
 
		/* Prohibit building if
 
		 *   1) The tile is "steep" (i.e. stretches two height levels)
 
		 * -OR-
 
		 *   2) The tile is non-flat if
 
		 *     a) the company building is an "old-school" AI
 
		 *   -OR-
 
		 *     b) the build_on_slopes switch is disabled
 
		 *   2) The tile is non-flat and the build_on_slopes switch is disabled
 
		 */
 
		if (IsSteepSlope(tileh) ||
 
				((!_settings_game.construction.build_on_slopes) && tileh != SLOPE_FLAT)) {
 
			return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
 
		}
 

	
0 comments (0 inline, 0 general)