git repos / saland

commit b88945ef

Poul Sander · 2025-12-22 10:48
b88945ef6cfa46486e71b4e1ca826da182034171 patch · browse files
parent 31ad49a42e6c3f3202884b2c38947a8c4018f2fc

Clear block now works again

Changed files

M src/saland/Game.cpp before
M src/saland/Prefabs.cpp before
diff --git a/src/saland/Game.cpp b/src/saland/Game.cpp index 52df3d4..29f66ff 100644 --- a/src/saland/Game.cpp +++ b/src/saland/Game.cpp
@@ -886,7 +886,7 @@ void Game::Update() {
int tile_y = data->world_mouse_y/32;
if (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
+ int layer_number = data->gameRegion.world.blockingLayer;
uint32_t tile = 0;
sago::tiled::setTileOnLayerNumber(data->gameRegion.world.tm, layer_number, tile_x, tile_y, tile);
data->gameRegion.liqudHandler["water"].updateFirstTile(data->gameRegion.world.tm, tile_x, tile_y);
diff --git a/src/saland/Prefabs.cpp b/src/saland/Prefabs.cpp index 9af87dd..61926e5 100644 --- a/src/saland/Prefabs.cpp +++ b/src/saland/Prefabs.cpp
@@ -118,7 +118,12 @@ Prefab getPrefab(const char* name) {
return p;
}
-
+void TestApplyPrefab(sago::tiled::TileMap& dest, int destX, int destY) {
+ if (prefabs.size() == 0) {
+ return;
+ }
+ ApplyPrefab(dest, destX, destY, prefabs.front());
+}
void ScanPrefabs(const std::string& filename) {
std::string mapFileName = "maps/"+filename+".tmx";