MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / TriggerObjectAnimation

Function TriggerObjectAnimation

src/newgrf_object.cpp:587–602  ·  view source on GitHub ↗

* Trigger the update of animation on a whole object. * @param o The object that got triggered. * @param trigger The trigger that is triggered. * @param spec The spec associated with the object. */

Source from the content-addressed store, hash-verified

585 * @param spec The spec associated with the object.
586 */
587bool TriggerObjectAnimation(Object *o, ObjectAnimationTrigger trigger, const ObjectSpec *spec)
588{
589 if (!spec->animation.triggers.Test(trigger)) return false;
590
591 bool ret = true;
592 uint32_t random = Random();
593 for (TileIndex tile : o->location) {
594 if (DoTriggerObjectTileAnimation(o, tile, trigger, spec, random)) {
595 SB(random, 0, 16, Random());
596 } else {
597 ret = false;
598 }
599 }
600
601 return ret;
602}

Callers 2

BuildObjectFunction · 0.85
TileLoop_ObjectFunction · 0.85

Calls 4

SBFunction · 0.85
TestMethod · 0.80
RandomFunction · 0.50

Tested by

no test coverage detected