#include "serverremoteplayer.h"
#include "mods.h"
#include "inventorymanager.h"
+#include "subgame.h"
struct LuaState;
typedef struct lua_State lua_State;
class IWritableItemDefManager;
class IWritableNodeDefManager;
class IWritableCraftDefManager;
+class ServerError : public std::exception
+{
+public:
+ ServerError(const std::string &s)
+ {
+ m_s = "ServerError: ";
+ m_s += s;
+ }
+ virtual ~ServerError() throw()
+ {}
+ virtual const char * what() const throw()
+ {
+ return m_s.c_str();
+ }
+ std::string m_s;
+};
+
/*
Some random functions
*/
void PrintLine(std::ostream *s);
};
-u32 PIChecksum(core::list<PlayerInfo> &l);
-
/*
Used for queueing and sorting block transfers in containers
/*
NOTE: Every public method should be thread-safe
*/
-
+
Server(
- std::string mapsavedir,
- std::string configpath
+ const std::string &path_world,
+ const std::string &path_config,
+ const SubgameSpec &gamespec
);
~Server();
void start(unsigned short port);
const ModSpec* getModSpec(const std::string &modname);
- std::string getWorldPath(){ return m_mapsavedir; }
+ std::string getWorldPath(){ return m_path_world; }
+
+ void setAsyncFatalError(const std::string &error)
+ {
+ m_async_fatal_error.set(error);
+ }
private:
{
Player *player = m_env->getPlayer(peer_id);
if(player == NULL)
- return "[id="+itos(peer_id);
+ return "[id="+itos(peer_id)+"]";
return player->getName();
}
Variables
*/
+ // World directory
+ std::string m_path_world;
+ // Path to user's configuration file ("" = no configuration file)
+ std::string m_path_config;
+ // Subgame specification
+ SubgameSpec m_gamespec;
+
+ // Equivalent of /usr/share/minetest/server
+ std::string m_path_share;
+
+ // Thread can set; step() will throw as ServerError
+ MutexedVariable<std::string> m_async_fatal_error;
+
// Some timers
float m_liquid_transform_timer;
float m_print_info_timer;
/*
Random stuff
*/
-
- // Map directory
- std::string m_mapsavedir;
-
- // Configuration path ("" = no configuration file)
- std::string m_configpath;
// Mod parent directory paths
core::list<std::string> m_modspaths;