*** 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:
Lee Salzman
2007-06-01 17:29:15 +00:00
parent 66917b7b11
commit eae70d420d
3 changed files with 22 additions and 4 deletions
+18 -2
View File
@@ -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);