Changeset - r1443:9a8f64c33cbe
[Not reviewed]
master
0 2 0
pasky - 20 years ago 2005-03-06 16:58:42
pasky@openttd.org
(svn r1947) As in r1946, permit DC_QUERY_COST even on non-depot tiles - so that it works for the ai_new. It is de iure not a bug yet but let's be safe against future annoying headaches. Signed-Off-By: TrueLight
2 files changed with 9 insertions and 7 deletions:
0 comments (0 inline, 0 general)
ship_cmd.c
Show inline comments
 
@@ -875,22 +875,23 @@ int32 CmdBuildShip(int x, int y, uint32 
 
	UnitID unit_num;
 
	TileIndex tile = TILE_FROM_XY(x,y);
 
	Engine *e;
 

	
 
	if (!IsEngineBuildable(p1, VEH_Ship)) return CMD_ERROR;
 

	
 
	if (!IsTileDepotType(tile, TRANSPORT_WATER)) return CMD_ERROR;
 

	
 
	if (_map_owner[tile] != _current_player) return CMD_ERROR;
 

	
 
	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
 

	
 
	value = EstimateShipCost(p1);
 
	if (flags & DC_QUERY_COST)
 
		return value;
 

	
 
	/* The ai_new queries the vehicle cost before building the route,
 
	 * so we must check against cheaters no sooner than now. --pasky */
 
	if (!IsTileDepotType(tile, TRANSPORT_WATER)) return CMD_ERROR;
 
	if (_map_owner[tile] != _current_player) return CMD_ERROR;
 

	
 
	v = AllocateVehicle();
 
	if (v == NULL || IsOrderPoolFull() ||
 
			(unit_num = GetFreeUnitNumber(VEH_Ship)) > _patches.max_ships)
 
		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
 

	
 
	if (flags & DC_EXEC) {
train_cmd.c
Show inline comments
 
@@ -539,15 +539,16 @@ int32 CmdBuildRailVehicle(int x, int y, 
 
	UnitID unit_num;
 
	Engine *e;
 
	TileIndex tile = TILE_FROM_XY(x,y);
 

	
 
	if (!IsEngineBuildable(p1, VEH_Train)) return CMD_ERROR;
 

	
 
	if (!IsTileDepotType(tile, TRANSPORT_RAIL)) return CMD_ERROR;
 

	
 
	if (_map_owner[tile] != _current_player) return CMD_ERROR;
 
	if (!(flags & DC_QUERY_COST)) {
 
		if (!IsTileDepotType(tile, TRANSPORT_RAIL)) return CMD_ERROR;
 
		if (_map_owner[tile] != _current_player) return CMD_ERROR;
 
	}
 

	
 
	_cmd_build_rail_veh_var1 = 0;
 

	
 
	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
 

	
 
	rvi = RailVehInfo(p1);
0 comments (0 inline, 0 general)