pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src action_button.cxx,1.28,1.29 credits.c


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src action_button.cxx,1.28,1.29 credits.cxx,1.28,1.29 pingu_action.cxx,1.23,1.24 pingu_action.hxx,1.25,1.26 pingu_enums.cxx,1.5,1.6 pingu_enums.hxx,1.11,1.12 server_event.cxx,1.6,1.7
Date: 18 Apr 2003 17:08:58 -0000

Update of /var/lib/cvs/Games/Pingus/src
In directory dark:/tmp/cvs-serv23734

Modified Files:
        action_button.cxx credits.cxx pingu_action.cxx 
        pingu_action.hxx pingu_enums.cxx pingu_enums.hxx 
        server_event.cxx 
Log Message:
cleaned up the action_to_string stuff

Index: action_button.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/action_button.cxx,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- action_button.cxx   18 Apr 2003 09:22:28 -0000      1.28
+++ action_button.cxx   18 Apr 2003 17:08:56 -0000      1.29
@@ -49,7 +49,7 @@
   font   = PingusResource::load_font("Fonts/pingus_small", "fonts");
   font_b = PingusResource::load_font("Fonts/pingus",       "fonts");
 
-  sprite = Sprite("Pingus/" + action_to_string(name, TRANSLATED) + 
to_string(owner_id), "pingus", 25.0f);
+  sprite = Sprite("Pingus/" + action_to_string(name) + to_string(owner_id), 
"pingus", 25.0f);
   sprite.set_align_center_bottom();
 
   // FIXME: Big fat hack
@@ -146,7 +146,7 @@
       && CL_Mouse::get_x() > x_pos      && CL_Mouse::get_x() < x_pos + 60
       && CL_Mouse::get_y() < y_pos + 35 && CL_Mouse::get_y() > y_pos) 
     {
-      font_b->print_left(x_pos + 65, y_pos, action_to_string(name, 
TRANSLATED).c_str());
+      font_b->print_left(x_pos + 65, y_pos, action_to_screenname(name));
     }
 
   if (Cheat::unlimited_actions)

Index: credits.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/credits.cxx,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- credits.cxx 18 Apr 2003 08:41:57 -0000      1.28
+++ credits.cxx 18 Apr 2003 17:08:56 -0000      1.29
@@ -109,6 +109,7 @@
   credits.push_back("_David Fauthoux");
   credits.push_back("_David Flores");
   credits.push_back("_David M. Turner");
+  credits.push_back("_Debian");
   credits.push_back("_Felix Natter");
   credits.push_back("_Giray Devlet ");
   credits.push_back("_Giuseppe D'Aqui");
@@ -130,6 +131,7 @@
   credits.push_back("_Robin Hogan");
   credits.push_back("_Shigeru Miyamoto");
   credits.push_back("_Stefan Ruhnke");
+  credits.push_back("_SuSE");
   credits.push_back("_Till Hellweg");
   credits.push_back("_Tuomas (Tigert) Kuosmanen");
   credits.push_back("_Werner Steiner");

Index: pingu_action.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/pingu_action.cxx,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- pingu_action.cxx    12 Feb 2003 22:40:47 -0000      1.23
+++ pingu_action.cxx    18 Apr 2003 17:08:56 -0000      1.24
@@ -97,6 +97,12 @@
   return collision;
 }
 
+std::string
+PinguAction::get_name () const
+{
+  return action_to_screenname(get_type());
+}
+
 void
 PinguAction::move_with_forces ()
 {

Index: pingu_action.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/pingu_action.hxx,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- pingu_action.hxx    12 Feb 2003 22:40:47 -0000      1.25
+++ pingu_action.hxx    18 Apr 2003 17:08:56 -0000      1.26
@@ -74,7 +74,7 @@
 
   /** The name of the action, this is used in the CaputreRectangle, so
       it can contain more than just the name */
-  virtual std::string get_name () const =0;
+  virtual std::string get_name () const;
   
   /// The type of the action
   virtual Actions::ActionName get_type () const =0;

Index: pingu_enums.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/pingu_enums.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pingu_enums.cxx     18 Apr 2003 09:22:28 -0000      1.5
+++ pingu_enums.cxx     18 Apr 2003 17:08:56 -0000      1.6
@@ -27,65 +27,96 @@
 
 namespace Actions {
 
-  std::string action_to_string (ActionName action, NameType choice) {
-
-    switch (action) {
-
-      case Angel          : return (choice == ENGLISH) ? "angel"          : 
_("Angel");
-      case Basher         : return (choice == ENGLISH) ? "basher"         : 
_("Basher");
-      case Blocker        : return (choice == ENGLISH) ? "blocker"        : 
_("Blocker");
-      case Boarder        : return (choice == ENGLISH) ? "boarder"        : 
_("Boarder");
-      case Bomber         : return (choice == ENGLISH) ? "bomber"         : 
_("Bomber");
-      case Bridger        : return (choice == ENGLISH) ? "bridger"        : 
_("Bridger");
-      case Climber        : return (choice == ENGLISH) ? "climber"        : 
_("Climber");
-      case Digger         : return (choice == ENGLISH) ? "digger"         : 
_("Digger");
-      case Drown          : return (choice == ENGLISH) ? "drown"          : 
_("Drown");
-      case Exiter         : return (choice == ENGLISH) ? "exiter"         : 
_("Exiter");
-      case Faller         : return (choice == ENGLISH) ? "faller"         : 
_("Faller");
-      case Floater        : return (choice == ENGLISH) ? "floater"        : 
_("Floater");
-      case Jumper         : return (choice == ENGLISH) ? "jumper"         : 
_("Jumper");
-      case Laserkill      : return (choice == ENGLISH) ? "laserkill"      : 
_("Laserkill");
-      case Miner          : return (choice == ENGLISH) ? "miner"          : 
_("Miner");
-      case Rocketlauncher : return (choice == ENGLISH) ? "rocketlauncher" : 
_("Rocketlauncher");
-      case Slider         : return (choice == ENGLISH) ? "slider"         : 
_("Slider");
-      case Smashed        : return (choice == ENGLISH) ? "smashed"        : 
_("Smashed");
-      case Splashed       : return (choice == ENGLISH) ? "splashed"       : 
_("Splashed");
-      case Superman       : return (choice == ENGLISH) ? "superman"       : 
_("Superman");
-      case Teleported     : return (choice == ENGLISH) ? "teleported"     : 
_("Teleported");
-      case Waiter         : return (choice == ENGLISH) ? "waiter"         : 
_("Waiter");
-      case Walker         : return (choice == ENGLISH) ? "walker"         : 
_("Walker");
-      default             : return "Unknown ActionName";
-   }
-  }
+std::string action_to_screenname (ActionName action)
+{
+  switch (action) 
+    {
+    case Angel          : return _("Angel");
+    case Basher         : return _("Basher");
+    case Blocker        : return _("Blocker");
+    case Boarder        : return _("Boarder");
+    case Bomber         : return _("Bomber");
+    case Bridger        : return _("Bridger");
+    case Climber        : return _("Climber");
+    case Digger         : return _("Digger");
+    case Drown          : return _("Drown");
+    case Exiter         : return _("Exiter");
+    case Faller         : return _("Faller");
+    case Floater        : return _("Floater");
+    case Jumper         : return _("Jumper");
+    case Laserkill      : return _("Laserkill");
+    case Miner          : return _("Miner");
+    case Rocketlauncher : return _("Rocketlauncher");
+    case Slider         : return _("Slider");
+    case Smashed        : return _("Smashed");
+    case Splashed       : return _("Splashed");
+    case Superman       : return _("Superman");
+    case Teleported     : return _("Teleported");
+    case Waiter         : return _("Waiter");
+    case Walker         : return _("Walker");
+    default             : return "Unknown ActionName";
+    }
+}
 
-  ActionName action_from_string(const std::string& action) {
+std::string action_to_string (ActionName action)
+{
+  switch (action) 
+    {
+    case Angel          : return "angel";
+    case Basher         : return "basher";
+    case Blocker        : return "blocker";
+    case Boarder        : return "boarder";
+    case Bomber         : return "bomber";
+    case Bridger        : return "bridger";
+    case Climber        : return "climber";
+    case Digger         : return "digger";
+    case Drown          : return "drown";
+    case Exiter         : return "exiter";
+    case Faller         : return "faller";
+    case Floater        : return "floater";
+    case Jumper         : return "jumper";
+    case Laserkill      : return "laserkill";
+    case Miner          : return "miner";
+    case Rocketlauncher : return "rocketlauncher";
+    case Slider         : return "slider";
+    case Smashed        : return "smashed";
+    case Splashed       : return "splashed";
+    case Superman       : return "superman";
+    case Teleported     : return "teleported";
+    case Waiter         : return "waiter";
+    case Walker         : return "walker";
+    default             : return "Unknown ActionName";
+    }
+}
 
-    if (action == "angel")          return Angel;
-    if (action == "basher")         return Basher;
-    if (action == "blocker")        return Blocker;
-    if (action == "boarder")        return Boarder;
-    if (action == "bomber")         return Bomber;
-    if (action == "bridger")        return Bridger;
-    if (action == "climber")        return Climber;
-    if (action == "digger")         return Digger;
-    if (action == "drown")          return Drown;
-    if (action == "exiter")         return Exiter;
-    if (action == "faller")         return Faller;
-    if (action == "floater")        return Floater;
-    if (action == "jumper")         return Jumper;
-    if (action == "laserkill")      return Laserkill;
-    if (action == "miner")          return Miner;
-    if (action == "rocketlauncher") return Rocketlauncher;
-    if (action == "slider")         return Slider;
-    if (action == "smashed")        return Smashed;
-    if (action == "splashed")       return Splashed;
-    if (action == "superman")       return Superman;
-    if (action == "teleported")     return Teleported;
-    if (action == "waiter")         return Waiter;
-    if (action == "walker")         return Walker;
+ActionName action_from_string(const std::string& action) 
+{
+  if (action == "angel")          return Angel;
+  if (action == "basher")         return Basher;
+  if (action == "blocker")        return Blocker;
+  if (action == "boarder")        return Boarder;
+  if (action == "bomber")         return Bomber;
+  if (action == "bridger")        return Bridger;
+  if (action == "climber")        return Climber;
+  if (action == "digger")         return Digger;
+  if (action == "drown")          return Drown;
+  if (action == "exiter")         return Exiter;
+  if (action == "faller")         return Faller;
+  if (action == "floater")        return Floater;
+  if (action == "jumper")         return Jumper;
+  if (action == "laserkill")      return Laserkill;
+  if (action == "miner")          return Miner;
+  if (action == "rocketlauncher") return Rocketlauncher;
+  if (action == "slider")         return Slider;
+  if (action == "smashed")        return Smashed;
+  if (action == "splashed")       return Splashed;
+  if (action == "superman")       return Superman;
+  if (action == "teleported")     return Teleported;
+  if (action == "waiter")         return Waiter;
+  if (action == "walker")         return Walker;
 
-    return Walker;
-  }
+  return Walker;
+}
 
 }
 

Index: pingu_enums.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/pingu_enums.hxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- pingu_enums.hxx     18 Apr 2003 09:22:28 -0000      1.11
+++ pingu_enums.hxx     18 Apr 2003 17:08:56 -0000      1.12
@@ -63,10 +63,17 @@
     Walker
   };
 
-enum NameType { ENGLISH, TRANSLATED };
+/** Converts a action enum into its internal string representation, as
+    used in the xml or the resource files Bomber => "bomber" */
+std::string action_to_string(ActionName action);
 
-std::string action_to_string (ActionName action, NameType choice);
-ActionName  action_from_string (const std::string& action);
+/** Converts a internal action string back into its action enum
+    representation  "bomber" => Bomber */
+ActionName  action_from_string(const std::string& action);
+
+/** Convert a action enum into its visual representation, aka the
+    thing that is seen on the screen for the user Bomber => "Bomber" */
+std::string action_to_screenname(ActionName action);
 
 } // namespace Actions
 

Index: server_event.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/server_event.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- server_event.cxx    18 Apr 2003 09:22:28 -0000      1.6
+++ server_event.cxx    18 Apr 2003 17:08:56 -0000      1.7
@@ -73,7 +73,7 @@
       break;
     case PINGU_ACTION_EVENT:
       xml << "  <pingu-action time=\"" << to_string(time_stamp) << "\" id=\"" 
<< pingu_id 
-         << "\" action=\"" << Actions::action_to_string(pingu_action, 
Actions::ENGLISH) << "\"/>" << std::endl;
+         << "\" action=\"" << Actions::action_to_string(pingu_action) << 
"\"/>" << std::endl;
       break;
     default:
       assert(!"Unknown type");





reply via email to

[Prev in Thread] Current Thread [Next in Thread]