51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-/*
-(c) 2010 Perttu Ahola <celeron55@gmail.com>
-*/
-
#ifndef SERVER_HEADER
#define SERVER_HEADER
*/
Server(
- std::string mapsavedir
+ std::string mapsavedir,
+ std::string configpath
);
~Server();
void start(unsigned short port);
dstream<<"WARNING: Auth not found for "<<name<<std::endl;
}
}
+
+ // Saves g_settings to configpath given at initialization
+ void saveConfig()
+ {
+ if(m_configpath != "")
+ g_settings.updateConfigFile(m_configpath.c_str());
+ }
private:
Additionally, if far_players!=NULL, players further away than
far_d_nodes are ignored and their peer_ids are added to far_players
*/
+ // Envlock and conlock should be locked when calling these
void sendRemoveNode(v3s16 p, u16 ignore_id=0,
core::list<u16> *far_players=NULL, float far_d_nodes=100);
void sendAddNode(v3s16 p, MapNode n, u16 ignore_id=0,
core::list<u16> *far_players=NULL, float far_d_nodes=100);
+ void setBlockNotSent(v3s16 p);
// Environment and Connection must be locked when called
void SendBlockNoLock(u16 peer_id, MapBlock *block, u8 ver);
- // Sends blocks to clients
+ // Sends blocks to clients (locks env and con on its own)
void SendBlocks(float dtime);
/*
// When called, connection mutex should be locked
RemoteClient* getClient(u16 peer_id);
+ // When called, environment mutex should be locked
+ std::string getPlayerName(u16 peer_id)
+ {
+ Player *player = m_env.getPlayer(peer_id);
+ if(player == NULL)
+ return "[id="+itos(peer_id);
+ return player->getName();
+ }
+
/*
Get a player from memory or creates one.
If player is already connected, return NULL
float m_objectdata_timer;
float m_emergethread_trigger_timer;
float m_savemap_timer;
+ IntervalLimiter m_map_timer_and_unload_interval;
// NOTE: If connection and environment are both to be locked,
// environment shall be locked first.
// Map directory
std::string m_mapsavedir;
+ // Configuration path ("" = no configuration file)
+ std::string m_configpath;
+
bool m_shutdown_requested;
/*
*/
u16 m_ignore_map_edit_events_peer_id;
+ Profiler *m_profiler;
+
friend class EmergeThread;
friend class RemoteClient;
};