mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
Merge pull request #228 from devZoGok/bf-224-landmass-fix
Bf 224 landmass fix
This commit is contained in:
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
@@ -0,0 +1,46 @@
|
||||
metadata = {
|
||||
lights = {
|
||||
{type = 3, color = {x = 0.900000, y = 0.900000, z = 0.900000}},
|
||||
},
|
||||
size = {x = 400.000000, y = 125.559235, z = 900.000000},
|
||||
impassibleNodeValue = 65535,
|
||||
spawnPoints = {
|
||||
{x = -105.929001, y = -0.110725, z = -404.756104},
|
||||
{x = 17.326164, y = 0.000046, z = 390.545441},
|
||||
},
|
||||
choosablePlayers = {
|
||||
{
|
||||
units = {
|
||||
{id = 10, pos = {x = -20.000000, y = 0.000000, z = -20.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}},
|
||||
},
|
||||
resourceDeposits = {}
|
||||
},
|
||||
{
|
||||
units = {
|
||||
{id = UnitId.ACS_TANK, pos = {x = -20.000000, y = 0.000000, z = -20.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}},
|
||||
},
|
||||
resourceDeposits = {}
|
||||
}
|
||||
},
|
||||
civilianPlayer = {
|
||||
units = {},
|
||||
resourceDeposits = {
|
||||
{id = 0, pos = {x = -105.929001, y = -0.110725, z = -404.756104}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 111.306473, y = 0.000031, z = -413.114807}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 72.301971, y = 0.000023, z = -363.649902}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 15.789061, y = -0.010529, z = -308.128113}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 37.890579, y = 0.000076, z = -405.671021}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 39.080250, y = 0.000000, z = -367.778442}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 34.379860, y = 0.000015, z = 329.448395}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 31.606178, y = 0.000000, z = 352.831665}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 17.326164, y = 0.000046, z = 390.545441}, rot = {w = -0.770531, x = 0.000000, y = -0.637403, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = -7.834114, y = 0.000000, z = 390.160706}, rot = {w = -0.251298, x = 0.000000, y = -0.967910, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 10.215218, y = 0.000000, z = 365.251648}, rot = {w = -0.251298, x = 0.000000, y = -0.967910, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 37.141624, y = 0.000031, z = 369.058044}, rot = {w = -0.251298, x = 0.000000, y = -0.967910, z = 0.000000}, initAmmount = 20000},
|
||||
}
|
||||
},
|
||||
skybox = "Skybox1",
|
||||
terrain = {model = "2lakes.xml", albedo = "2lakes.jpg"},
|
||||
waterbodies = {
|
||||
{pos = {x = 95.027946, y = -4.370541, z = -69.016838}, size = {x = 217.145874, y = 548.432861}, albedo = "water.png"}, {pos = {x = -119.546631, y = -11.024619, z = -49.300659}, size = {x = 139.869385, y = 470.795258}, albedo = "water.png"}, }
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
@@ -0,0 +1,58 @@
|
||||
metadata = {
|
||||
lights = {
|
||||
{type = 3, color = {x = 0.900000, y = 0.900000, z = 0.900000}},
|
||||
},
|
||||
size = {x = 1000.000000, y = 260.354523, z = 1000.000000},
|
||||
impassibleNodeValue = 65535,
|
||||
spawnPoints = {
|
||||
{x = 50.410851, y = 0.000046, z = -472.358398},
|
||||
{x = 407.292053, y = 0.035400, z = 449.050964},
|
||||
{x = -450.032196, y = 0.000031, z = 417.242737}
|
||||
},
|
||||
choosablePlayers = {
|
||||
{
|
||||
units = {
|
||||
{id = UnitId.ACS_MECH, pos = {x = 50.410851, y = 0.000046, z = -472.358398}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}},
|
||||
},
|
||||
resourceDeposits = {}
|
||||
},
|
||||
{
|
||||
units = {
|
||||
{id = UnitId.ACS_MECH, pos = {x = 407.292053, y = 0.035400, z = 449.050964}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}},
|
||||
},
|
||||
resourceDeposits = {}
|
||||
},
|
||||
{
|
||||
units = {
|
||||
{id = UnitId.ACS_MECH, pos = {x = -450.032196, y = 0.000031, z = 417.242737}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}},
|
||||
},
|
||||
resourceDeposits = {}
|
||||
},
|
||||
},
|
||||
civilianPlayer = {
|
||||
units = {},
|
||||
resourceDeposits = {
|
||||
{id = 0, pos = {x = 407.292053, y = 0.035400, z = 449.050964}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 388.774841, y = 0.028824, z = 448.299225}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 368.191223, y = 0.020782, z = 448.422272}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 347.570312, y = 0.008224, z = 407.701385}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 373.537720, y = 0.019989, z = 422.497559}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = -450.032196, y = 0.000031, z = 417.242737}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = -425.042511, y = 0.000031, z = 411.944916}, rot = {w = -0.275866, x = 0.000000, y = 0.961196, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = -400.767151, y = 0.000061, z = 391.045227}, rot = {w = -0.275866, x = 0.000000, y = 0.961196, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = -421.781281, y = 0.000046, z = 391.056610}, rot = {w = -0.275866, x = 0.000000, y = 0.961196, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = -438.017151, y = 0.000031, z = 402.490692}, rot = {w = -0.275866, x = 0.000000, y = 0.961196, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = -410.310394, y = 0.000061, z = 422.562714}, rot = {w = -0.969856, x = 0.000000, y = -0.243677, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 50.410851, y = 0.000046, z = -472.358398}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 31.740002, y = 0.000031, z = -463.164642}, rot = {w = 0.966213, x = 0.000000, y = 0.257746, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 39.761688, y = 0.000046, z = -436.009583}, rot = {w = 0.526699, x = 0.000000, y = -0.850052, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 57.385757, y = 0.000092, z = -451.965759}, rot = {w = -0.955132, x = 0.000000, y = -0.296180, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 72.339455, y = 0.000015, z = -473.400116}, rot = {w = -0.955132, x = 0.000000, y = -0.296180, z = 0.000000}, initAmmount = 20000},
|
||||
},
|
||||
|
||||
},
|
||||
skybox = "Skybox1",
|
||||
terrain = {model = "3islands.xml", albedo = "3islands.jpg"},
|
||||
waterbodies = {
|
||||
{pos = {x = 0.075614, y = -18.453371, z = 0.000000}, size = {x = 1000.000000, y = 1000.000000}, albedo = "water.png"}, }
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
+20
-60513
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+54
-4051
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+18
-15139
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 8.8 KiB |
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
@@ -0,0 +1,50 @@
|
||||
metadata = {
|
||||
lights = {
|
||||
{type = 3, color = {x = 0.900000, y = 0.900000, z = 0.900000}},
|
||||
},
|
||||
size = {x = 1000.000000, y = 315.232758, z = 1000.000000},
|
||||
impassibleNodeValue = 65535,
|
||||
spawnPoints = {
|
||||
{x = -396.000000, y = 0.000000, z = -374.000000},
|
||||
{x = 360.000000, y = 0.000000, z = 400.000000},
|
||||
{x = -326.000000, y = 0.000000, z = 374.000000},
|
||||
},
|
||||
choosablePlayers = {
|
||||
{
|
||||
units = {
|
||||
{id = 10, pos = {x = -20.000000, y = 0.000000, z = -20.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}},
|
||||
{id = UnitId.ACS_TANK, pos = {x = 325.000000, y = 0.000000, z = 345.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}},
|
||||
},
|
||||
resourceDeposits = {}
|
||||
},
|
||||
{
|
||||
units = {
|
||||
{id = UnitId.ACS_CYBORG_ENGINEER, pos = {x = 325.000000, y = 0.000000, z = 445.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}},
|
||||
},
|
||||
resourceDeposits = {}
|
||||
},
|
||||
{
|
||||
units = {
|
||||
{id = UnitId.AINC_CYBORG_ENGINEER, pos = {x = -325.000000, y = 0.000000, z = 415.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}},
|
||||
},
|
||||
resourceDeposits = {}
|
||||
},
|
||||
},
|
||||
civilianPlayer = {
|
||||
resourceDeposits = {
|
||||
{id = 0, pos = {x = 450.000000, y = 0.000000, z = 450.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 450.000000, y = 0.000000, z = 430.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 450.000000, y = 0.000000, z = 410.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = 450.000000, y = 0.000000, z = 390.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = -450.000000, y = 0.000000, z = 350.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = -450.000000, y = 0.000000, z = 360.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = -450.000000, y = 0.000000, z = 370.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
{id = 0, pos = {x = -450.000000, y = 0.000000, z = 380.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 20000},
|
||||
},
|
||||
|
||||
},
|
||||
skybox = "Skybox1",
|
||||
terrain = {model = "w5.xml", albedo = "w5.jpg"},
|
||||
waterbodies = {
|
||||
{pos = {x = -71.606972, y = -4.143668, z = 0.000000}, size = {x = 534.327454, y = 995.253296}, albedo = "water.png"}, }
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -221,39 +221,38 @@ namespace battleship{
|
||||
}
|
||||
|
||||
Map* Map::getSingleton(){
|
||||
if(!map)
|
||||
map = new Map;
|
||||
if(!map) map = new Map;
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
vector<Map::Edge> Map::generateAdjacentNodeEdges(int numVertCells, int i, int numHorCells, int j, int weight){
|
||||
vector<Map::Edge> edges;
|
||||
bool up = (i > 0), right = (j < numHorCells - 1), down = (i < numVertCells - 1), left = (j > 0);
|
||||
bool checkUp = (i > 0), checkRight = (j < numHorCells - 1), checkDown = (i < numVertCells - 1), checkLeft = (j > 0);
|
||||
|
||||
if(left)
|
||||
edges.push_back(Map::Edge(weight, numVertCells * i + j, numVertCells * i + j - 1));
|
||||
if(checkLeft)
|
||||
edges.push_back(Map::Edge(weight, numHorCells * i + j, numHorCells * i + j - 1));
|
||||
|
||||
if(right)
|
||||
edges.push_back(Map::Edge(weight, numVertCells * i + j, numVertCells * i + j + 1));
|
||||
if(checkRight)
|
||||
edges.push_back(Map::Edge(weight, numHorCells * i + j, numHorCells * i + j + 1));
|
||||
|
||||
if(up)
|
||||
edges.push_back(Map::Edge(weight, numVertCells * i + j, numVertCells * (i - 1) + j));
|
||||
if(checkUp)
|
||||
edges.push_back(Map::Edge(weight, numHorCells * i + j, numHorCells * (i - 1) + j));
|
||||
|
||||
if(down)
|
||||
edges.push_back(Map::Edge(weight, numVertCells * i + j, numVertCells * (i + 1) + j));
|
||||
if(checkDown)
|
||||
edges.push_back(Map::Edge(weight, numHorCells * i + j, numHorCells * (i + 1) + j));
|
||||
|
||||
if(up && left)
|
||||
edges.push_back(Map::Edge(int(sqrt(2 * weight * weight)), numVertCells * i + j, numVertCells * (i - 1) + j - 1));
|
||||
if(checkUp && checkLeft)
|
||||
edges.push_back(Map::Edge(int(sqrt(2 * weight * weight)), numHorCells * i + j, numHorCells * (i - 1) + j - 1));
|
||||
|
||||
if(up && right)
|
||||
edges.push_back(Map::Edge((sqrt(2 * weight * weight)), numVertCells * i + j, numVertCells * (i - 1) + j + 1));
|
||||
if(checkUp && checkRight)
|
||||
edges.push_back(Map::Edge(int(sqrt(2 * weight * weight)), numHorCells * i + j, numHorCells * (i - 1) + j + 1));
|
||||
|
||||
if(down && left)
|
||||
edges.push_back(Map::Edge((sqrt(2 * weight * weight)), numVertCells * i + j, numVertCells * (i + 1) + j - 1));
|
||||
if(checkDown && checkLeft)
|
||||
edges.push_back(Map::Edge(int(sqrt(2 * weight * weight)), numHorCells * i + j, numHorCells * (i + 1) + j - 1));
|
||||
|
||||
if(down && right)
|
||||
edges.push_back(Map::Edge((sqrt(2 * weight * weight)), numVertCells * i + j, numVertCells * (i + 1) + j + 1));
|
||||
if(checkDown && checkRight)
|
||||
edges.push_back(Map::Edge(int(sqrt(2 * weight * weight)), numHorCells * i + j, numHorCells * (i + 1) + j + 1));
|
||||
|
||||
return edges;
|
||||
}
|
||||
@@ -371,7 +370,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 +524,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 +569,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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
+35
-30
@@ -354,10 +354,10 @@ namespace battleship{
|
||||
Vector3 waterPos = terrainNode->getChild(k)->getPosition();
|
||||
Vector3 waterSize = ((Quad*)terrainNode->getChild(k)->getMesh(0))->getSize();
|
||||
|
||||
if(fabs(res[0].pos.x - waterPos.x) < .5 * waterSize.x && fabs(res[0].pos.z - waterPos.z) < .5 * waterSize.y){
|
||||
if(pos.y < waterPos.y && fabs(res[0].pos.x - waterPos.x) < .5 * waterSize.x && fabs(res[0].pos.z - waterPos.z) < .5 * waterSize.y){
|
||||
type = Map::Cell::Type::WATER;
|
||||
pos.y = waterPos.y;
|
||||
waterBodyBedPoints.push_back(pair(numVertCells * i + j, res[0].pos.y));
|
||||
waterBodyBedPoints.push_back(pair(numVertCells * j + i, res[0].pos.y));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -478,7 +478,7 @@ namespace battleship{
|
||||
void MapEditorAppState::MapEditor::generateMapScript(vector<Map::Cell> &cells){
|
||||
int numWaterBodies = map->getNodeParent()->getNumChildren() - 1;
|
||||
|
||||
string mapScript = "map = {\n\tlights = {";
|
||||
string mapScript = "metadata = {\n\tlights = {";
|
||||
|
||||
for(Node *light : map->getLights()){
|
||||
mapScript += "\n\t\t{type = " + to_string((int)light->getLight(0)->getLightType());
|
||||
@@ -514,31 +514,6 @@ namespace battleship{
|
||||
|
||||
mapScript += "\t},\n";
|
||||
mapScript += "\tcivilianPlayer = {\n" + generatePlayerTableStr(game->getCivilianPlayer()) + "\n\t},\n";
|
||||
mapScript += "\tcells = {\n";
|
||||
|
||||
for(Map::Cell cell : cells){
|
||||
Vector3 p = cell.pos;
|
||||
mapScript += "\t\t{type = " + to_string((int)cell.type) + ", pos = {x = " + to_string(p.x) + ", y = " + to_string(p.y) + ", z = " + to_string(p.z) + "}, numEdges = " + to_string(cell.edges.size()) + ", edges = {";
|
||||
|
||||
for(Map::Edge edge : cell.edges)
|
||||
mapScript += "{srcCellId = " + to_string(edge.srcCellId) + ", destCellId = " + to_string(edge.destCellId) + ", weight = " + to_string(edge.weight) + "}, ";
|
||||
|
||||
int numSubCells = cell.underWaterCellIds.size();
|
||||
mapScript += "}, numUnderWaterCells = " + to_string(numSubCells) + ",";
|
||||
|
||||
if(numSubCells > 0){
|
||||
mapScript += "underWaterCellId = {";
|
||||
|
||||
for(int subCellId : cell.underWaterCellIds)
|
||||
mapScript += to_string(subCellId) + ", ";
|
||||
|
||||
mapScript += "}";
|
||||
}
|
||||
|
||||
mapScript += "\t\t},\n";
|
||||
}
|
||||
|
||||
mapScript += "\t},\n";
|
||||
|
||||
Root *root = Root::getSingleton();
|
||||
string skyboxPath = "";
|
||||
@@ -568,11 +543,41 @@ namespace battleship{
|
||||
|
||||
mapScript += "\t}\n}";
|
||||
|
||||
string file = GameManager::getSingleton()->getPath() + "Models/Maps/" + map->getMapName() + "/" + map->getMapName() + ".lua";
|
||||
string cellsScript = "cells = {\n";
|
||||
|
||||
std::ofstream outFile(file);
|
||||
for(Map::Cell cell : cells){
|
||||
Vector3 p = cell.pos;
|
||||
cellsScript += "\t\t{type = " + to_string((int)cell.type) + ", pos = {x = " + to_string(p.x) + ", y = " + to_string(p.y) + ", z = " + to_string(p.z) + "}, numEdges = " + to_string(cell.edges.size()) + ", edges = {";
|
||||
|
||||
for(Map::Edge edge : cell.edges)
|
||||
cellsScript += "{srcCellId = " + to_string(edge.srcCellId) + ", destCellId = " + to_string(edge.destCellId) + ", weight = " + to_string(edge.weight) + "}, ";
|
||||
|
||||
int numSubCells = cell.underWaterCellIds.size();
|
||||
cellsScript += "}, numUnderWaterCells = " + to_string(numSubCells) + ",";
|
||||
|
||||
if(numSubCells > 0){
|
||||
cellsScript += "underWaterCellId = {";
|
||||
|
||||
for(int subCellId : cell.underWaterCellIds)
|
||||
cellsScript += to_string(subCellId) + ", ";
|
||||
|
||||
cellsScript += "}";
|
||||
}
|
||||
|
||||
cellsScript += "\t\t},\n";
|
||||
}
|
||||
|
||||
cellsScript += "\t}";
|
||||
|
||||
string basePath = GameManager::getSingleton()->getPath() + "Models/Maps/" + map->getMapName() + "/";
|
||||
|
||||
std::ofstream outFile(basePath + map->getMapName() + ".lua");
|
||||
outFile << mapScript;
|
||||
outFile.close();
|
||||
|
||||
outFile = std::ofstream(basePath + "cells.lua");
|
||||
outFile << cellsScript;
|
||||
outFile.close();
|
||||
}
|
||||
|
||||
void MapEditorAppState::MapEditor::exportMap(){
|
||||
|
||||
Reference in New Issue
Block a user