|
@@ -130,13 +130,13 @@ int32 CmdBuildRoadVeh(int x, int y, uint
|
|
|
cost = EstimateRoadVehCost(p1);
|
|
|
if (flags & DC_QUERY_COST) return cost;
|
|
|
|
|
|
/* 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_ROAD)) return CMD_ERROR;
|
|
|
if (_map_owner[tile] != _current_player) return CMD_ERROR;
|
|
|
if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
|
|
|
|
|
|
v = AllocateVehicle();
|
|
|
if (v == NULL || IsOrderPoolFull())
|
|
|
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
|
|
|
|
|
|
/* find the first free roadveh id */
|
|
@@ -294,13 +294,13 @@ static const byte _road_pf_directions[16
|
|
|
static bool EnumRoadSignalFindDepot(uint tile, RoadFindDepotData *rfdd, int track, uint length, byte *state)
|
|
|
{
|
|
|
tile += TileOffsByDir(_road_pf_directions[track]);
|
|
|
|
|
|
if (IsTileType(tile, MP_STREET) &&
|
|
|
(_map5[tile] & 0xF0) == 0x20 &&
|
|
|
_map_owner[tile] == rfdd->owner) {
|
|
|
IsTileOwner(tile, rfdd->owner)) {
|
|
|
|
|
|
if (length < rfdd->best_length) {
|
|
|
rfdd->best_length = length;
|
|
|
rfdd->tile = tile;
|
|
|
}
|
|
|
}
|
|
@@ -1045,17 +1045,17 @@ static int RoadFindPathToDest(Vehicle *v
|
|
|
r = GetTileTrackStatus(tile, TRANSPORT_ROAD);
|
|
|
signal = (uint16)(r >> 16);
|
|
|
bitmask = (uint16)r;
|
|
|
}
|
|
|
|
|
|
if (IsTileType(tile, MP_STREET)) {
|
|
|
if ((_map5[tile]&0xF0) == 0x20 && v->owner == _map_owner[tile])
|
|
|
if ((_map5[tile]&0xF0) == 0x20 && IsTileOwner(tile, v->owner))
|
|
|
/* Road crossing */
|
|
|
bitmask |= _road_veh_fp_ax_or[_map5[tile]&3];
|
|
|
} else if (IsTileType(tile, MP_STATION)) {
|
|
|
if (_map_owner[tile] == OWNER_NONE || _map_owner[tile] == v->owner) {
|
|
|
if (IsTileOwner(tile, OWNER_NONE) || IsTileOwner(tile, v->owner)) {
|
|
|
/* Our station */
|
|
|
Station *st = GetStation(_map2[tile]);
|
|
|
byte val = _map5[tile];
|
|
|
if (v->cargo_type != CT_PASSENGERS) {
|
|
|
if (IS_BYTE_INSIDE(val, 0x43, 0x47) && (_patches.roadveh_queue || st->truck_stops->status&3))
|
|
|
bitmask |= _road_veh_fp_ax_or[(val-0x43)&3];
|