pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src button_panel.cxx,1.18,1.19 pingu_enum


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src button_panel.cxx,1.18,1.19 pingu_enums.hxx,1.8,1.9
Date: 2 Nov 2002 17:43:12 -0000

Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv28495

Modified Files:
        button_panel.cxx pingu_enums.hxx 
Log Message:
gervases basher patch and some sorting for the buttonpanel

Index: button_panel.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/button_panel.cxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- button_panel.cxx    29 Oct 2002 12:47:55 -0000      1.18
+++ button_panel.cxx    2 Nov 2002 17:43:10 -0000       1.19
@@ -28,6 +28,12 @@
 
 CL_Surface ButtonPanel::button_cap;
 
+struct action_sorter {
+  bool operator() (const ActionData& a, const ActionData& b) {
+    return a.name < b.name;
+  }
+};
+
 ButtonPanel::ButtonPanel(PLF* plf, int arg_x_pos, int arg_y_pos)
   : armageddon_pressed(false),
     left_pressed(0),
@@ -37,6 +43,10 @@
 {
 
   std::vector<ActionData> buttons_data = plf->get_actions();
+
+  // Sort the action so that they always have the same order in the
+  // panel
+  std::sort(buttons_data.begin(), buttons_data.end(), action_sorter());
 
   y_pos -= (buttons_data.size() * 38)/2 + 70;
 

Index: pingu_enums.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_enums.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- pingu_enums.hxx     4 Oct 2002 13:46:56 -0000       1.8
+++ pingu_enums.hxx     2 Nov 2002 17:43:10 -0000       1.9
@@ -32,41 +32,41 @@
     FIXME: splashed, smashed, etc.) */
 enum PinguStatus { PS_ALIVE, PS_EXITED, PS_DEAD };
 
-enum PingusGameMode { 
-  INTERACTIVE_MODE,
-  DEMO_MODE 
-};
-
 namespace Actions {
-    
-  enum ActionName { Angel,
-                    Basher,
-                    Blocker,
-                    Boarder,
-                    Bomber,
-                    Bridger,
-                    Climber,
-                    Digger,
-                    Drown,
-                    Exiter,
-                    Faller,
-                    Floater,
-                    Jumper,
-                    Laserkill,
-                    Miner,
-                    Rocketlauncher,
-                    Slider,
-                    Smashed,
-                    Splashed,
-                    Superman,
-                    Teleported,
-                    Waiter,
-                    Walker
-               };
+
+/** The order of the actions here are the same as the order of actions
+    in the buttonpanel, so if the order in the buttonpanel is not what
+    it should be it needs to be changed here. */
+enum ActionName
+  { Angel,
+    Basher,
+    Blocker,
+    Boarder,
+    Bomber,
+    Bridger,
+    Climber,
+    Digger,
+    Drown,
+    Exiter,
+    Faller,
+    Floater,
+    Jumper,
+    Laserkill,
+    Miner,
+    Rocketlauncher,
+    Slider,
+    Smashed,
+    Splashed,
+    Superman,
+    Teleported,
+    Waiter,
+    Walker
+  };
      
-  std::string action_to_string (ActionName action);
-  ActionName  action_from_string (const std::string& action);
-}
+std::string action_to_string (ActionName action);
+ActionName  action_from_string (const std::string& action);
+
+} // namespace Actions
 
 
 #endif





reply via email to

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