1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-15 22:19:07 +00:00

Little SceneEditor on-sreen text enhancement, regarding (auto-)save

This commit is contained in:
fgenesis 2012-09-02 02:29:12 +02:00
parent 3bdb0d6bc6
commit 5d41c93c5b
3 changed files with 25 additions and 12 deletions

View file

@ -4183,7 +4183,9 @@ bool Game::loadSceneXML(std::string scene)
{ {
//errorLog("Could not find [" + fn + "]"); //errorLog("Could not find [" + fn + "]");
//msg("Could not find map [" + fn + "]"); //msg("Could not find map [" + fn + "]");
debugLog("Could not find map [" + fn + "]"); std::string s = "Could not find map [" + fn + "]";
debugLog(s);
dsq->screenMessage(s);
return false; return false;
} }
TiXmlDocument doc; TiXmlDocument doc;
@ -5401,10 +5403,10 @@ bool Game::loadScene(std::string scene)
*/ */
} }
void Game::saveScene(std::string scene) bool Game::saveScene(std::string scene)
{ {
if (!this->saveFile) if (!this->saveFile)
return; return false;
std::string fn = getSceneFilename(scene); std::string fn = getSceneFilename(scene);
@ -5464,7 +5466,7 @@ void Game::saveScene(std::string scene)
saveFile->InsertEndChild(level); saveFile->InsertEndChild(level);
*/ */
std::ostringstream obs, obsBinary; std::ostringstream obs;
int i = 0; int i = 0;
for (i = 0; i < obsRows.size(); i++) for (i = 0; i < obsRows.size(); i++)
{ {
@ -5596,7 +5598,13 @@ void Game::saveScene(std::string scene)
} }
*/ */
saveFile.SaveFile(fn); bool result = saveFile.SaveFile(fn);
if (result)
debugLog("Successfully saved map: " + fn);
else
debugLog("Failed to save map: " + fn);
return result;
} }
void Game::warpToArea(WarpArea *area) void Game::warpToArea(WarpArea *area)

View file

@ -693,7 +693,7 @@ public:
ElementTemplate *getElementTemplateByIdx(int idx); ElementTemplate *getElementTemplateByIdx(int idx);
void saveScene(std::string scene); bool saveScene(std::string scene);
typedef std::vector<WarpArea> WarpAreas; typedef std::vector<WarpArea> WarpAreas;
WarpAreas warpAreas; WarpAreas warpAreas;

View file

@ -2593,12 +2593,15 @@ void SceneEditor::loadScene()
particleManager->loadParticleBank(dsq->particleBank1, dsq->particleBank2); particleManager->loadParticleBank(dsq->particleBank1, dsq->particleBank2);
Shot::loadShotBank(dsq->shotBank1, dsq->shotBank2); Shot::loadShotBank(dsq->shotBank1, dsq->shotBank2);
dsq->game->loadEntityTypeList(); dsq->game->loadEntityTypeList();
dsq->loadElementEffects();
} }
void SceneEditor::saveScene() void SceneEditor::saveScene()
{ {
dsq->screenMessage(dsq->game->sceneName + " Saved!"); if(dsq->game->saveScene(dsq->game->sceneName))
dsq->game->saveScene(dsq->game->sceneName); dsq->screenMessage(dsq->game->sceneName + " Saved!");
else
dsq->screenMessage(dsq->game->sceneName + " FAILED to save!");
} }
void SceneEditor::deleteSelectedElement() void SceneEditor::deleteSelectedElement()
@ -3482,10 +3485,12 @@ void SceneEditor::update(float dt)
autoSaveTimer = 0; autoSaveTimer = 0;
std::ostringstream os; std::ostringstream os;
os << "auto/AUTO_" << autoSaveFile << "_" << dsq->game->sceneName; os << "auto/AUTO_" << autoSaveFile << "_" << dsq->game->sceneName;
std::string m = "Map AutoSaved to " + os.str(); if(dsq->game->saveScene(os.str()))
dsq->game->saveScene(os.str()); {
dsq->debugLog(m); std::string m = "Map AutoSaved to " + os.str();
dsq->screenMessage(m); dsq->debugLog(m);
dsq->screenMessage(m);
}
autoSaveFile++; autoSaveFile++;
if (autoSaveFile > vars->autoSaveFiles) if (autoSaveFile > vars->autoSaveFiles)