]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/gametypelist.qc
Don't call gameTypeChangeNotify() without a parent
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / gametypelist.qc
index feb1d89b133d2b4e040db7bd42d2828c500fc89f..0d36c836340f7b463d2c0af41c9197990ec67619 100644 (file)
@@ -31,12 +31,11 @@ entity makeXonoticGametypeList(void)
 }
 void XonoticGametypeList_configureXonoticGametypeList(entity me)
 {
-       float i;
        me.configureXonoticListBox(me);
        me.nItems = GameType_GetCount();
 
        // we want the pics mipmapped
-       for(i = 0; i < GameType_GetCount(); ++i)
+       for(int i = 0; i < GameType_GetCount(); ++i)
                draw_PreloadPictureWithFlags(GameType_GetIcon(i), PRECACHE_PIC_MIPMAP);
 
        me.loadCvars(me);
@@ -67,12 +66,15 @@ void XonoticGametypeList_loadCvars(entity me)
 }
 void XonoticGametypeList_saveCvars(entity me)
 {
-       float t;
-       t = GameType_GetID(me.selectedItem);
-       if(t == MapInfo_CurrentGametype())
+       int t = GameType_GetID(me.selectedItem);
+       if (t == MapInfo_CurrentGametype()) {
                return;
+       }
        MapInfo_SwitchGameType(t);
-       me.parent.gameTypeChangeNotify(me.parent);
+       entity owner = me.parent;
+       if (owner) { // not set immediately
+               owner.gameTypeChangeNotify(owner);
+       }
 }
 void XonoticGametypeList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
 {