summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-28 19:13:20 +0000
committerrubidium <rubidium@openttd.org>2010-08-28 19:13:20 +0000
commit2d10b0f11d0300eebabccb48399f35c9acb55be0 (patch)
tree151980dffce693efd4481c1728c9db1b7ea89de0 /src
parent41a80490befda13df13115f3e272d05247bcf4a2 (diff)
downloadopenttd-2d10b0f11d0300eebabccb48399f35c9acb55be0.tar.xz
(svn r20669) -Codechange: trigger the whole object every 256 ticks instead of every 250 ticks
Diffstat (limited to 'src')
-rw-r--r--src/landscape.cpp2
-rw-r--r--src/newgrf_animation_type.h2
-rw-r--r--src/object_cmd.cpp21
3 files changed, 6 insertions, 19 deletions
diff --git a/src/landscape.cpp b/src/landscape.cpp
index 1672e2f60..4804ea215 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -952,7 +952,6 @@ void GenerateLandscape(byte mode)
if (_settings_game.game_creation.landscape == LT_TROPIC) CreateDesertOrRainForest();
}
-void OnTick_Objects();
void OnTick_Town();
void OnTick_Trees();
void OnTick_Station();
@@ -967,6 +966,5 @@ void CallLandscapeTick()
OnTick_Station();
OnTick_Industry();
- OnTick_Objects();
OnTick_Companies();
}
diff --git a/src/newgrf_animation_type.h b/src/newgrf_animation_type.h
index feb2bdfd8..660cec990 100644
--- a/src/newgrf_animation_type.h
+++ b/src/newgrf_animation_type.h
@@ -57,7 +57,7 @@ enum AirpAnimationTrigger {
enum ObjectAnimationTrigger {
OAT_BUILT, ///< Triggered when the object is built (for all tiles at the same time).
OAT_TILELOOP, ///< Triggered in the periodic tile loop.
- OAT_250_TICKS, ///< Triggered every 250 ticks (for all tiles at the same time).
+ OAT_256_TICKS, ///< Triggered every 256 ticks (for all tiles at the same time).
};
#endif /* NEWGRF_ANIMATION_TYPE_H */
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp
index dbfc6fda7..f10ed4f40 100644
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -439,7 +439,11 @@ static void GetTileDesc_Object(TileIndex tile, TileDesc *td)
static void TileLoop_Object(TileIndex tile)
{
const ObjectSpec *spec = ObjectSpec::GetByTile(tile);
- if (spec->flags & OBJECT_FLAG_ANIMATION) TriggerObjectTileAnimation(Object::GetByTile(tile), tile, OAT_TILELOOP, spec);
+ if (spec->flags & OBJECT_FLAG_ANIMATION) {
+ const Object *o = Object::GetByTile(tile);
+ TriggerObjectTileAnimation(o, tile, OAT_TILELOOP, spec);
+ if (o->location.tile == tile) TriggerObjectAnimation(o, OAT_256_TICKS, spec);
+ }
if (IsTileOnWater(tile)) TileLoop_Water(tile);
@@ -491,21 +495,6 @@ static void AnimateTile_Object(TileIndex tile)
AnimateNewObjectTile(tile);
}
-/** Call the ticks on the objects. */
-void OnTick_Objects()
-{
- const Object *o;
- FOR_ALL_OBJECTS(o) {
- /* Run 250 tick interval trigger for object animation.
- * Object index is included so that triggers are not all done
- * at the same time. */
- if ((_tick_counter + o->index) % 250 == 0) {
- const ObjectSpec *spec = ObjectSpec::GetByTile(o->location.tile);
- if (spec->flags & OBJECT_FLAG_ANIMATION) TriggerObjectAnimation(o, OAT_250_TICKS, spec);
- }
- }
-}
-
/* checks, if a radio tower is within a 9x9 tile square around tile */
static bool IsRadioTowerNearby(TileIndex tile)
{