changeset 11929:12bd4fc18d95 draft

(svn r16332) -Codechange: replace some -1 + 1 with 'nothing' or <= .. - 1 with < .. - 1 (both caused due to wrapper functions)
author rubidium <rubidium@openttd.org>
date Sun, 17 May 2009 11:17:53 +0000
parents c80f91c6d1e1
children b17404281f58
files src/ai/api/ai_sign.cpp src/date.cpp src/industry.h src/network/network_chat_gui.cpp src/town.h
diffstat 5 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/ai/api/ai_sign.cpp
+++ b/src/ai/api/ai_sign.cpp
@@ -15,7 +15,7 @@
 
 /* static */ SignID AISign::GetMaxSignID()
 {
-	return ::GetMaxSignIndex();
+	return ::Sign::GetPoolSize() - 1;
 }
 
 /* static */ bool AISign::IsValidSign(SignID sign_id)
--- a/src/date.cpp
+++ b/src/date.cpp
@@ -184,10 +184,9 @@
  */
 static void RunVehicleDayProc(uint daytick)
 {
-	uint total = GetMaxVehicleIndex() + 1;
-	uint i;
+	uint total = Vehicle::GetPoolSize();
 
-	for (i = daytick; i < total; i += DAY_TICKS) {
+	for (uint i = daytick; i < total; i += DAY_TICKS) {
 		Vehicle *v = Vehicle::Get(i);
 
 		if (v->IsValid()) {
--- a/src/industry.h
+++ b/src/industry.h
@@ -337,7 +337,7 @@
 		/* Make sure we have a valid industry */
 		while (!Industry::IsValidID(index)) {
 			index++;
-			assert(index <= GetMaxIndustryIndex());
+			assert(index < Industry::GetPoolSize());
 		}
 	}
 
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -318,7 +318,7 @@
 		/* Then, try townnames
 		 * Not that the following assumes all town indices are adjacent, ie no
 		 * towns have been deleted. */
-		if (*item <= (uint)MAX_CLIENT_SLOTS + GetMaxTownIndex()) {
+		if (*item < (uint)MAX_CLIENT_SLOTS + Town::GetPoolSize()) {
 			const Town *t;
 
 			FOR_ALL_TOWNS_FROM(t, *item - MAX_CLIENT_SLOTS) {
--- a/src/town.h
+++ b/src/town.h
@@ -327,7 +327,7 @@
 		/* Make sure we have a valid town */
 		while (!Town::IsValidID(index)) {
 			index++;
-			assert(index <= GetMaxTownIndex());
+			assert(index < Town::GetPoolSize());
 		}
 	}