#include "Model.h" namespace asteroids { static Model *ModelInstance = NULL; bool Cmd_SaveLevel (const std::vector args) { assert (ModelInstance); if (args.size() != 1) { Engine::CommandSetErrorString ("usage: savelevel "); return false; } if (ModelInstance->DoSaveLevel (args[0].c_str()) > 0) return true; // ToDo: Maybe some error output? return false; } bool Cmd_LoadLevel (const std::vector args) { assert (ModelInstance); if (args.size() != 1) { Engine::CommandSetErrorString ("usage: loadlevel "); return false; } if (ModelInstance->DoLoadLevel (args[0].c_str()) > 0) return true; // ToDo: Maybe some error output? return false; } void Model::OnRegisterCommands () { ModelInstance = this; Engine::ModelBase::OnRegisterCommands (); Engine::AddCommand ("savelevel", Cmd_SaveLevel); Engine::AddCommand ("loadlevel", Cmd_LoadLevel); } }