From 43079b226dec87e43e82746e32a6f756b483b891 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 30 Oct 2023 12:35:08 -0300 Subject: [PATCH] [lua] Limit the possibility to create a tileset with origin != 0,0 (fix #4118) --- src/app/script/sprite_class.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app/script/sprite_class.cpp b/src/app/script/sprite_class.cpp index 36443d22e..699b23aa6 100644 --- a/src/app/script/sprite_class.cpp +++ b/src/app/script/sprite_class.cpp @@ -651,6 +651,14 @@ int Sprite_newTileset(lua_State* L) } } } + + // This a limitation in our code and doesn't make too much sense + // to specify a different origin by default (because the origin is + // specified on the tilemap cel). + if (grid.origin() != gfx::Point(0, 0)) { + return luaL_error(L, "a tileset with origin different than 0,0 cannot be created"); + } + tileset = new Tileset(sprite, grid, ntiles); }