]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix quitting minigames
authorMattia Basaglia <mattia.basaglia@gmail.com>
Thu, 12 Feb 2015 18:03:34 +0000 (19:03 +0100)
committerMattia Basaglia <mattia.basaglia@gmail.com>
Thu, 12 Feb 2015 18:06:55 +0000 (19:06 +0100)
qcsrc/common/minigames/cl_minigames.qc
qcsrc/common/minigames/cl_minigames_hud.qc

index 6d250ac702199c05ad9e65bdf9ff87c4a5b81303..64a1aadb6fb5e0d585d11e13b897564310ce0986 100644 (file)
@@ -102,11 +102,11 @@ void HUD_MinigameMenu_CurrentButton();
 bool auto_close_minigamemenu;
 void deactivate_minigame()
 {
-       if ( !active_minigame || active_minigame != self )
+       if ( !active_minigame )
                return;
        active_minigame.minigame_event(active_minigame,"deactivate");
        entity e = world;
-       while( (e = findentity(e, owner, self)) )
+       while( (e = findentity(e, owner, active_minigame)) )
                if ( e.minigame_autoclean )
                {
                        minigame_autoclean_entity(e);
@@ -124,6 +124,12 @@ void deactivate_minigame()
                HUD_MinigameMenu_CurrentButton();
 }
 
+void minigame_entremove()
+{
+       if ( self == active_minigame )
+               deactivate_minigame();
+}
+
 void activate_minigame(entity minigame)
 {
        if ( !minigame )
@@ -143,9 +149,7 @@ void activate_minigame(entity minigame)
        
        if ( active_minigame )
        {
-               entity olds = minigame_self;
                deactivate_minigame();
-               minigame_self = olds;
        }
        
        if ( minigame_self.owner != minigame )
@@ -211,7 +215,7 @@ void ent_read_minigame()
                
                if ( sf & MINIG_SF_CREATE )
                {
-                       self.entremove = deactivate_minigame;
+                       self.entremove = minigame_entremove;
                        self.descriptor = minigame_get_descriptor(ReadString_Raw());
                        if ( !self.descriptor )
                                dprint("Got a minigame without a client-side descriptor!\n");
index c578fb3c1397fe74962c8c099e2d48e03d8a618b..4bf4b1b3e1f5f898e88889f9436efaa2fdcb5d92 100644 (file)
@@ -268,6 +268,7 @@ void HUD_MinigameMenu_ClickNoop()
 // Click action for Quit
 void HUD_MinigameMenu_ClickQuit()
 {
+       deactivate_minigame();
        minigame_cmd("end");
 }