0x0046C9A8
| 534 | |
| 535 | // 0x0046C9A8 |
| 536 | static void setMapPixelsIndustries(PaletteIndex_t* mapPtr, PaletteIndex_t* mapAltPtr, Pos2 pos, Pos2 delta) |
| 537 | { |
| 538 | for (auto rowCountLeft = kMapColumns; rowCountLeft > 0; rowCountLeft--) |
| 539 | { |
| 540 | // Coords shouldn't be at map edge |
| 541 | if (!(pos.x > 0 && pos.y > 0 && pos.x < kMapWidth - kTileSize && pos.y < kMapHeight - kTileSize)) |
| 542 | { |
| 543 | pos += delta; |
| 544 | mapPtr += kRenderedMapWidth + 1; |
| 545 | mapAltPtr += kRenderedMapWidth + 1; |
| 546 | continue; |
| 547 | } |
| 548 | |
| 549 | PaletteIndex_t colourFlash0{}, colourFlash1{}, colour0{}, colour1{}; |
| 550 | auto tile = TileManager::get(pos); |
| 551 | for (auto& el : tile) |
| 552 | { |
| 553 | switch (el.type()) |
| 554 | { |
| 555 | case ElementType::surface: |
| 556 | { |
| 557 | auto* surfaceEl = el.as<SurfaceElement>(); |
| 558 | if (surfaceEl == nullptr) |
| 559 | { |
| 560 | continue; |
| 561 | } |
| 562 | |
| 563 | if (surfaceEl->water() > 0) |
| 564 | { |
| 565 | const auto* waterObj = ObjectManager::get<WaterObject>(); |
| 566 | const auto* waterImage = Gfx::getG1Element(waterObj->mapPixelImage); |
| 567 | colour0 = colour1 = colourFlash0 = colourFlash1 = waterImage->offset[0]; |
| 568 | } |
| 569 | else |
| 570 | { |
| 571 | const auto* landObj = ObjectManager::get<LandObject>(surfaceEl->terrain()); |
| 572 | const auto* landImage = Gfx::getG1Element(landObj->mapPixelImage); |
| 573 | colour0 = colour1 = colourFlash0 = colourFlash1 = landImage->offset[0]; |
| 574 | } |
| 575 | |
| 576 | if (surfaceEl->isIndustrial()) |
| 577 | { |
| 578 | const auto* industry = IndustryManager::get(surfaceEl->industryId()); |
| 579 | const auto colourIndex = _assignedIndustryColours[industry->objectId]; |
| 580 | colour0 = colourFlash0 = kIndustryColours[colourIndex]; |
| 581 | if (_flashingItems & (1 << industry->objectId)) |
| 582 | { |
| 583 | colourFlash0 = PaletteIndex::black0; |
| 584 | } |
| 585 | } |
| 586 | break; |
| 587 | } |
| 588 | |
| 589 | case ElementType::building: |
| 590 | // Vanilla omitted the ghost check |
| 591 | if (!el.isGhost()) |
| 592 | { |
| 593 | colour0 = colourFlash0 = PaletteIndex::mutedDarkRed2; |
no test coverage detected