map selections are loaded instantly

This commit is contained in:
devZoGok
2026-03-14 11:32:28 +02:00
parent 499721ccd4
commit e53886c300
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -371,7 +371,7 @@ namespace battleship{
if(name != "")
generateView().script_file(GameManager::getSingleton()->getPath() + "Models/Maps/" + name + "/" + name + ".lua");
sol::table spawnPointsTbl = generateView()["map"]["spawnPoints"];
sol::table spawnPointsTbl = generateView()["metadata"]["spawnPoints"];
return spawnPointsTbl.size();
}
@@ -525,7 +525,7 @@ namespace battleship{
//TODO implement toggleable cell rendering
void Map::loadCells(){
sol::state_view SOL_LUA_VIEW = generateView();
sol::table cellsTable = SOL_LUA_VIEW[mapTable]["cells"];
sol::table cellsTable = SOL_LUA_VIEW["cells"];
int numCells = cellsTable.size();
for(int i = 0; i < numCells; i++){
@@ -570,6 +570,7 @@ namespace battleship{
sol::state_view SOL_LUA_STATE = generateView();
SOL_LUA_STATE.script_file(path + "Models/Maps/" + mapName + "/" + mapName + ".lua");
SOL_LUA_STATE.script_file(path + "Models/Maps/" + mapName + "/cells.lua");
preprareScene(false);
loadSpawnPoints();
+1 -1
View File
@@ -97,7 +97,7 @@ namespace battleship{
inline float getBaseHeight(){return baseHeight;}
inline void setBaseHeight(float bh){this->baseHeight = bh;}
private:
std::string mapTable = "map";
std::string mapTable = "metadata";
vb01::Node *terrainNode = nullptr, *cellNode = nullptr;
vb01::Material *landCellMat = nullptr, *waterCellMat = nullptr;
std::string mapName;