]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Restore translator-friendly messages, making sure they are zoned
authorterencehill <piuntn@gmail.com>
Sat, 20 Jul 2019 21:05:22 +0000 (23:05 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 20 Jul 2019 21:05:22 +0000 (23:05 +0200)
qcsrc/common/minigames/minigame/bd.qc
qcsrc/common/minigames/minigame/c4.qc
qcsrc/common/minigames/minigame/nmm.qc
qcsrc/common/minigames/minigame/pong.qc
qcsrc/common/minigames/minigame/pp.qc
qcsrc/common/minigames/minigame/ps.qc
qcsrc/common/minigames/minigame/ttt.qc

index 84e43709c5c3adb9364c903ae08c27b1869a65e9..744dab71af518124cae264d9708fde3f47c189d2 100644 (file)
@@ -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();
                                }
index a35ada8cdffcb90a1bbea8ce09e88277ea068a30..be65e6ac13528bc4446b8b0e1ee8768636387fff 100644 (file)
@@ -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();
                                }
index fbb6f4b727e762c39e563e0eeb22420846cdb845..72b65e75691ede0428b7cf4acffd85ee37c96506 100644 (file)
@@ -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();
                }
index 3f4810078ac243d43f21705efdbc6340df81fb18..407eb4e8fdfeafbaa12680abdc9655bb7862bbcd 100644 (file)
@@ -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;
index 1dc640ce5b25908d1272a0dc5ac919c346cb209b..e8aed878aab9c31ce663bd453747d996e1a191a2 100644 (file)
@@ -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();
index 8bf8cabe75738713164856171a1bc75b98817aa0..4457449e86b467417e9534b724d531241b9f9cb1 100644 (file)
@@ -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();
                                }
index 767c9cd1fe0d90f74f7c2720c63af8148736face..6bac28c930b56f6a470c980a4e91dbf8fee0e892 100644 (file)
@@ -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();
                                }