git repos / saland

commit 9a938c67

sago007 · 2020-07-17 15:24
9a938c67242b6d366da86d41eca7ca7c71066745 patch · browse files
parent 2a0cd8f0aa3c54b9d4de53fdad8b7ad833e4ab62

Do now allow removing block elements from protected regions

Changed files

M src/saland/Game.cpp before
diff --git a/src/saland/Game.cpp b/src/saland/Game.cpp index 161b0c3..818f48a 100644 --- a/src/saland/Game.cpp +++ b/src/saland/Game.cpp
@@ -383,7 +383,8 @@ void Game::ProcessInput(const SDL_Event& event, bool& processed) {
data->gameRegion.world.init_physics(data->gameRegion.physicsBox);
}
if (event.key.keysym.sym == globalData.playerControls.block_delete
- && sago::tiled::tileInBound(data->gameRegion.world.tm, tile_x, tile_y)) {
+ && sago::tiled::tileInBound(data->gameRegion.world.tm, tile_x, tile_y)
+ && !(data->gameRegion.world.tile_protected(tile_x, tile_y)) ) {
int layer_number = 2; // Do not hardcode
uint32_t tile = 0;
sago::tiled::setTileOnLayerNumber(data->gameRegion.world.tm, layer_number, tile_x, tile_y, tile);