1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 19:49:54 +00:00
openmw-tes3mp/apps/openmw/mwmp/Main.hpp
David Cernat 270867a397 [Client] Ensure mwmp::Main is initialized before GUIController cleanup
Previously, certain errors early in the program's execution – such as an attempt to use two different packet processors for the same packet ID – would not be displayed because of a crash when attempting to get an uninitialized mwmp::Main in the Engine's destructor.
2019-12-04 08:39:33 +02:00

65 lines
1.8 KiB
C++

#ifndef OPENMW_MWMP_MAIN
#define OPENMW_MWMP_MAIN
#include "../mwworld/ptr.hpp"
#include <boost/program_options.hpp>
#include <components/files/collections.hpp>
namespace mwmp
{
class GUIController;
class CellController;
class LocalSystem;
class LocalPlayer;
class Networking;
class Main
{
public:
Main();
~Main();
static void optionsDesc(boost::program_options::options_description *desc);
static void configure(const boost::program_options::variables_map &variables);
static bool init(std::vector<std::string> &content, Files::Collections &collections);
static void postInit();
static bool isInitialized();
static void destroy();
static const Main &get();
static void frame(float dt);
static bool isValidPacketScript(std::string scriptId);
static bool isValidPacketGlobal(std::string globalId);
static std::string getResDir();
Networking *getNetworking() const;
LocalSystem *getLocalSystem() const;
LocalPlayer *getLocalPlayer() const;
GUIController *getGUIController() const;
CellController *getCellController() const;
void updateWorld(float dt) const;
private:
static std::string resourceDir;
static std::string address;
static std::string serverPassword;
Main (const Main&);
///< not implemented
Main& operator= (const Main&);
///< not implemented
static Main *pMain;
Networking *mNetworking;
LocalSystem *mLocalSystem;
LocalPlayer *mLocalPlayer;
GUIController *mGUIController;
CellController *mCellController;
std::string server;
unsigned short port;
};
}
#endif //OPENMW_MWMP_MAIN