*** empty log message ***
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1063 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+18
-2
@@ -397,6 +397,22 @@ void gets2c() // get updates from the server
|
||||
|
||||
// sendmap/getmap commands, should be replaced by more intuitive map downloading
|
||||
|
||||
cvector securemaps;
|
||||
|
||||
void clearsecuremaps() { securemaps.deletecontentsa(); }
|
||||
void securemap(char *map) { if(map) securemaps.add(newstring(map)); }
|
||||
bool securemapcheck(char *map)
|
||||
{
|
||||
if(strstr(map, "maps/")==map || strstr(map, "maps\\")==map) map += strlen("maps/");
|
||||
loopv(securemaps) if(!strcmp(securemaps[i], map))
|
||||
{
|
||||
conoutf("\f3map %s is secured, you can not send or overwrite it", map);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void sendmap(char *mapname)
|
||||
{
|
||||
if(*mapname)
|
||||
@@ -405,7 +421,7 @@ void sendmap(char *mapname)
|
||||
changemap(mapname);
|
||||
}
|
||||
mapname = getclientmap();
|
||||
if(mapinfo.access(mapname)) return;
|
||||
if(securemapcheck(mapname)) return;
|
||||
int mapsize;
|
||||
uchar *mapdata = readmap(mapname, &mapsize);
|
||||
if(!mapdata) return;
|
||||
@@ -432,7 +448,7 @@ void sendmap(char *mapname)
|
||||
|
||||
void getmap()
|
||||
{
|
||||
if(mapinfo.access(getclientmap())) return;
|
||||
if(securemapcheck(getclientmap())) return;
|
||||
ENetPacket *packet = enet_packet_create(NULL, MAXTRANS, ENET_PACKET_FLAG_RELIABLE);
|
||||
ucharbuf p(packet->data, packet->dataLength);
|
||||
putint(p, SV_RECVMAP);
|
||||
|
||||
@@ -284,6 +284,7 @@ int main(int argc, char **argv)
|
||||
exec("config/menus.cfg");
|
||||
exec("config/prefabs.cfg");
|
||||
exec("config/sounds.cfg");
|
||||
exec("config/securemaps.cfg");
|
||||
execfile("config/servers.cfg");
|
||||
persistidents = true;
|
||||
|
||||
|
||||
@@ -127,12 +127,13 @@ uchar *readmap(char *mname, int *msize)
|
||||
|
||||
void save_world(char *mname)
|
||||
{
|
||||
extern bool securemapcheck(char *map);
|
||||
if(securemapcheck(mname)) return;
|
||||
voptimize();
|
||||
toptimize();
|
||||
if(!*mname) mname = getclientmap();
|
||||
setnames(mname);
|
||||
if(mapinfo.access(mname)) cgzname[strlen(cgzname)-1] = 'o';
|
||||
else backup(cgzname, bakname);
|
||||
backup(cgzname, bakname);
|
||||
gzFile f = gzopen(cgzname, "wb9");
|
||||
if(!f) { conoutf("could not write map to %s", cgzname); return; }
|
||||
hdr.version = MAPVERSION;
|
||||
|
||||
Reference in New Issue
Block a user