client side lock and version info
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5135 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+1
-1
@@ -867,7 +867,7 @@ int main(int argc, char **argv)
|
||||
exec("config/sounds.cfg");
|
||||
exec("config/securemaps.cfg");
|
||||
exec("config/admin.cfg");
|
||||
execfile("config/servers.cfg");
|
||||
// execfile("config/servers.cfg"); // do not execute it now
|
||||
persistidents = true;
|
||||
|
||||
static char resdata[] = { 112, 97, 99, 107, 97, 103, 101, 115, 47, 116, 101, 120, 116, 117, 114, 101, 115, 47, 107, 117, 114, 116, 47, 107, 108, 105, 116, 101, 50, 46, 106, 112, 103, 0 };
|
||||
|
||||
@@ -1268,6 +1268,7 @@ void clearservers()
|
||||
|
||||
#define RETRIEVELIMIT 20000
|
||||
extern char *global_name;
|
||||
bool cllock = true, serverscfgread = false;
|
||||
|
||||
void retrieveservers(vector<char> &data)
|
||||
{
|
||||
@@ -1280,7 +1281,7 @@ void retrieveservers(vector<char> &data)
|
||||
|
||||
int starttime = SDL_GetTicks(), timeout = 0;
|
||||
string request;
|
||||
sprintf(request, "list %s\n",global_name);
|
||||
sprintf(request, "list %s %d\n",global_name,AC_VERSION);
|
||||
const char *req = request;
|
||||
int reqlen = strlen(req);
|
||||
ENetBuffer buf;
|
||||
@@ -1335,7 +1336,10 @@ void updatefrommaster(int force)
|
||||
vector<char> data;
|
||||
retrieveservers(data);
|
||||
|
||||
if(data.empty()) conoutf("master server not replying");
|
||||
if(data.empty()) {
|
||||
conoutf("master server not replying");
|
||||
if ( !serverscfgread ) { execfile("config/servers.cfg"); serverscfgread = true;}
|
||||
}
|
||||
else
|
||||
{
|
||||
// preserve currently connected server from deletion
|
||||
@@ -1349,7 +1353,8 @@ void updatefrommaster(int force)
|
||||
}
|
||||
|
||||
clearservers();
|
||||
execute(data.getbuf());
|
||||
if ( !strncmp(data.getbuf(), "addserver", 9) ) cllock = false;
|
||||
if ( !cllock ) execute(data.getbuf());
|
||||
|
||||
if(curserver) addserver(curname, curport, curweight);
|
||||
lastupdate = totalmillis;
|
||||
|
||||
@@ -163,7 +163,7 @@ static inline void updatemasterserver(int millis, int port)
|
||||
if(!lastupdatemaster || millis-lastupdatemaster>60*60*1000)
|
||||
{
|
||||
string servername; filtertext(servername,global_name,-1,20);
|
||||
if(mastername[0]) requestmasterf("regserv %d %s\n", port, servername[0] ? servername : "noname" );
|
||||
if(mastername[0]) requestmasterf("regserv %d %s %d\n", port, servername[0] ? servername : "noname", AC_VERSION);
|
||||
lastupdatemaster = millis ? millis : 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user