(svn r2184) - CodeChange: remove the copy of ClearSlot(), which is now also called for CmdSkipOrder(). This also fixes the involuntary crash introduced 2 revisions ago

This commit is contained in:
Darkvater 2005-04-11 20:54:25 +00:00
parent 90cc36f7e2
commit 2397ff86e6
3 changed files with 8 additions and 10 deletions

View File

@ -7,7 +7,6 @@
#include "player.h"
#include "news.h"
#include "saveload.h"
#include "debug.h"
enum {
/* Max orders: 64000 (64 * 1000) */
@ -362,13 +361,8 @@ int32 CmdSkipOrder(int x, int y, uint32 flags, uint32 vehicle_id, uint32 not_use
if (v->type == VEH_Train)
v->u.rail.days_since_order_progr = 0;
if (v->type == VEH_Road && v->u.road.slot != NULL) {
//Clear the slot ClearSlot() of roadveh_cmd.c
DEBUG(ms, 3) ("Multistop: Clearing slot %d at 0x%x", v->u.road.slotindex, v->dest_tile);
v->u.road.slot = NULL;
v->u.road.slot_age = 0;
v->u.road.slot->slot[v->u.road.slotindex] = INVALID_SLOT;
}
if (v->type == VEH_Road)
ClearSlot(v, v->u.road.slot);
}
/* NON-stop flag is misused to see if a train is in a station that is

View File

@ -229,13 +229,16 @@ int32 CmdStartStopRoadVeh(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return 0;
}
static inline void ClearSlot(Vehicle *v, RoadStop *rs)
void ClearSlot(Vehicle *v, RoadStop *rs)
{
DEBUG(ms, 3) ("Multistop: Clearing slot %d at 0x%x", v->u.road.slotindex, rs->xy);
v->u.road.slot = NULL;
v->u.road.slot_age = 0;
if (rs != NULL)
if (rs != NULL) {
// check that the slot is indeed assigned to the same vehicle
assert(rs->slot[v->u.road.slotindex] == v->index);
rs->slot[v->u.road.slotindex] = INVALID_SLOT;
}
}
// p1 = vehicle index in GetVehicle()

View File

@ -270,6 +270,7 @@ static inline int GetRoadStopType(TileIndex tile)
uint GetNumRoadStops(const Station *st, RoadStopType type);
RoadStop * GetPrimaryRoadStop(const Station *st, RoadStopType type);
RoadStop * AllocateRoadStop( void );
void ClearSlot(Vehicle *v, RoadStop *rs);
static inline bool IsTrainStationTile(uint tile) {
return IsTileType(tile, MP_STATION) && IS_BYTE_INSIDE(_map5[tile], 0, 8);