Xonotic
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.

References entity(), and NEW.

16 {
17  entity me;
18  me = NEW(XonoticMapList);
19  me.configureXonoticMapList(me);
20  return me;
21 }
#define NEW(cname,...)
Definition: oo.qh:105
entity() spawn
+ Here is the call graph for this function:

◆ MapList_Add_All()

void MapList_Add_All ( entity  btn,
entity  me 
)

Definition at line 251 of file maplist.qc.

References _MapInfo_FilterGametype(), cvar_set(), MapInfo_BSPName_ByID(), MapInfo_count, MapInfo_ForbiddenFlags(), MAPINFO_TYPE_ALL, strcat(), strlen(), and substring().

252 {
253  float i;
254  string s;
256  s = "";
257  for(i = 0; i < MapInfo_count; ++i)
258  s = strcat(s, " ", MapInfo_BSPName_ByID(i));
259  cvar_set("g_maplist", substring(s, 1, strlen(s) - 1));
260  me.refilter(me);
261 }
int MAPINFO_TYPE_ALL
Definition: mapinfo.qh:26
int MapInfo_ForbiddenFlags()
Definition: mapinfo.qc:1324
float MapInfo_count
Definition: mapinfo.qh:144
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
float _MapInfo_FilterGametype(int pGametype, int pFeatures, int pFlagsRequired, int pFlagsForbidden, bool pAbortOnGenerate)
Definition: mapinfo.qc:162
string MapInfo_BSPName_ByID(float i)
Definition: mapinfo.qc:231
+ Here is the call graph for this function:

◆ MapList_Add_Shown()

void MapList_Add_Shown ( entity  btn,
entity  me 
)

Definition at line 227 of file maplist.qc.

References strlen().

228 {
229  float i, n;
230  n = strlen(me.g_maplistCache);
231  for (i = 0 ; i < n; i++)
232  {
233  if (!me.g_maplistCacheQuery(me, i))
234  me.g_maplistCacheToggle(me, i);
235  }
236  me.refilter(me);
237 }
+ Here is the call graph for this function:

◆ MapList_LoadMap()

void MapList_LoadMap ( entity  btn,
entity  me 
)

Definition at line 269 of file maplist.qc.

References Dialog_Close(), LOG_INFO, and MapInfo_BSPName_ByID().

270 {
271  string m;
272  float i;
273 
274  i = me.selectedItem;
275 
276  if(btn.parent.instanceOfXonoticMapInfoDialog)
277  {
278  i = btn.parent.currentMapIndex;
279  Dialog_Close(btn, btn.parent);
280  }
281 
282  if(i >= me.nItems || i < 0)
283  return;
284 
285  m = MapInfo_BSPName_ByID(i);
286  if (!m)
287  {
288  LOG_INFO(_("Huh? Can't play this (m is NULL). Refiltering so this won't happen again."));
289  me.refilter(me);
290  return;
291  }
292  if(MapInfo_CheckMap(m))
293  {
294  localcmd("\nmenu_loadmap_prepare\n");
295  if(cvar("menu_use_default_hostname"))
296  localcmd("hostname \"", sprintf(_("%s's Xonotic Server"), strdecolorize(cvar_string("_cl_name"))), "\"\n");
297  MapInfo_LoadMap(m, 1);
298  }
299  else
300  {
301  LOG_INFO(_("Huh? Can't play this (invalid game type). Refiltering so this won't happen again."));
302  me.refilter(me);
303  return;
304  }
305 }
#define LOG_INFO(...)
Definition: log.qh:70
float MapInfo_CheckMap(string s)
Definition: mapinfo.qc:1170
void MapInfo_LoadMap(string s, float reinit)
Definition: mapinfo.qc:1183
string MapInfo_BSPName_ByID(float i)
Definition: mapinfo.qc:231
+ Here is the call graph for this function:

◆ MapList_Remove_All()

void MapList_Remove_All ( entity  btn,
entity  me 
)

Definition at line 263 of file maplist.qc.

References cvar_set().

264 {
265  cvar_set("g_maplist", "");
266  me.refilter(me);
267 }
+ Here is the call graph for this function:

◆ MapList_Remove_Shown()

void MapList_Remove_Shown ( entity  btn,
entity  me 
)

Definition at line 239 of file maplist.qc.

References strlen().

240 {
241  float i, n;
242  n = strlen(me.g_maplistCache);
243  for (i = 0 ; i < n; i++)
244  {
245  if (me.g_maplistCacheQuery(me, i))
246  me.g_maplistCacheToggle(me, i);
247  }
248  me.refilter(me);
249 }
+ Here is the call graph for this function:

◆ MapList_StringFilterBox_Change()

void MapList_StringFilterBox_Change ( entity  box,
entity  me 
)

Definition at line 218 of file maplist.qc.

References strfree, and strzone().

Referenced by XonoticMapList_keyDown().

219 {
220  strfree(me.stringFilter);
221  if(box.text != "")
222  me.stringFilter = strzone(box.text);
223 
224  me.refilter(me);
225 }
#define strfree(this)
Definition: string.qh:56
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MapList_StringFilterBox_keyDown()

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

Definition at line 382 of file maplist.qc.

References K_DOWNARROW, K_ENTER, K_KP_DOWNARROW, K_KP_ENTER, K_KP_UPARROW, K_UPARROW, and SUPER.

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