summaryrefslogtreecommitdiff
path: root/src/train.h
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2011-01-21 17:35:17 +0000
committersmatz <smatz@openttd.org>2011-01-21 17:35:17 +0000
commit8b9f0d5adeb2ccacb30230907a2e11b2fe97d772 (patch)
tree2e9525fcfeb893ae72fa0673d2b27481849c2042 /src/train.h
parente860075a16daf1194d5c7a859450dafb1da05490 (diff)
downloadopenttd-8b9f0d5adeb2ccacb30230907a2e11b2fe97d772.tar.xz
(svn r21883) -Codechange: make UpdateZPosition() faster by not calling GetSlopeZ() when not needed
Diffstat (limited to 'src/train.h')
-rw-r--r--src/train.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/train.h b/src/train.h
index bfeffa554..f7142e47a 100644
--- a/src/train.h
+++ b/src/train.h
@@ -380,6 +380,16 @@ protected: // These functions should not be called outside acceleration code.
/* Any track that isn't TRACK_BIT_X or TRACK_BIT_Y cannot be sloped. */
return this->track == TRACK_BIT_X || this->track == TRACK_BIT_Y;
}
+
+ /**
+ * Trains can always use the faster algorithm because they
+ * have always the same direction as the track under them.
+ * @return false
+ */
+ FORCEINLINE bool HasToUseGetSlopeZ()
+ {
+ return false;
+ }
};
#define FOR_ALL_TRAINS(var) FOR_ALL_VEHICLES_OF_TYPE(Train, var)