Menu: Add blacklist for maps in the Create Server menu.
This commit is contained in:
parent
d22056014a
commit
9f30a2b897
|
@ -30,6 +30,9 @@ CScrollbar create_sbMaps;
|
|||
|
||||
int g_mapcount;
|
||||
|
||||
int map_blacklist_count;
|
||||
string *map_blacklist;
|
||||
|
||||
void
|
||||
create_btnok_start(void)
|
||||
{
|
||||
|
@ -82,6 +85,9 @@ create_sbmaps_changed(int val)
|
|||
void
|
||||
menu_creategame_init(void)
|
||||
{
|
||||
int i = 0;
|
||||
int realcount = 0;
|
||||
|
||||
fn_create = spawn(CWidget);
|
||||
create_btnAdv = spawn(CMainButton);
|
||||
create_btnAdv.SetImage(BTN_ADVOPTIONS);
|
||||
|
@ -135,15 +141,54 @@ menu_creategame_init(void)
|
|||
create_sbMaps.SetCallback(create_sbmaps_changed);
|
||||
Widget_Add(fn_createshared, create_sbMaps);
|
||||
|
||||
searchhandle mapsearch = search_begin("maps/*.bsp", TRUE, TRUE);
|
||||
g_mapcount = search_getsize(mapsearch);
|
||||
for (int i = 0; i < g_mapcount; i++) {
|
||||
string tmp;
|
||||
tmp = substring(search_getfilename(mapsearch, i), 5, -1);
|
||||
create_lbMaps.AddEntry(tmp);
|
||||
/* map blacklist code */
|
||||
filestream fs_blacklist;
|
||||
fs_blacklist = fopen("scripts/map_blacklist", FILE_READ);
|
||||
|
||||
if (fs_blacklist < 0) {
|
||||
print("^1WARNING: ^7Could NOT load scripts/map_blacklist");
|
||||
}
|
||||
|
||||
create_sbMaps.SetMax(g_mapcount);
|
||||
if (fs_blacklist >= 0) {
|
||||
string temp;
|
||||
|
||||
while ((temp = fgets(fs_blacklist))) {
|
||||
map_blacklist_count++;
|
||||
}
|
||||
|
||||
map_blacklist = memalloc(sizeof(string) * map_blacklist_count);
|
||||
fseek(fs_blacklist, 0);
|
||||
|
||||
i = 0;
|
||||
while ((temp = fgets(fs_blacklist))) {
|
||||
map_blacklist[i] = temp;
|
||||
i++;
|
||||
}
|
||||
|
||||
fclose(fs_blacklist);
|
||||
}
|
||||
|
||||
searchhandle mapsearch = search_begin("maps/*.bsp", TRUE, TRUE);
|
||||
g_mapcount = search_getsize(mapsearch);
|
||||
for (i = 0; i < g_mapcount; i++) {
|
||||
string tmp;
|
||||
int list = TRUE;
|
||||
tmp = substring(search_getfilename(mapsearch, i), 5, -1);
|
||||
|
||||
/* see if any of our blacklisted names match */
|
||||
for (int b = 0; b < map_blacklist_count; b++) {
|
||||
if (tmp == map_blacklist[b]) {
|
||||
list = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (list == TRUE) {
|
||||
create_lbMaps.AddEntry(tmp);
|
||||
realcount++;
|
||||
}
|
||||
}
|
||||
|
||||
create_sbMaps.SetMax(realcount);
|
||||
search_end(mapsearch);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
c0a0.bsp
|
||||
c0a0a.bsp
|
||||
c0a0b.bsp
|
||||
c0a0c.bsp
|
||||
c0a0d.bsp
|
||||
c0a0e.bsp
|
||||
c1a0.bsp
|
||||
c1a0a.bsp
|
||||
c1a0b.bsp
|
||||
c1a0c.bsp
|
||||
c1a0d.bsp
|
||||
c1a0e.bsp
|
||||
c1a1.bsp
|
||||
c1a1a.bsp
|
||||
c1a1b.bsp
|
||||
c1a1c.bsp
|
||||
c1a1d.bsp
|
||||
c1a1f.bsp
|
||||
c1a2.bsp
|
||||
c1a2a.bsp
|
||||
c1a2b.bsp
|
||||
c1a2c.bsp
|
||||
c1a2d.bsp
|
||||
c1a3.bsp
|
||||
c1a3a.bsp
|
||||
c1a3b.bsp
|
||||
c1a3c.bsp
|
||||
c1a3d.bsp
|
||||
c1a4.bsp
|
||||
c1a4b.bsp
|
||||
c1a4d.bsp
|
||||
c1a4e.bsp
|
||||
c1a4f.bsp
|
||||
c1a4g.bsp
|
||||
c1a4i.bsp
|
||||
c1a4j.bsp
|
||||
c1a4k.bsp
|
||||
c2a1.bsp
|
||||
c2a1a.bsp
|
||||
c2a1b.bsp
|
||||
c2a2.bsp
|
||||
c2a2a.bsp
|
||||
c2a2b1.bsp
|
||||
c2a2b2.bsp
|
||||
c2a2c.bsp
|
||||
c2a2d.bsp
|
||||
c2a2e.bsp
|
||||
c2a2f.bsp
|
||||
c2a2g.bsp
|
||||
c2a2h.bsp
|
||||
c2a3.bsp
|
||||
c2a3a.bsp
|
||||
c2a3b.bsp
|
||||
c2a3c.bsp
|
||||
c2a3d.bsp
|
||||
c2a3e.bsp
|
||||
c2a4.bsp
|
||||
c2a4a.bsp
|
||||
c2a4b.bsp
|
||||
c2a4c.bsp
|
||||
c2a4d.bsp
|
||||
c2a4e.bsp
|
||||
c2a4f.bsp
|
||||
c2a4g.bsp
|
||||
c2a5.bsp
|
||||
c2a5a.bsp
|
||||
c2a5b.bsp
|
||||
c2a5c.bsp
|
||||
c2a5d.bsp
|
||||
c2a5e.bsp
|
||||
c2a5f.bsp
|
||||
c2a5g.bsp
|
||||
c2a5w.bsp
|
||||
c2a5x.bsp
|
||||
c3a1.bsp
|
||||
c3a1a.bsp
|
||||
c3a1b.bsp
|
||||
c3a2.bsp
|
||||
c3a2a.bsp
|
||||
c3a2b.bsp
|
||||
c3a2c.bsp
|
||||
c3a2d.bsp
|
||||
c3a2e.bsp
|
||||
c3a2f.bsp
|
||||
c4a1.bsp
|
||||
c4a1a.bsp
|
||||
c4a1b.bsp
|
||||
c4a1c.bsp
|
||||
c4a1d.bsp
|
||||
c4a1e.bsp
|
||||
c4a1f.bsp
|
||||
c4a2.bsp
|
||||
c4a2a.bsp
|
||||
c4a2b.bsp
|
||||
c4a3.bsp
|
||||
c5a1.bsp
|
||||
t0a0.bsp
|
||||
t0a0a.bsp
|
||||
t0a0b.bsp
|
||||
t0a0b1.bsp
|
||||
t0a0b2.bsp
|
||||
t0a0c.bsp
|
||||
t0a0d.bsp
|
||||
hldemo1.bsp
|
||||
hldemo2.bsp
|
||||
hldemo3.bsp
|
Loading…
Reference in New Issue