summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-05-17 11:17:53 +0000
committerrubidium <rubidium@openttd.org>2009-05-17 11:17:53 +0000
commite7dedf4e1b2569a3f595f045a61d3d4bc144f3de (patch)
tree4c24aeae74983bd800c3b0b295bf854bd3f3ea89 /src
parent3322cc978fbee678fc9a7abf930e76c0b3ca23a8 (diff)
downloadopenttd-e7dedf4e1b2569a3f595f045a61d3d4bc144f3de.tar.xz
(svn r16332) -Codechange: replace some -1 + 1 with 'nothing' or <= .. - 1 with < .. - 1 (both caused due to wrapper functions)
Diffstat (limited to 'src')
-rw-r--r--src/ai/api/ai_sign.cpp2
-rw-r--r--src/date.cpp5
-rw-r--r--src/industry.h2
-rw-r--r--src/network/network_chat_gui.cpp2
-rw-r--r--src/town.h2
5 files changed, 6 insertions, 7 deletions
diff --git a/src/ai/api/ai_sign.cpp b/src/ai/api/ai_sign.cpp
index 8876bbeec..349bf42a1 100644
--- 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)
diff --git a/src/date.cpp b/src/date.cpp
index 129460795..858c65119 100644
--- a/src/date.cpp
+++ b/src/date.cpp
@@ -184,10 +184,9 @@ static const Month _autosave_months[] = {
*/
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()) {
diff --git a/src/industry.h b/src/industry.h
index a36fb5ca0..c0f632cf1 100644
--- a/src/industry.h
+++ b/src/industry.h
@@ -337,7 +337,7 @@ static inline Industry *GetRandomIndustry()
/* Make sure we have a valid industry */
while (!Industry::IsValidID(index)) {
index++;
- assert(index <= GetMaxIndustryIndex());
+ assert(index < Industry::GetPoolSize());
}
}
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index 17e17e32c..9f896c185 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -318,7 +318,7 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
/* 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) {
diff --git a/src/town.h b/src/town.h
index 3ad04d22e..059040f2f 100644
--- a/src/town.h
+++ b/src/town.h
@@ -327,7 +327,7 @@ static inline Town *GetRandomTown()
/* Make sure we have a valid town */
while (!Town::IsValidID(index)) {
index++;
- assert(index <= GetMaxTownIndex());
+ assert(index < Town::GetPoolSize());
}
}