equal
deleted
inserted
replaced
401 RoadStop *rs; |
401 RoadStop *rs; |
402 |
402 |
403 /* We don't use FOR_ALL here, because FOR_ALL skips invalid items. |
403 /* We don't use FOR_ALL here, because FOR_ALL skips invalid items. |
404 * TODO - This is just a temporary stage, this will be removed. */ |
404 * TODO - This is just a temporary stage, this will be removed. */ |
405 for (rs = GetRoadStop(0); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) { |
405 for (rs = GetRoadStop(0); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) { |
406 if (!IsValidRoadStop(rs)) { |
406 if (!rs->IsValid()) { |
407 RoadStopID index = rs->index; |
407 RoadStopID index = rs->index; |
408 |
408 |
409 memset(rs, 0, sizeof(*rs)); |
409 memset(rs, 0, sizeof(*rs)); |
410 rs->index = index; |
410 rs->index = index; |
411 |
411 |
416 /* Check if we can add a block to the pool */ |
416 /* Check if we can add a block to the pool */ |
417 if (AddBlockToPool(&_RoadStop_pool)) return AllocateRaw(); |
417 if (AddBlockToPool(&_RoadStop_pool)) return AllocateRaw(); |
418 |
418 |
419 return NULL; |
419 return NULL; |
420 } |
420 } |
|
421 |
|
422 /** Determines whether a RoadStop is a valid (i.e. existing) one */ |
|
423 bool RoadStop::IsValid() const |
|
424 { |
|
425 return xy != INVALID_TILE; |
|
426 } |