diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -100,7 +100,7 @@ void mainLoop(void); int main(int argc, char *argv[]){ static SDL_GLContext mainGLContext = NULL; - + // handle command line arguments if (argc > 1) { std::vector<std::string> args (argc, ""); @@ -112,7 +112,7 @@ int main(int argc, char *argv[]){ system("rm -f xml/*.dat"); } } - + // attempt to initialize SDL if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) UserError(std::string("SDL was not able to initialize! Error: ") + SDL_GetError()); @@ -237,11 +237,10 @@ int main(int argc, char *argv[]){ // load sprites used in the inventory menu. See src/inventory.cpp initInventorySprites(); - + // load mouse texture, and other inventory textures mouseTex = Texture::loadTexture("assets/mouse.png"); - // read in all XML file names in the folder std::vector<std::string> xmlFiles; if (xmlFolder.empty()) @@ -251,9 +250,10 @@ int main(int argc, char *argv[]){ // alphabetically sort files strVectorSortAlpha(&xmlFiles); - + // load the first valid XML file for the world for (const auto &xf : xmlFiles) { + std::cout << xf << std::endl; if (xf[0] != '.' && strcmp(&xf[xf.size() - 3], "dat")){ // read it in std::cout << "File to load: " << xf << '\n'; @@ -261,16 +261,16 @@ int main(int argc, char *argv[]){ break; } } - + + // make sure the world was made + if (currentWorld == NULL) + UserError("Plot twist: The world never existed...?"); + // spawn the player player = new Player(); player->sspawn(0,100); ui::menu::init(); - currentWorld->bgmPlay(NULL); - - // make sure the world was made - if (currentWorld == NULL) - UserError("Plot twist: The world never existed...?"); + currentWorld->bgmPlay(nullptr); // spawn the arena arena = new Arena(); |