(svn r8212) -Fix

Remove the unnecessary attribute RoadStop::used. The same information can be derived from RoadStop::xy
This commit is contained in:
tron 2007-01-17 22:32:34 +00:00
parent 004f1b061f
commit 3be30b8842
3 changed files with 7 additions and 7 deletions

View File

@ -350,7 +350,6 @@ void RoadStop::operator delete(void *p, int index)
/** Initializes a RoadStop */ /** Initializes a RoadStop */
RoadStop::RoadStop(TileIndex tile) : RoadStop::RoadStop(TileIndex tile) :
xy(tile), xy(tile),
used(true),
status(3), // stop is free status(3), // stop is free
num_vehicles(0), num_vehicles(0),
next(NULL), next(NULL),
@ -377,7 +376,6 @@ RoadStop::~RoadStop()
if (prev != NULL) prev->next = next; if (prev != NULL) prev->next = next;
if (next != NULL) next->prev = prev; if (next != NULL) next->prev = prev;
used = false;
DEBUG(ms, cDebugCtorLevel , "I- at %d[0x%x]", xy, xy); DEBUG(ms, cDebugCtorLevel , "I- at %d[0x%x]", xy, xy);
xy = INVALID_TILE; xy = INVALID_TILE;

View File

@ -46,9 +46,8 @@ enum {
typedef struct RoadStop { typedef struct RoadStop {
TileIndex xy; TileIndex xy;
bool used;
byte status;
RoadStopID index; RoadStopID index;
byte status;
byte num_vehicles; byte num_vehicles;
struct RoadStop *next; struct RoadStop *next;
struct RoadStop *prev; struct RoadStop *prev;
@ -258,7 +257,7 @@ DECLARE_OLD_POOL(RoadStop, RoadStop, 5, 2000)
*/ */
static inline bool IsValidRoadStop(const RoadStop *rs) static inline bool IsValidRoadStop(const RoadStop *rs)
{ {
return rs->used; return rs->xy != INVALID_TILE;
} }
#define FOR_ALL_ROADSTOPS_FROM(rs, start) for (rs = GetRoadStop(start); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) if (IsValidRoadStop(rs)) #define FOR_ALL_ROADSTOPS_FROM(rs, start) for (rs = GetRoadStop(start); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) if (IsValidRoadStop(rs))

View File

@ -68,7 +68,10 @@ static void RoadStopPoolNewBlock(uint start_item)
/* We don't use FOR_ALL here, because FOR_ALL skips invalid items. /* We don't use FOR_ALL here, because FOR_ALL skips invalid items.
* TODO - This is just a temporary stage, this will be removed. */ * TODO - This is just a temporary stage, this will be removed. */
for (rs = GetRoadStop(start_item); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) rs->index = start_item++; for (rs = GetRoadStop(start_item); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) {
rs->xy = INVALID_TILE;
rs->index = start_item++;
}
} }
DEFINE_OLD_POOL(Station, Station, StationPoolNewBlock, StationPoolCleanBlock) DEFINE_OLD_POOL(Station, Station, StationPoolNewBlock, StationPoolCleanBlock)
@ -2847,7 +2850,7 @@ extern const TileTypeProcs _tile_type_station_procs = {
static const SaveLoad _roadstop_desc[] = { static const SaveLoad _roadstop_desc[] = {
SLE_VAR(RoadStop,xy, SLE_UINT32), SLE_VAR(RoadStop,xy, SLE_UINT32),
SLE_VAR(RoadStop,used, SLE_BOOL), SLE_CONDNULL(1, 0, 44),
SLE_VAR(RoadStop,status, SLE_UINT8), SLE_VAR(RoadStop,status, SLE_UINT8),
/* Index was saved in some versions, but this is not needed */ /* Index was saved in some versions, but this is not needed */
SLE_CONDNULL(4, 0, 8), SLE_CONDNULL(4, 0, 8),