MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / updateIndustryAnimation1

Function updateIndustryAnimation1

src/OpenLoco/src/Map/IndustryElement.cpp:246–288  ·  view source on GitHub ↗

0x00456E32

Source from the content-addressed store, hash-verified

244
245 // 0x00456E32
246 bool updateIndustryAnimation1(const Animation& anim)
247 {
248 auto tile = TileManager::get(anim.pos);
249 for (auto& el : tile)
250 {
251 auto* elIndustry = el.as<IndustryElement>();
252 if (elIndustry == nullptr)
253 {
254 continue;
255 }
256 if (elIndustry->baseZ() != anim.baseZ)
257 {
258 continue;
259 }
260
261 auto* industry = elIndustry->industry();
262 const auto* indObj = industry->getObject();
263 const auto buildingParts = indObj->getBuildingParts(elIndustry->buildingType());
264 const auto buildingPartAnims = indObj->getBuildingPartAnimations();
265 bool hasAnimation = false;
266 uint8_t animSpeed = std::numeric_limits<uint8_t>::max();
267 for (auto& part : buildingParts)
268 {
269 auto& partAnim = buildingPartAnims[part];
270 if (partAnim.numFrames > 1)
271 {
272 hasAnimation = true;
273 animSpeed = std::min<uint8_t>(animSpeed, partAnim.animationSpeed & ~(1 << 7));
274 }
275 }
276 if (!hasAnimation)
277 {
278 return true;
279 }
280 const auto speedMask = ((1 << animSpeed) - 1);
281 if (!(ScenarioManager::getScenarioTicks() & speedMask))
282 {
283 Ui::ViewportManager::invalidate(anim.pos, el.baseHeight(), el.clearHeight(), ZoomLevel::quarter);
284 }
285 return false;
286 }
287 return true;
288 }
289
290 // 0x00456EEB
291 bool updateIndustryAnimation2(const Animation& anim)

Callers 1

callUpdateFunctionFunction · 0.85

Calls 11

getScenarioTicksFunction · 0.85
baseZMethod · 0.80
industryMethod · 0.80
baseHeightMethod · 0.80
clearHeightMethod · 0.80
getFunction · 0.70
invalidateFunction · 0.50
getObjectMethod · 0.45
getBuildingPartsMethod · 0.45
buildingTypeMethod · 0.45

Tested by

no test coverage detected