fix map revisions vs demo playback

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4363 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
ac_stef
2009-04-27 23:02:47 +00:00
parent da752217c5
commit c20ee120bd
2 changed files with 28 additions and 17 deletions
+22 -15
View File
@@ -33,26 +33,33 @@ void changemapserv(char *name, int mode, int download, int revision) // f
bool loaded = load_world(name);
if(download > 0)
{
if(securemapcheck(name, false)) return;
bool revmatch = hdr.maprevision == revision || revision == 0;
bool sizematch = maploaded == download || download < 10;
if(loaded && sizematch && revmatch) return;
bool getnewrev = autogetnewmaprevisions && revision > hdr.maprevision;
if(autogetmap || getnewrev)
if(watchingdemo)
{
if(!loaded || getnewrev) getmap(); // no need to ask
else
{
s_sprintfd(msg)("map '%s' revision: local %d, provided by server %d", name, hdr.maprevision, revision);
alias("__getmaprevisions", msg);
showmenu("getmap");
}
if(!revmatch) conoutf("\f3demo was played on map revision %d, you have map revision %d", revision, hdr.maprevision);
}
else
{
if(!loaded || download < 10) conoutf("\"getmap\" to download the current map from the server");
else conoutf("\"getmap\" to download a %s version of the current map from the server",
revision == 0 ? "different" : (revision > hdr.maprevision ? "newer" : "older"));
if(securemapcheck(name, false)) return;
bool sizematch = maploaded == download || download < 10;
if(loaded && sizematch && revmatch) return;
bool getnewrev = autogetnewmaprevisions && revision > hdr.maprevision;
if(autogetmap || getnewrev)
{
if(!loaded || getnewrev) getmap(); // no need to ask
else
{
s_sprintfd(msg)("map '%s' revision: local %d, provided by server %d", name, hdr.maprevision, revision);
alias("__getmaprevisions", msg);
showmenu("getmap");
}
}
else
{
if(!loaded || download < 10) conoutf("\"getmap\" to download the current map from the server");
else conoutf("\"getmap\" to download a %s version of the current map from the server",
revision == 0 ? "different" : (revision > hdr.maprevision ? "newer" : "older"));
}
}
}
}
+6 -2
View File
@@ -2210,7 +2210,7 @@ void resetmap(const char *newname, int newmode, int newtime, bool notify)
}
copyrevision = copymapsize == smapstats.cgzsize ? smapstats.hdr.maprevision : 0;
}
else sendservmsg("\f3server error: map not found - please start another map");
else if(isdedicated) sendservmsg("\f3server error: map not found - please start another map");
if(notify)
{
// change map
@@ -3064,7 +3064,11 @@ void process(ENetPacket *packet, int sender, int chan) // sender may be -1
int gzs = getint(p);
int rev = getint(p);
if(!isdedicated || (smapstats.cgzsize == gzs && copyrevision == rev)) cl->isonrightmap = true;
else forcedeath(cl);
else
{
forcedeath(cl);
logger->writeline(log::info, "[%s] %s is on the wrong map: revision %d/%d", cl->hostname, cl->name, rev, gzs);
}
QUEUE_MSG;
break;
}