secure maps
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@995 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+18
-1
@@ -383,6 +383,20 @@ 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)
|
||||
{
|
||||
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)
|
||||
@@ -391,6 +405,7 @@ void sendmap(char *mapname)
|
||||
changemap(mapname);
|
||||
}
|
||||
mapname = getclientmap();
|
||||
if(securemapcheck(mapname)) return;
|
||||
int mapsize;
|
||||
uchar *mapdata = readmap(mapname, &mapsize);
|
||||
if(!mapdata) return;
|
||||
@@ -417,6 +432,7 @@ void sendmap(char *mapname)
|
||||
|
||||
void getmap()
|
||||
{
|
||||
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);
|
||||
@@ -427,4 +443,5 @@ void getmap()
|
||||
|
||||
COMMAND(sendmap, ARG_1STR);
|
||||
COMMAND(getmap, ARG_NONE);
|
||||
|
||||
COMMAND(clearsecuremaps, ARG_NONE);
|
||||
COMMAND(securemap, ARG_1STR);
|
||||
|
||||
+14
-7
@@ -41,6 +41,7 @@ struct docsection
|
||||
{
|
||||
char *name;
|
||||
vector<docident *> idents;
|
||||
void *menu;
|
||||
};
|
||||
|
||||
vector<docsection> sections;
|
||||
@@ -53,8 +54,8 @@ void adddocsection(char *name)
|
||||
if(!name) return;
|
||||
docsection &s = sections.add();
|
||||
s.name = newstring(name);
|
||||
s.menu = addmenu(s.name, NULL, true, renderdocsection);
|
||||
lastsection = &s;
|
||||
addmenu(s.name, NULL, true, renderdocsection);
|
||||
}
|
||||
|
||||
void adddocident(char *name, char *desc)
|
||||
@@ -474,14 +475,20 @@ void renderdocsection(void *menu, bool init)
|
||||
static vector<msection> msections;
|
||||
msections.setsize(0);
|
||||
|
||||
enumerateht(docidents)
|
||||
loopv(sections)
|
||||
{
|
||||
msection &s = msections.add();
|
||||
s.name = docidents.enumc->key;
|
||||
s_sprintf(s.cmd)("saycommand [/%s ]", docidents.enumc->key);
|
||||
if(sections[i].menu != menu) continue;
|
||||
loopvj(sections[i].idents)
|
||||
{
|
||||
docident &id = *sections[i].idents[j];
|
||||
msection &s = msections.add();
|
||||
s.name = id.name;
|
||||
s_sprintf(s.cmd)("saycommand [/%s ]", id.name);
|
||||
}
|
||||
msections.sort(msectionsort);
|
||||
loopv(msections) { menumanual(menu, i, msections[i].name, msections[i].cmd); }
|
||||
return;
|
||||
}
|
||||
msections.sort(msectionsort);
|
||||
loopv(msections) { menumanual(menu, i, msections[i].name, msections[i].cmd); }
|
||||
}
|
||||
|
||||
struct maction { string cmd; };
|
||||
|
||||
+3
-2
@@ -232,7 +232,7 @@ int main(int argc, char **argv)
|
||||
VIRTW = scr_w*VIRTH/scr_h;
|
||||
|
||||
initlog("video: misc");
|
||||
SDL_WM_SetCaption("ActionCube", NULL);
|
||||
SDL_WM_SetCaption("AssaultCube", NULL);
|
||||
#ifndef WIN32
|
||||
if(fs)
|
||||
#endif
|
||||
@@ -244,7 +244,7 @@ int main(int argc, char **argv)
|
||||
gl_init(scr_w, scr_h, bpp, depth, fsaa);
|
||||
|
||||
crosshair = textureload("packages/misc/crosshairs/default.png");
|
||||
if(!crosshair) fatal("could not find core textures (hint: run ActionCube from the parent of the bin directory)");
|
||||
if(!crosshair) fatal("could not find core textures (hint: run AssaultCube from the parent of the bin directory)");
|
||||
|
||||
loadingscreen();
|
||||
|
||||
@@ -268,6 +268,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;
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@ void updatemasterserver(int seconds)
|
||||
if(seconds>updmaster) // send alive signal to masterserver every hour of uptime
|
||||
{
|
||||
s_sprintfd(path)("%sregister.do?action=add", masterpath);
|
||||
s_sprintfd(agent)("ActionCube Server %d", AC_VERSION);
|
||||
httpgetsend(masterserver, masterbase, path, "actioncubeserver", agent);
|
||||
s_sprintfd(agent)("AssaultCube Server %d", AC_VERSION);
|
||||
httpgetsend(masterserver, masterbase, path, "assaultcubeserver", agent);
|
||||
masterrep[0] = 0;
|
||||
masterb.data = masterrep;
|
||||
masterb.dataLength = MAXTRANS-1;
|
||||
@@ -97,8 +97,8 @@ void checkmasterreply()
|
||||
uchar *retrieveservers(uchar *buf, int buflen)
|
||||
{
|
||||
s_sprintfd(path)("%sretrieve.do?item=list", masterpath);
|
||||
s_sprintfd(agent)("ActionCube Client %d", AC_VERSION);
|
||||
httpgetsend(masterserver, masterbase, path, "actioncubeclient", agent);
|
||||
s_sprintfd(agent)("AssaultCube Client %d", AC_VERSION);
|
||||
httpgetsend(masterserver, masterbase, path, "assaultcubeclient", agent);
|
||||
ENetBuffer eb;
|
||||
buf[0] = 0;
|
||||
eb.data = buf;
|
||||
|
||||
Reference in New Issue
Block a user