(svn r8401) -Codechange: Make 'IsValidRoadStop' a method of RoadStop and rename it to 'IsValid'
-Codechange: While I'm at it, put 'RoadStop::AllocateRaw' into the protected section
This commit is contained in:
@@ -403,7 +403,7 @@ RoadStop *RoadStop::AllocateRaw( void )
|
||||
/* We don't use FOR_ALL here, because FOR_ALL skips invalid items.
|
||||
* TODO - This is just a temporary stage, this will be removed. */
|
||||
for (rs = GetRoadStop(0); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) {
|
||||
if (!IsValidRoadStop(rs)) {
|
||||
if (!rs->IsValid()) {
|
||||
RoadStopID index = rs->index;
|
||||
|
||||
memset(rs, 0, sizeof(*rs));
|
||||
@@ -418,3 +418,9 @@ RoadStop *RoadStop::AllocateRaw( void )
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Determines whether a RoadStop is a valid (i.e. existing) one */
|
||||
bool RoadStop::IsValid() const
|
||||
{
|
||||
return xy != INVALID_TILE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user