From: Mattia Basaglia Date: Thu, 12 Feb 2015 18:03:34 +0000 (+0100) Subject: Fix quitting minigames X-Git-Tag: xonotic-v0.8.2~2038^2~21 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e50df489b3950ab7d3debd73decdd52c4a074e96;p=xonotic%2Fxonotic-data.pk3dir.git Fix quitting minigames --- diff --git a/qcsrc/common/minigames/cl_minigames.qc b/qcsrc/common/minigames/cl_minigames.qc index 6d250ac70..64a1aadb6 100644 --- a/qcsrc/common/minigames/cl_minigames.qc +++ b/qcsrc/common/minigames/cl_minigames.qc @@ -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"); diff --git a/qcsrc/common/minigames/cl_minigames_hud.qc b/qcsrc/common/minigames/cl_minigames_hud.qc index c578fb3c1..4bf4b1b3e 100644 --- a/qcsrc/common/minigames/cl_minigames_hud.qc +++ b/qcsrc/common/minigames/cl_minigames_hud.qc @@ -268,6 +268,7 @@ void HUD_MinigameMenu_ClickNoop() // Click action for Quit void HUD_MinigameMenu_ClickQuit() { + deactivate_minigame(); minigame_cmd("end"); }