variable number of CPU player listboxes in map selection screens

This commit is contained in:
devZoGok
2025-03-02 16:16:55 +02:00
parent a1011e14f0
commit ae3e9b8b73
10 changed files with 76 additions and 90 deletions
+10 -4
View File
@@ -374,14 +374,20 @@ namespace battleship{
}
}
int Map::getNumMapSpawnPoints(string name){
if(name != "")
generateView().script_file(GameManager::getSingleton()->getPath() + "Models/Maps/" + name + "/" + name + ".lua");
sol::table spawnPointsTbl = generateView()["map"]["spawnPoints"];
return spawnPointsTbl.size();
}
void Map::loadSpawnPoints(){
sol::state_view SOL_LUA_VIEW = generateView();
string spawnPointInd = "spawnPoints";
sol::table spawnPointsTbl = SOL_LUA_VIEW[mapTable][spawnPointInd];
int numSpawnPoints = spawnPointsTbl.size();
int numSpawnPoints = getNumSpawnPoints();
for(int i = 0; i < numSpawnPoints; i++){
sol::table posTable = SOL_LUA_VIEW[mapTable][spawnPointInd][i + 1];
sol::table posTable = SOL_LUA_VIEW[mapTable]["spawnPoints"][i + 1];
spawnPoints.push_back(Vector3(posTable["x"], posTable["y"], posTable["z"]));
}
}