Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
maplist.qh File Reference
#include "listbox.qh"
Include dependency graph for maplist.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  XonoticMapList

Functions

entity makeXonoticMapList ()
void MapList_Add_All (entity btn, entity me)
void MapList_Add_Shown (entity btn, entity me)
void MapList_LoadMap (entity btn, entity me)
void MapList_Remove_All (entity btn, entity me)
void MapList_Remove_Shown (entity btn, entity me)
void MapList_StringFilterBox_Change (entity box, entity me)
float MapList_StringFilterBox_keyDown (entity me, float key, float ascii, float shift)

Function Documentation

◆ makeXonoticMapList()

entity makeXonoticMapList ( )

Definition at line 15 of file maplist.qc.

16{
18 me.configureXonoticMapList(me);
19 return me;
20}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define NEW(cname,...)
Definition oo.qh:117

References entity(), and NEW.

Referenced by XonoticServerCreateTab_fill().

◆ MapList_Add_All()

void MapList_Add_All ( entity btn,
entity me )

Definition at line 258 of file maplist.qc.

259{
261 string s = "";
262 for(int i = 0; i < MapInfo_count; ++i)
263 s = cons(s, MapInfo_BSPName_ByID(i));
264 cvar_set("g_maplist", s);
265 me.refilter(me);
266}
string MapInfo_BSPName_ByID(float i)
Definition mapinfo.qc:249
float _MapInfo_FilterGametype(vector pGametype, int pFeatures, int pFlagsRequired, int pFlagsForbidden, bool pAbortOnGenerate)
Definition mapinfo.qc:180
int MapInfo_ForbiddenFlags()
Definition mapinfo.qc:1655
vector MAPINFO_TYPE_ALL
Definition mapinfo.qh:27
float MapInfo_count
Definition mapinfo.qh:166
void cvar_set(string name, string value)
ERASEABLE string cons(string a, string b)
Definition string.qh:276

References _MapInfo_FilterGametype(), cons(), cvar_set(), entity(), MapInfo_BSPName_ByID(), MapInfo_count, MapInfo_ForbiddenFlags(), and MAPINFO_TYPE_ALL.

Referenced by XonoticServerCreateTab_fill().

◆ MapList_Add_Shown()

void MapList_Add_Shown ( entity btn,
entity me )

Definition at line 235 of file maplist.qc.

236{
237 float i, n;
238 n = strlen(me.g_maplistCache);
239 for (i = 0 ; i < n; ++i)
240 {
241 if (!me.g_maplistCacheQuery(me, i))
242 me.g_maplistCacheToggle(me, i);
243 }
244 me.refilter(me);
245}
#define strlen

References entity(), and strlen.

Referenced by XonoticServerCreateTab_fill().

◆ MapList_LoadMap()

void MapList_LoadMap ( entity btn,
entity me )

Definition at line 274 of file maplist.qc.

275{
276 float i;
277 if(btn.parent.instanceOfXonoticMapInfoDialog)
278 {
279 i = btn.parent.currentMapIndex;
280 Dialog_Close(btn, btn.parent);
281 }
282 else
283 i = me.selectedItem;
284
285 if(i >= me.nItems || i < 0)
286 return;
287
288 string m = MapInfo_BSPName_ByID(i);
289 if (!m)
290 {
291 LOG_INFO(_("Huh? Can't play this (m is NULL). Refiltering so this won't happen again."));
292 me.refilter(me);
293 return;
294 }
295 if(MapInfo_CheckMap(m))
296 {
297 localcmd("\nmenu_loadmap_prepare\n");
298 if(cvar("menu_use_default_hostname"))
299 localcmd("hostname \"", sprintf(_("%s's Xonotic Server"), strdecolorize(cvar_string("_cl_name"))), "\"\n");
300 MapInfo_LoadMap(m, 1);
301 }
302 else
303 {
304 LOG_INFO(_("Huh? Can't play this (invalid gametype). Refiltering so this won't happen again."));
305 me.refilter(me);
306 return;
307 }
308}
#define LOG_INFO(...)
Definition log.qh:65
float MapInfo_CheckMap(string s)
Definition mapinfo.qc:1502
void MapInfo_LoadMap(string s, float reinit)
Definition mapinfo.qc:1514
void Dialog_Close(entity button, entity me)
Definition dialog.qc:7
void localcmd(string command,...)
float cvar(string name)
const string cvar_string(string name)

References cvar(), cvar_string(), Dialog_Close(), entity(), localcmd(), LOG_INFO, MapInfo_BSPName_ByID(), MapInfo_CheckMap(), and MapInfo_LoadMap().

Referenced by XonoticMapInfoDialog_fill(), and XonoticServerCreateTab_fill().

◆ MapList_Remove_All()

void MapList_Remove_All ( entity btn,
entity me )

Definition at line 268 of file maplist.qc.

269{
270 cvar_set("g_maplist", "");
271 me.refilter(me);
272}

References cvar_set(), and entity().

Referenced by XonoticServerCreateTab_fill().

◆ MapList_Remove_Shown()

void MapList_Remove_Shown ( entity btn,
entity me )

Definition at line 247 of file maplist.qc.

248{
249 float n = strlen(me.g_maplistCache);
250 for (int i = 0 ; i < n; ++i)
251 {
252 if (me.g_maplistCacheQuery(me, i))
253 me.g_maplistCacheToggle(me, i);
254 }
255 me.refilter(me);
256}

References entity(), and strlen.

Referenced by XonoticServerCreateTab_fill().

◆ MapList_StringFilterBox_Change()

void MapList_StringFilterBox_Change ( entity box,
entity me )

Definition at line 226 of file maplist.qc.

227{
228 strfree(me.stringFilter);
229 if(box.text != "")
230 me.stringFilter = strzone(box.text);
231
232 me.refilter(me);
233}
string strzone(string s)
#define strfree(this)
Definition string.qh:59

References entity(), strfree, and strzone().

Referenced by XonoticMapList_keyDown(), and XonoticServerCreateTab_fill().

◆ MapList_StringFilterBox_keyDown()

float MapList_StringFilterBox_keyDown ( entity me,
float key,
float ascii,
float shift )

Definition at line 385 of file maplist.qc.

386{
387 // in this section, note that onChangeEntity has the ref to mapListBox
388 // we make use of that, instead of extending a class to add one more attrib
389 switch(scan)
390 {
391 case K_KP_ENTER:
392 case K_ENTER:
393 // move the focus to the mapListBox
394 me.onChangeEntity.parent.setFocus(me.onChangeEntity.parent, me.onChangeEntity);
395 return 1;
396 case K_KP_UPARROW:
397 case K_UPARROW:
398 case K_KP_DOWNARROW:
399 case K_DOWNARROW:
400 // pass the event to the mapListBox (to scroll up and down)
401 return me.onChangeEntity.keyDown(me.onChangeEntity, scan, ascii, shift);
402 }
403 return SUPER(XonoticInputBox).keyDown(me, scan, ascii, shift);
404}
float K_UPARROW
Definition keycodes.qc:15
float K_DOWNARROW
Definition keycodes.qc:16
float K_KP_UPARROW
Definition keycodes.qc:64
float K_ENTER
Definition keycodes.qc:8
float K_KP_DOWNARROW
Definition keycodes.qc:53
float K_KP_ENTER
Definition keycodes.qc:74
#define SUPER(cname)
Definition oo.qh:231

References entity(), K_DOWNARROW, K_ENTER, K_KP_DOWNARROW, K_KP_ENTER, K_KP_UPARROW, K_UPARROW, and SUPER.

Referenced by XonoticServerCreateTab_fill().