From: terencehill <piuntn@gmail.com>
Date: Mon, 25 Jul 2016 17:22:50 +0000 (+0200)
Subject: Properly show / hide Race and CTS from the game type list when toggling developer... 
X-Git-Tag: xonotic-v0.8.2~700^2~30
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9068daf471b52559acd6aa58eeaa928899b9f0fa;p=xonotic%2Fxonotic-data.pk3dir.git

Properly show / hide Race and CTS from the game type list when toggling developer cvar on / off
---

diff --git a/qcsrc/menu/xonotic/gametypelist.qc b/qcsrc/menu/xonotic/gametypelist.qc
index 9ee031dc78..193f833683 100644
--- a/qcsrc/menu/xonotic/gametypelist.qc
+++ b/qcsrc/menu/xonotic/gametypelist.qc
@@ -59,6 +59,15 @@ void XonoticGametypeList_saveCvars(entity me)
 		owner.gameTypeChangeNotify(owner);
 	}
 }
+void XonoticGametypeList_draw(entity me)
+{
+	if(me.nItems != GameType_GetCount())
+	{
+		me.nItems = GameType_GetCount();
+		me.setSelected(me, 0);
+	}
+	SUPER(XonoticGametypeList).draw(me);
+}
 void XonoticGametypeList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
 	string s1, s2;
diff --git a/qcsrc/menu/xonotic/gametypelist.qh b/qcsrc/menu/xonotic/gametypelist.qh
index 95eceaa09b..9e17c5c855 100644
--- a/qcsrc/menu/xonotic/gametypelist.qh
+++ b/qcsrc/menu/xonotic/gametypelist.qh
@@ -4,6 +4,7 @@
 CLASS(XonoticGametypeList, XonoticListBox)
 	METHOD(XonoticGametypeList, configureXonoticGametypeList, void(entity));
 	ATTRIB(XonoticGametypeList, rowsPerItem, float, 2)
+	METHOD(XonoticGametypeList, draw, void(entity));
 	METHOD(XonoticGametypeList, drawListBoxItem, void(entity, int, vector, bool, bool));
 	METHOD(XonoticGametypeList, resizeNotify, void(entity, vector, vector, vector, vector));
 	METHOD(XonoticGametypeList, setSelected, void(entity, float));