1
0
Fork 0

(svn r16332) -Codechange: replace some -1 + 1 with 'nothing' or <= .. - 1 with < .. - 1 (both caused due to wrapper functions)

release/1.0
rubidium 2009-05-17 11:17:53 +00:00
parent 3322cc978f
commit e7dedf4e1b
5 changed files with 6 additions and 7 deletions

View File

@ -15,7 +15,7 @@
/* static */ SignID AISign::GetMaxSignID() /* static */ SignID AISign::GetMaxSignID()
{ {
return ::GetMaxSignIndex(); return ::Sign::GetPoolSize() - 1;
} }
/* static */ bool AISign::IsValidSign(SignID sign_id) /* static */ bool AISign::IsValidSign(SignID sign_id)

View File

@ -184,10 +184,9 @@ static const Month _autosave_months[] = {
*/ */
static void RunVehicleDayProc(uint daytick) static void RunVehicleDayProc(uint daytick)
{ {
uint total = GetMaxVehicleIndex() + 1; uint total = Vehicle::GetPoolSize();
uint i;
for (i = daytick; i < total; i += DAY_TICKS) { for (uint i = daytick; i < total; i += DAY_TICKS) {
Vehicle *v = Vehicle::Get(i); Vehicle *v = Vehicle::Get(i);
if (v->IsValid()) { if (v->IsValid()) {

View File

@ -337,7 +337,7 @@ static inline Industry *GetRandomIndustry()
/* Make sure we have a valid industry */ /* Make sure we have a valid industry */
while (!Industry::IsValidID(index)) { while (!Industry::IsValidID(index)) {
index++; index++;
assert(index <= GetMaxIndustryIndex()); assert(index < Industry::GetPoolSize());
} }
} }

View File

@ -318,7 +318,7 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
/* Then, try townnames /* Then, try townnames
* Not that the following assumes all town indices are adjacent, ie no * Not that the following assumes all town indices are adjacent, ie no
* towns have been deleted. */ * towns have been deleted. */
if (*item <= (uint)MAX_CLIENT_SLOTS + GetMaxTownIndex()) { if (*item < (uint)MAX_CLIENT_SLOTS + Town::GetPoolSize()) {
const Town *t; const Town *t;
FOR_ALL_TOWNS_FROM(t, *item - MAX_CLIENT_SLOTS) { FOR_ALL_TOWNS_FROM(t, *item - MAX_CLIENT_SLOTS) {

View File

@ -327,7 +327,7 @@ static inline Town *GetRandomTown()
/* Make sure we have a valid town */ /* Make sure we have a valid town */
while (!Town::IsValidID(index)) { while (!Town::IsValidID(index)) {
index++; index++;
assert(index <= GetMaxTownIndex()); assert(index < Town::GetPoolSize());
} }
} }