0x0046C873
| 432 | |
| 433 | // 0x0046C873 |
| 434 | static void setMapPixelsVehicles(PaletteIndex_t* mapPtr, PaletteIndex_t* mapAltPtr, Pos2 pos, Pos2 delta) |
| 435 | { |
| 436 | for (auto rowCountLeft = kMapColumns; rowCountLeft > 0; rowCountLeft--) |
| 437 | { |
| 438 | // Coords shouldn't be at map edge |
| 439 | if (!(pos.x > 0 && pos.y > 0 && pos.x < kMapWidth - kTileSize && pos.y < kMapHeight - kTileSize)) |
| 440 | { |
| 441 | pos += delta; |
| 442 | mapPtr += kRenderedMapWidth + 1; |
| 443 | mapAltPtr += kRenderedMapWidth + 1; |
| 444 | continue; |
| 445 | } |
| 446 | |
| 447 | PaletteIndex_t colourFlash0{}, colourFlash1{}, colour0{}, colour1{}; |
| 448 | auto tile = TileManager::get(pos); |
| 449 | for (auto& el : tile) |
| 450 | { |
| 451 | switch (el.type()) |
| 452 | { |
| 453 | case ElementType::surface: |
| 454 | { |
| 455 | auto* surfaceEl = el.as<SurfaceElement>(); |
| 456 | if (surfaceEl == nullptr) |
| 457 | { |
| 458 | continue; |
| 459 | } |
| 460 | |
| 461 | if (surfaceEl->water() == 0) |
| 462 | { |
| 463 | const auto* landObj = ObjectManager::get<LandObject>(surfaceEl->terrain()); |
| 464 | const auto* landImage = Gfx::getG1Element(landObj->mapPixelImage); |
| 465 | colourFlash0 = colourFlash1 = landImage->offset[0]; |
| 466 | } |
| 467 | else |
| 468 | { |
| 469 | const auto* waterObj = ObjectManager::get<WaterObject>(); |
| 470 | const auto* waterImage = Gfx::getG1Element(waterObj->mapPixelImage); |
| 471 | colourFlash0 = colourFlash1 = waterImage->offset[0]; |
| 472 | } |
| 473 | |
| 474 | colour0 = colour1 = colourFlash0; |
| 475 | break; |
| 476 | } |
| 477 | |
| 478 | case ElementType::track: |
| 479 | case ElementType::station: |
| 480 | case ElementType::road: |
| 481 | if (!el.isGhost() && !el.isAiAllocated()) |
| 482 | { |
| 483 | colour0 = colourFlash0 = PaletteIndex::black2; |
| 484 | colourFlash1 = colourFlash0; |
| 485 | colour1 = colour0; |
| 486 | } |
| 487 | break; |
| 488 | |
| 489 | case ElementType::building: |
| 490 | case ElementType::industry: |
| 491 | if (!el.isGhost()) |
no test coverage detected