| 555 | } |
| 556 | |
| 557 | void ProcessLightList() |
| 558 | { |
| 559 | #ifdef _DEBUG |
| 560 | if (DisableLighting) |
| 561 | return; |
| 562 | #endif |
| 563 | if (!UpdateLighting) |
| 564 | return; |
| 565 | for (int i = 0; i < ActiveLightCount; i++) { |
| 566 | Light &light = Lights[ActiveLights[i]]; |
| 567 | if (light.isInvalid) { |
| 568 | DoUnLight(light.position.tile, light.radius); |
| 569 | } |
| 570 | if (light.hasChanged) { |
| 571 | DoUnLight(light.position.old, light.oldRadius); |
| 572 | light.hasChanged = false; |
| 573 | } |
| 574 | } |
| 575 | for (int i = 0; i < ActiveLightCount; i++) { |
| 576 | const Light &light = Lights[ActiveLights[i]]; |
| 577 | if (light.isInvalid) { |
| 578 | ActiveLightCount--; |
| 579 | std::swap(ActiveLights[ActiveLightCount], ActiveLights[i]); |
| 580 | i--; |
| 581 | continue; |
| 582 | } |
| 583 | if (TileHasAny(dPiece[light.position.tile.x][light.position.tile.y], TileProperties::Solid)) |
| 584 | continue; // Monster hidden in a wall, don't spoil the surprise |
| 585 | DoLighting(light.position.tile, light.radius, light.position.offset); |
| 586 | } |
| 587 | |
| 588 | UpdateLighting = false; |
| 589 | } |
| 590 | |
| 591 | void SavePreLighting() |
| 592 | { |
no test coverage detected