From: terencehill Date: Sat, 20 Jul 2019 21:05:22 +0000 (+0200) Subject: Restore translator-friendly messages, making sure they are zoned X-Git-Tag: xonotic-v0.8.5~1454 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=021728329f7609ccd73e24dfda4bd8ef36a482ae;p=xonotic%2Fxonotic-data.pk3dir.git Restore translator-friendly messages, making sure they are zoned --- diff --git a/qcsrc/common/minigames/minigame/bd.qc b/qcsrc/common/minigames/minigame/bd.qc index 84e43709c..744dab71a 100644 --- a/qcsrc/common/minigames/minigame/bd.qc +++ b/qcsrc/common/minigames/minigame/bd.qc @@ -1311,11 +1311,16 @@ int bd_client_event(entity minigame, string event, ...) { case "activate": { - minigame.message = bd_turn_to_string(minigame.minigame_flags); + strcpy(minigame.message, bd_turn_to_string(minigame.minigame_flags)); bd_set_curr_pos(""); bd_curr_tile = BD_TILE_BRICK1; return false; } + case "deactivate": + { + strfree(minigame.message); + return false; + } case "key_pressed": { if(minigame.minigame_flags & BD_TURN_MOVE) @@ -1370,7 +1375,7 @@ int bd_client_event(entity minigame, string event, ...) { if ( sf & MINIG_SF_UPDATE ) { - sent.message = bd_turn_to_string(sent.minigame_flags); + strcpy(sent.message, bd_turn_to_string(sent.minigame_flags)); //if ( sent.minigame_flags & minigame_self.team ) //minigame_prompt(); } diff --git a/qcsrc/common/minigames/minigame/c4.qc b/qcsrc/common/minigames/minigame/c4.qc index a35ada8cd..be65e6ac1 100644 --- a/qcsrc/common/minigames/minigame/c4.qc +++ b/qcsrc/common/minigames/minigame/c4.qc @@ -413,7 +413,12 @@ int c4_client_event(entity minigame, string event, ...) case "activate": { c4_set_curr_pos(""); - minigame.message = c4_turn_to_string(minigame.minigame_flags); + strcpy(minigame.message, c4_turn_to_string(minigame.minigame_flags)); + return false; + } + case "deactivate": + { + strfree(minigame.message); return false; } case "key_pressed": @@ -490,7 +495,7 @@ int c4_client_event(entity minigame, string event, ...) { if ( sf & MINIG_SF_UPDATE ) { - sent.message = c4_turn_to_string(sent.minigame_flags); + strcpy(sent.message, c4_turn_to_string(sent.minigame_flags)); if ( sent.minigame_flags & minigame_self.team ) minigame_prompt(); } diff --git a/qcsrc/common/minigames/minigame/nmm.qc b/qcsrc/common/minigames/minigame/nmm.qc index fbb6f4b72..72b65e756 100644 --- a/qcsrc/common/minigames/minigame/nmm.qc +++ b/qcsrc/common/minigames/minigame/nmm.qc @@ -628,12 +628,13 @@ int nmm_client_event(entity minigame, string event, ...) { nmm_fromtile = NULL; nmm_init_tiles(minigame); - minigame.message = nmm_turn_to_string(minigame.minigame_flags); + strcpy(minigame.message, nmm_turn_to_string(minigame.minigame_flags)); } else if ( event == "deactivate" ) { nmm_fromtile = NULL; nmm_kill_tiles(minigame); + strfree(minigame.message); } else if ( event == "key_pressed" && (minigame.minigame_flags&NMM_TURN_TEAM) == minigame_self.team ) { @@ -755,7 +756,7 @@ int nmm_client_event(entity minigame, string event, ...) } else if ( sent.classname == "minigame" && ( ...(1,int) & MINIG_SF_UPDATE ) ) { - sent.message = nmm_turn_to_string(sent.minigame_flags); + strcpy(sent.message, nmm_turn_to_string(sent.minigame_flags)); if ( sent.minigame_flags & minigame_self.team ) minigame_prompt(); } diff --git a/qcsrc/common/minigames/minigame/pong.qc b/qcsrc/common/minigames/minigame/pong.qc index 3f4810078..407eb4e8f 100644 --- a/qcsrc/common/minigames/minigame/pong.qc +++ b/qcsrc/common/minigames/minigame/pong.qc @@ -614,6 +614,11 @@ int pong_client_event(entity minigame, string event, ...) { case "activate": return false; + case "deactivate": + { + strfree(minigame.message); + return false; + } case "key_pressed": switch ( ...(0,int) ) { @@ -664,7 +669,7 @@ int pong_client_event(entity minigame, string event, ...) { if ( sf & MINIG_SF_UPDATE ) { - sent.message = pong_message(sent.minigame_flags); + strcpy(sent.message, pong_message(sent.minigame_flags)); } } return false; diff --git a/qcsrc/common/minigames/minigame/pp.qc b/qcsrc/common/minigames/minigame/pp.qc index 1dc640ce5..e8aed878a 100644 --- a/qcsrc/common/minigames/minigame/pp.qc +++ b/qcsrc/common/minigames/minigame/pp.qc @@ -439,11 +439,10 @@ string pp_turn_to_string(int turnflags) if ( turnflags & PP_TURN_WIN ) { + // translator-friendly messages composed of 2 existing messages if ( (turnflags&PP_TURN_TEAM) != minigame_self.team ) - //return _("You lost the game!\nSelect \"^1Next Match^7\" on the menu for a rematch!"); - return _("You lost the game!"); - //return _("You win!\nSelect \"^1Next Match^7\" on the menu to start a new match!"); - return _("You win!"); + return strcat(_("You lost the game!"), "\n", _("Select \"^1Next Match^7\" on the menu for a rematch!")); + return strcat(_("You win!"), "\n", _("Select \"^1Next Match^7\" on the menu to start a new match!")); } if ( turnflags & PP_TURN_NEXT ) @@ -487,7 +486,12 @@ int pp_client_event(entity minigame, string event, ...) case "activate": { pp_set_curr_pos(""); - minigame.message = pp_turn_to_string(minigame.minigame_flags); + strcpy(minigame.message, pp_turn_to_string(minigame.minigame_flags)); + return false; + } + case "deactivate": + { + strfree(minigame.message); return false; } case "key_pressed": @@ -562,7 +566,7 @@ int pp_client_event(entity minigame, string event, ...) { if ( sf & MINIG_SF_UPDATE ) { - sent.message = pp_turn_to_string(sent.minigame_flags); + strcpy(sent.message, pp_turn_to_string(sent.minigame_flags)); if ( sent.minigame_flags & minigame_self.team ) minigame_prompt(); sent.pp_team1_score = ReadByte(); diff --git a/qcsrc/common/minigames/minigame/ps.qc b/qcsrc/common/minigames/minigame/ps.qc index 8bf8cabe7..4457449e8 100644 --- a/qcsrc/common/minigames/minigame/ps.qc +++ b/qcsrc/common/minigames/minigame/ps.qc @@ -532,7 +532,12 @@ int ps_client_event(entity minigame, string event, ...) { ps_set_curr_pos(""); ps_curr_piece = NULL; - minigame.message = ps_turn_to_string(minigame.minigame_flags); + strcpy(minigame.message, ps_turn_to_string(minigame.minigame_flags)); + return false; + } + case "deactivate": + { + strfree(minigame.message); return false; } case "key_pressed": @@ -609,7 +614,7 @@ int ps_client_event(entity minigame, string event, ...) { if ( sf & MINIG_SF_UPDATE ) { - sent.message = ps_turn_to_string(sent.minigame_flags); + strcpy(sent.message, ps_turn_to_string(sent.minigame_flags)); //if ( sent.minigame_flags & minigame_self.team ) //minigame_prompt(); } diff --git a/qcsrc/common/minigames/minigame/ttt.qc b/qcsrc/common/minigames/minigame/ttt.qc index 767c9cd1f..6bac28c93 100644 --- a/qcsrc/common/minigames/minigame/ttt.qc +++ b/qcsrc/common/minigames/minigame/ttt.qc @@ -320,11 +320,11 @@ string ttt_turn_to_string(int turnflags) if ( turnflags & TTT_TURN_WIN ) { + // translator-friendly messages composed of 2 existing messages + // TODO: proper "you win" banner instead of hijacking the help message if ( (turnflags&TTT_TURN_TEAM) != minigame_self.team ) - //return _("You lost the game!\nSelect \"^1Next Match^7\" on the menu for a rematch!"); // TODO: proper "you win" banner instead of hijacking the help message - return _("You lost the game!"); // TODO: proper "you win" banner instead of hijacking the help message - //return _("You win!\nSelect \"^1Next Match^7\" on the menu to start a new match!"); - return _("You win!"); + strcat(_("You lost the game!"), "\n", _("Select \"^1Next Match^7\" on the menu for a rematch!")); + return strcat(_("You win!"), "\n", _("Select \"^1Next Match^7\" on the menu to start a new match!")); } if ( turnflags & TTT_TURN_NEXT ) @@ -522,7 +522,7 @@ void ttt_aimove(entity minigame) else ttt_move(minigame,aiplayer,pos); } - minigame.message = ttt_turn_to_string(minigame.minigame_flags); + strcpy(minigame.message, ttt_turn_to_string(minigame.minigame_flags)); } // Make the correct move @@ -556,7 +556,12 @@ int ttt_client_event(entity minigame, string event, ...) case "activate": { ttt_set_curr_pos(""); - minigame.message = ttt_turn_to_string(minigame.minigame_flags); + strcpy(minigame.message, ttt_turn_to_string(minigame.minigame_flags)); + return false; + } + case "deactivate": + { + strfree(minigame.message); return false; } case "key_pressed": @@ -631,7 +636,7 @@ int ttt_client_event(entity minigame, string event, ...) { if ( sf & MINIG_SF_UPDATE ) { - sent.message = ttt_turn_to_string(sent.minigame_flags); + strcpy(sent.message, ttt_turn_to_string(sent.minigame_flags)); if ( sent.minigame_flags & minigame_self.team ) minigame_prompt(); }