Skip to content

Commit

Permalink
[ClientApplication|ServerApplication] Updated for new 'gk::ArgumentHa…
Browse files Browse the repository at this point in the history
…ndler' version.
  • Loading branch information
Unarelith committed Mar 18, 2020
1 parent 93308c9 commit e1e1c46
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
15 changes: 9 additions & 6 deletions source/client/core/ClientApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,18 @@ ClientApplication::ClientApplication(int argc, char **argv) : gk::CoreApplicatio
}

void ClientApplication::init() {
m_argumentParser.addArgument("host", {"-h", "--host", true});
m_argumentParser.addArgument("port", {"-p", "--port", true});
m_argumentParser.addArgument("singleplayer", {"-s", "--singleplayer", false});
m_argumentParser.addArgument("multiplayer", {"-m", "--multiplayer", false});
m_argumentParser.addArgument("working-dir", {"-w", "--working-dir", true});
m_argumentParser.addArgument("texture-pack", {"-t", "--texture-pack", true});
m_argumentParser.addArgument("host", {"-h", "--host", "Select the host to connect to.", "host"});
m_argumentParser.addArgument("port", {"-p", "--port", "Select the port to use.", "port"});
m_argumentParser.addArgument("singleplayer", {"-s", "--singleplayer", "Start in singleplayer mode."});
m_argumentParser.addArgument("multiplayer", {"-m", "--multiplayer", "Start in multiplayer mode."});
m_argumentParser.addArgument("working-dir", {"-w", "--working-dir", "Change the working direction to <dir>.", "dir"});
m_argumentParser.addArgument("texture-pack", {"-t", "--texture-pack", "Use texture pack <name>.", "name"});

gk::CoreApplication::init();

if (m_argumentParser.getArgument("help").isFound)
return;

if (m_argumentParser.getArgument("working-dir").isFound)
fs::current_path(m_argumentParser.getArgument("working-dir").parameter);

Expand Down
3 changes: 1 addition & 2 deletions source/client/graphics/TextureAtlas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* =====================================================================================
*/
#include <gk/core/Exception.hpp>
#include <gk/core/Filesystem.hpp>

#include "Registry.hpp"
#include "TextureAtlas.hpp"
Expand Down Expand Up @@ -105,8 +106,6 @@ void TextureAtlas::packTextures() {
m_texture.loadFromSurface(atlas.get());
}

#include <gk/core/Filesystem.hpp>

void TextureAtlas::loadFromRegistry(const std::string &texturePack) {
if (!gk::Filesystem::fileExists("texturepacks/" + texturePack))
throw EXCEPTION("Texture pack '" + texturePack +"' doesn't exist");
Expand Down
7 changes: 5 additions & 2 deletions source/server/core/ServerApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,14 @@ void ServerApplication::init() {

BlockGeometry::initOrientation();

m_argumentParser.addArgument("port", {"-p", "--port", true});
m_argumentParser.addArgument("working-dir", {"-w", "--working-dir", true});
m_argumentParser.addArgument("port", {"-p", "--port", "Select the port to use.", "port"});
m_argumentParser.addArgument("working-dir", {"-w", "--working-dir", "Change the working direction to <dir>.", "dir"});

m_argumentParser.parse();

if (m_argumentParser.getArgument("help").isFound)
return;

if (m_argumentParser.getArgument("working-dir").isFound)
fs::current_path(m_argumentParser.getArgument("working-dir").parameter);

Expand Down

0 comments on commit e1e1c46

Please sign in to comment.