diff options
author | smatz <smatz@openttd.org> | 2011-01-21 17:35:17 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2011-01-21 17:35:17 +0000 |
commit | 8b9f0d5adeb2ccacb30230907a2e11b2fe97d772 (patch) | |
tree | 2e9525fcfeb893ae72fa0673d2b27481849c2042 /src/train.h | |
parent | e860075a16daf1194d5c7a859450dafb1da05490 (diff) | |
download | openttd-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.h | 10 |
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) |