[Fix] Windows build.
[Fix] New game stack overflow in Debug build.
This commit is contained in:
parent
7f8bf0cb59
commit
4be65645da
@ -148,18 +148,6 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="Engine"
|
Name="Engine"
|
||||||
>
|
>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\libUnuk\Engine\AStar.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\libUnuk\Engine\AStar.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\libUnuk\Engine\AStarBase.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\src\libUnuk\Engine\Character.cpp"
|
RelativePath="..\..\..\src\libUnuk\Engine\Character.cpp"
|
||||||
>
|
>
|
||||||
@ -204,6 +192,10 @@
|
|||||||
RelativePath="..\..\..\src\libUnuk\Engine\ParticleEmitter.h"
|
RelativePath="..\..\..\src\libUnuk\Engine\ParticleEmitter.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\libUnuk\Engine\Pathfinding.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\src\libUnuk\Engine\WorldManager.cpp"
|
RelativePath="..\..\..\src\libUnuk\Engine\WorldManager.cpp"
|
||||||
>
|
>
|
||||||
@ -392,6 +384,14 @@
|
|||||||
RelativePath="..\..\..\src\libUnuk\Ui\MainMenu.h"
|
RelativePath="..\..\..\src\libUnuk\Ui\MainMenu.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\libUnuk\UI\SavegameMenu.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\libUnuk\UI\SavegameMenu.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\src\libUnuk\Ui\Text.cpp"
|
RelativePath="..\..\..\src\libUnuk\Ui\Text.cpp"
|
||||||
>
|
>
|
||||||
|
@ -254,6 +254,9 @@ void Game::Render(void) {
|
|||||||
void Game::NewSavegame(const string savegameIDArg) {
|
void Game::NewSavegame(const string savegameIDArg) {
|
||||||
string saveFilename = "../Save/" + savegameIDArg;
|
string saveFilename = "../Save/" + savegameIDArg;
|
||||||
|
|
||||||
|
_map.New();
|
||||||
|
_map.Save(_saveGameID);
|
||||||
|
|
||||||
TiXmlDocument doc;
|
TiXmlDocument doc;
|
||||||
|
|
||||||
TiXmlDeclaration* decl = new TiXmlDeclaration("1.0", "", "");
|
TiXmlDeclaration* decl = new TiXmlDeclaration("1.0", "", "");
|
||||||
@ -266,7 +269,7 @@ void Game::NewSavegame(const string savegameIDArg) {
|
|||||||
|
|
||||||
int spawnX;
|
int spawnX;
|
||||||
int spawnY;
|
int spawnY;
|
||||||
_map.FindSpawnPoint(spawnX, spawnY, _player->GetWidth(), _player->GetHeight());
|
_map.FindSpawnPoint(spawnX, spawnY, 40, 45);
|
||||||
|
|
||||||
_player->SetXY(spawnX, spawnY);
|
_player->SetXY(spawnX, spawnY);
|
||||||
|
|
||||||
@ -316,12 +319,6 @@ void Game::NewSavegame(const string savegameIDArg) {
|
|||||||
doc.LinkEndChild(saveElement);
|
doc.LinkEndChild(saveElement);
|
||||||
|
|
||||||
doc.SaveFile(saveFilename.c_str());
|
doc.SaveFile(saveFilename.c_str());
|
||||||
|
|
||||||
stringstream mapPath;
|
|
||||||
mapPath << "Data/Media/Maps/" << _saveGameID;
|
|
||||||
|
|
||||||
_map.New();
|
|
||||||
_map.Save(_saveGameID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::LoadSavegame(const string savegameIDArg) {
|
void Game::LoadSavegame(const string savegameIDArg) {
|
||||||
|
@ -163,7 +163,7 @@ void LevelGen::Save(const string& filename){
|
|||||||
TiXmlElement* tileElem = new TiXmlElement("tile");
|
TiXmlElement* tileElem = new TiXmlElement("tile");
|
||||||
|
|
||||||
TiXmlElement* tileTextureElem = new TiXmlElement("tileTexture");
|
TiXmlElement* tileTextureElem = new TiXmlElement("tileTexture");
|
||||||
TiXmlText* tileTextureText = new TiXmlText(_tile[x][y].GetTileTextureName());
|
TiXmlText* tileTextureText = new TiXmlText(_tile[x][y].GetTileTextureName().c_str());
|
||||||
tileTextureElem->LinkEndChild(tileTextureText);
|
tileTextureElem->LinkEndChild(tileTextureText);
|
||||||
|
|
||||||
TiXmlElement* solidTileElem = new TiXmlElement("solidTile");
|
TiXmlElement* solidTileElem = new TiXmlElement("solidTile");
|
||||||
@ -173,7 +173,7 @@ void LevelGen::Save(const string& filename){
|
|||||||
string entityTextureName = _tile[x][y].GetEntityTextureName();
|
string entityTextureName = _tile[x][y].GetEntityTextureName();
|
||||||
|
|
||||||
TiXmlElement* entityTextureElem = new TiXmlElement("entityTexture");
|
TiXmlElement* entityTextureElem = new TiXmlElement("entityTexture");
|
||||||
TiXmlText* entityTextureText = new TiXmlText(entityTextureName.empty() ? "null" : entityTextureName);
|
TiXmlText* entityTextureText = new TiXmlText(entityTextureName.empty() ? "null" : entityTextureName.c_str());
|
||||||
entityTextureElem->LinkEndChild(entityTextureText);
|
entityTextureElem->LinkEndChild(entityTextureText);
|
||||||
|
|
||||||
TiXmlElement* solidEntityElem = new TiXmlElement("solidEntity");
|
TiXmlElement* solidEntityElem = new TiXmlElement("solidEntity");
|
||||||
@ -184,7 +184,7 @@ void LevelGen::Save(const string& filename){
|
|||||||
zLevelStr << _tile[x][y].GetZLevel();
|
zLevelStr << _tile[x][y].GetZLevel();
|
||||||
|
|
||||||
TiXmlElement* zLevelElem = new TiXmlElement("zLevel");
|
TiXmlElement* zLevelElem = new TiXmlElement("zLevel");
|
||||||
TiXmlText* zLevelText = new TiXmlText(zLevelStr.str());
|
TiXmlText* zLevelText = new TiXmlText(zLevelStr.str().c_str());
|
||||||
zLevelElem->LinkEndChild(zLevelText);
|
zLevelElem->LinkEndChild(zLevelText);
|
||||||
|
|
||||||
tileElem->LinkEndChild(tileTextureElem);
|
tileElem->LinkEndChild(tileTextureElem);
|
||||||
@ -203,7 +203,7 @@ void LevelGen::Save(const string& filename){
|
|||||||
string fullMapPath = "../Data/Media/Maps/" + filename;
|
string fullMapPath = "../Data/Media/Maps/" + filename;
|
||||||
|
|
||||||
doc.LinkEndChild(rootElem);
|
doc.LinkEndChild(rootElem);
|
||||||
doc.SaveFile(fullMapPath);
|
doc.SaveFile(fullMapPath.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LevelGen::Update(void) {
|
void LevelGen::Update(void) {
|
||||||
@ -344,34 +344,33 @@ void LevelGen::FindSpawnPoint(int& xArg, int& yArg, int objWidth, int objHeight)
|
|||||||
npcRect.w = npc->GetWidth();
|
npcRect.w = npc->GetWidth();
|
||||||
npcRect.h = npc->GetHeight();
|
npcRect.h = npc->GetHeight();
|
||||||
|
|
||||||
if(CheckCollisionRect(npcRect, objRect))
|
if(CheckCollisionRect(npcRect, objRect)) {
|
||||||
goto findNext;
|
FindSpawnPoint(xArg, yArg, objWidth, objHeight);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int x = 0; x < BOUNDARIES_X; x++) {
|
for(int i = 0; i < BOUNDARIES_X; i++) {
|
||||||
for(int y = 0; y < BOUNDARIES_Y; y++) {
|
for(int j = 0; j < BOUNDARIES_Y; j++) {
|
||||||
if(_tile[x][y].GetTileSolidity()) {
|
if(_tile[i][j].GetTileSolidity()) {
|
||||||
goto findNext;
|
FindSpawnPoint(xArg, yArg, objWidth, objHeight);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_tile[x][y].GetEntitySolitity()) {
|
if(_tile[i][j].GetEntitySolitity()) {
|
||||||
SDL_Rect entityRect;
|
SDL_Rect entityRect;
|
||||||
entityRect.x = _tile[x][y].GetEntityX();
|
entityRect.x = _tile[i][j].GetEntityX();
|
||||||
entityRect.y = _tile[x][y].GetEntityY();
|
entityRect.y = _tile[i][j].GetEntityY();
|
||||||
entityRect.w = _tile[x][y].GetEntityWidth();
|
entityRect.w = _tile[i][j].GetEntityWidth();
|
||||||
entityRect.h = _tile[x][y].GetEntityHeight();
|
entityRect.h = _tile[i][j].GetEntityHeight();
|
||||||
|
|
||||||
if(CheckCollisionRect(entityRect, objRect)) {
|
if(CheckCollisionRect(entityRect, objRect)) {
|
||||||
goto findNext;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
findNext:
|
|
||||||
FindSpawnPoint(xArg, yArg, objWidth, objHeight);
|
FindSpawnPoint(xArg, yArg, objWidth, objHeight);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LevelGen::GenerateEnemies(void) {
|
void LevelGen::GenerateEnemies(void) {
|
||||||
|
Loading…
Reference in New Issue
Block a user