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{
17 entity me;
18 me = NEW(XonoticMapList);
19 me.configureXonoticMapList(me);
20 return me;
21}
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 260 of file maplist.qc.

261{
262 float i;
263 string s;
265 s = "";
266 for(i = 0; i < MapInfo_count; ++i)
267 s = cons(s, MapInfo_BSPName_ByID(i));
268 cvar_set("g_maplist", s);
269 me.refilter(me);
270}
string MapInfo_BSPName_ByID(float i)
Definition mapinfo.qc:250
float _MapInfo_FilterGametype(vector pGametype, int pFeatures, int pFlagsRequired, int pFlagsForbidden, bool pAbortOnGenerate)
Definition mapinfo.qc:181
int MapInfo_ForbiddenFlags()
Definition mapinfo.qc:1664
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 236 of file maplist.qc.

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

References entity(), and strlen.

Referenced by XonoticServerCreateTab_fill().

◆ MapList_LoadMap()

void MapList_LoadMap ( entity btn,
entity me )

Definition at line 278 of file maplist.qc.

279{
280 string m;
281 float i;
282
283 i = me.selectedItem;
284
285 if(btn.parent.instanceOfXonoticMapInfoDialog)
286 {
287 i = btn.parent.currentMapIndex;
288 Dialog_Close(btn, btn.parent);
289 }
290
291 if(i >= me.nItems || i < 0)
292 return;
293
295 if (!m)
296 {
297 LOG_INFO(_("Huh? Can't play this (m is NULL). Refiltering so this won't happen again."));
298 me.refilter(me);
299 return;
300 }
301 if(MapInfo_CheckMap(m))
302 {
303 localcmd("\nmenu_loadmap_prepare\n");
304 if(cvar("menu_use_default_hostname"))
305 localcmd("hostname \"", sprintf(_("%s's Xonotic Server"), strdecolorize(cvar_string("_cl_name"))), "\"\n");
306 MapInfo_LoadMap(m, 1);
307 }
308 else
309 {
310 LOG_INFO(_("Huh? Can't play this (invalid gametype). Refiltering so this won't happen again."));
311 me.refilter(me);
312 return;
313 }
314}
#define LOG_INFO(...)
Definition log.qh:65
float MapInfo_CheckMap(string s)
Definition mapinfo.qc:1510
void MapInfo_LoadMap(string s, float reinit)
Definition mapinfo.qc:1523
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 272 of file maplist.qc.

273{
274 cvar_set("g_maplist", "");
275 me.refilter(me);
276}

References cvar_set(), and entity().

Referenced by XonoticServerCreateTab_fill().

◆ MapList_Remove_Shown()

void MapList_Remove_Shown ( entity btn,
entity me )

Definition at line 248 of file maplist.qc.

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

References entity(), and strlen.

Referenced by XonoticServerCreateTab_fill().

◆ MapList_StringFilterBox_Change()

void MapList_StringFilterBox_Change ( entity box,
entity me )

Definition at line 227 of file maplist.qc.

228{
229 strfree(me.stringFilter);
230 if(box.text != "")
231 me.stringFilter = strzone(box.text);
232
233 me.refilter(me);
234}
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 391 of file maplist.qc.

392{
393 // in this section, note that onChangeEntity has the ref to mapListBox
394 // we make use of that, instead of extending a class to add one more attrib
395 switch(scan)
396 {
397 case K_KP_ENTER:
398 case K_ENTER:
399 // move the focus to the mapListBox
400 me.onChangeEntity.parent.setFocus(me.onChangeEntity.parent, me.onChangeEntity);
401 return 1;
402 case K_KP_UPARROW:
403 case K_UPARROW:
404 case K_KP_DOWNARROW:
405 case K_DOWNARROW:
406 // pass the event to the mapListBox (to scroll up and down)
407 return me.onChangeEntity.keyDown(me.onChangeEntity, scan, ascii, shift);
408 }
409 return SUPER(XonoticInputBox).keyDown(me, scan, ascii, shift);
410}
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().