diff options
author | matthijs <matthijs@openttd.org> | 2005-02-06 22:36:08 +0000 |
---|---|---|
committer | matthijs <matthijs@openttd.org> | 2005-02-06 22:36:08 +0000 |
commit | c5c5c9b17c1c4fd543873f866534d3fa06f9f1cb (patch) | |
tree | b4e6f6fce72b1b3fcb2b25b635ad70c6bd5b6741 /roadveh_cmd.c | |
parent | eed181245dffbc04a2e527e8e7cccf44ce4fda86 (diff) | |
download | openttd-c5c5c9b17c1c4fd543873f866534d3fa06f9f1cb.tar.xz |
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
- Add: asserts to find the v->u.rail.track == 0 problem.
- Add: IsValidDepot(), IsValidTown(), IsValidSign(), IsValidVehicle(), IsValidStation()
- Add: GetTileOwner(), IsTileOwner()
- Codechange: Replaced IsShipDepotTile(), IsTrainDepotTile(), IsRoadDepotTile() by IsTileDepotType().
- Codechange: typedeffed the MAP_OWNERS as Owner. Should be used as variable type.
- Codechange: Replaced a few uint by TileIndex.
Diffstat (limited to 'roadveh_cmd.c')
-rw-r--r-- | roadveh_cmd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/roadveh_cmd.c b/roadveh_cmd.c index 872d91a9a..6dd84da5a 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -116,12 +116,12 @@ int32 CmdBuildRoadVeh(int x, int y, uint32 flags, uint32 p1, uint32 p2) int32 cost; Vehicle *v; UnitID unit_num; - uint tile = TILE_FROM_XY(x,y); + TileIndex tile = TILE_FROM_XY(x,y); Engine *e; if (!IsEngineBuildable(p1, VEH_Road)) return CMD_ERROR; - if (!IsRoadDepotTile((TileIndex)tile)) return CMD_ERROR; + if (!IsTileDepotType(tile, TRANSPORT_ROAD)) return CMD_ERROR; if (_map_owner[tile] != _current_player) return CMD_ERROR; @@ -243,7 +243,7 @@ int32 CmdSellRoadVeh(int x, int y, uint32 flags, uint32 p1, uint32 p2) SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES); - if (!IsRoadDepotTile(v->tile) || v->u.road.state != 254 || !(v->vehstatus&VS_STOPPED)) + if (!IsTileDepotType(v->tile, TRANSPORT_ROAD) || v->u.road.state != 254 || !(v->vehstatus&VS_STOPPED)) return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE); if (flags & DC_EXEC) { @@ -297,7 +297,7 @@ static Depot *FindClosestRoadDepot(Vehicle *v) NPFFoundTargetData ftd; /* See where we are now */ byte trackdir = _dir_to_diag_trackdir[(v->direction>>1)&3]; - ftd = NPFRouteToDepotBreadthFirst(v->tile, trackdir, TRANSPORT_ROAD); + ftd = NPFRouteToDepotBreadthFirst(v->tile, trackdir, TRANSPORT_ROAD, v->owner); if (ftd.best_bird_dist == 0) return GetDepotByTile(ftd.node.tile); /* Target found */ else @@ -1104,7 +1104,7 @@ static int RoadFindPathToDest(Vehicle *v, uint tile, int enterdir) trackdir = _dir_to_diag_trackdir[enterdir]; //debug("Finding path. Enterdir: %d, Trackdir: %d", enterdir, trackdir); - ftd = NPFRouteToStationOrTile(tile - TileOffsByDir(enterdir), trackdir, &fstd, TRANSPORT_ROAD); + ftd = NPFRouteToStationOrTile(tile - TileOffsByDir(enterdir), trackdir, &fstd, TRANSPORT_ROAD, v->owner); if (ftd.best_bird_dist != 0 || ftd.best_trackdir == 0xff) { /* Not found, just do something, or we are already there */ //TODO: maybe display error? |