Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-01-15 16:59:07 +0000
committerStijn Buys <ingar@osirion.org>2012-01-15 16:59:07 +0000
commit534e30270a8636ab8e2cc5e8b750747186dd06af (patch)
tree1e3bd443336b17b9ad3e3e21f9b51d394b7619ff /src
parent714dc789aa08230468031ee6143be4535fbfd287 (diff)
Implement the savegame and loadgame console functions.
Diffstat (limited to 'src')
-rw-r--r--src/client/client.cc34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/client/client.cc b/src/client/client.cc
index 897ab41..1ee53d3 100644
--- a/src/client/client.cc
+++ b/src/client/client.cc
@@ -17,6 +17,7 @@
#include "client/video.h"
#include "client/input.h"
#include "client/soundext.h"
+#include "client/savegamemenu.h"
#include "core/core.h"
#include "core/loader.h"
#include "core/zone.h"
@@ -643,30 +644,31 @@ void Client::func_testmodel(std::string const &args)
}
// quick load
-void Client::func_loadgame(std::string const &args)
+void Client::func_savegame(std::string const &args)
{
- std::string savegamepath(filesystem::writedir());
- savegamepath.append("savegames");
-
- filesystem::Directory directory(savegamepath);
+ std::stringstream argstr(args);
+ std::string savename;
+ argstr >> savename;
+ aux::to_label(savename);
- for (filesystem::Directory::FileNames::const_iterator it = directory.filenames().begin();
- it != directory.filenames().end(); ++it)
- {
- con_print << (*it) << std::endl;
- }
+ if (!savename.size()) {
+ savename.assign("quick");
+ }
+ SaveGameMenu::savegame(savename);
}
// quik save
-void Client::func_savegame(std::string const &args)
+void Client::func_loadgame(std::string const &args)
{
- // make sure the screenshots folder exists
- std::string savegamepath(filesystem::writedir());
- savegamepath.append("savegames");
+ std::stringstream argstr(args);
+ std::string savename;
+ argstr >> savename;
+ aux::to_label(savename);
- if (!sys::directory_exists(savegamepath)) {
- sys::mkdir(savegamepath);
+ if (!savename.size()) {
+ savename.assign("quick");
}
+ SaveGameMenu::loadgame(savename);
}
} // namespace client