[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r4077 - in trunk/pingus/src: editor pingus pingus/actions p
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r4077 - in trunk/pingus/src: editor pingus pingus/actions pingus/components pingus/screens |
Date: |
Sun, 8 Nov 2009 01:37:05 +0100 |
Author: grumbel
Date: 2009-11-08 01:37:04 +0100 (Sun, 08 Nov 2009)
New Revision: 4077
Added:
trunk/pingus/src/pingus/action_name.cpp
trunk/pingus/src/pingus/action_name.hpp
Modified:
trunk/pingus/src/editor/action_properties.hpp
trunk/pingus/src/pingus/action_holder.hpp
trunk/pingus/src/pingus/actions/basher.cpp
trunk/pingus/src/pingus/actions/bomber.cpp
trunk/pingus/src/pingus/actions/faller.cpp
trunk/pingus/src/pingus/actions/miner.cpp
trunk/pingus/src/pingus/components/action_button.hpp
trunk/pingus/src/pingus/pingu.hpp
trunk/pingus/src/pingus/pingu_action.cpp
trunk/pingus/src/pingus/pingu_action.hpp
trunk/pingus/src/pingus/pingu_enums.cpp
trunk/pingus/src/pingus/pingu_enums.hpp
trunk/pingus/src/pingus/screens/game_session.hpp
trunk/pingus/src/pingus/server_event.hpp
Log:
Moved ActionName::Enum to its own file
Modified: trunk/pingus/src/editor/action_properties.hpp
===================================================================
--- trunk/pingus/src/editor/action_properties.hpp 2009-11-08 00:27:52 UTC
(rev 4076)
+++ trunk/pingus/src/editor/action_properties.hpp 2009-11-08 00:37:04 UTC
(rev 4077)
@@ -20,7 +20,7 @@
#include <map>
#include "engine/gui/group_component.hpp"
-#include "pingus/pingu_enums.hpp"
+#include "pingus/action_name.hpp"
namespace Editor {
Modified: trunk/pingus/src/pingus/action_holder.hpp
===================================================================
--- trunk/pingus/src/pingus/action_holder.hpp 2009-11-08 00:27:52 UTC (rev
4076)
+++ trunk/pingus/src/pingus/action_holder.hpp 2009-11-08 00:37:04 UTC (rev
4077)
@@ -20,7 +20,7 @@
#include <map>
#include <vector>
-#include "pingus/pingu_enums.hpp"
+#include "pingus/action_name.hpp"
class PingusLevel;
class PinguAction;
Added: trunk/pingus/src/pingus/action_name.cpp
===================================================================
--- trunk/pingus/src/pingus/action_name.cpp 2009-11-08 00:27:52 UTC (rev
4076)
+++ trunk/pingus/src/pingus/action_name.cpp 2009-11-08 00:37:04 UTC (rev
4077)
@@ -0,0 +1,116 @@
+// Pingus - A free Lemmings clone
+// Copyright (C) 1998-2009 Ingo Ruhnke <address@hidden>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#include "action_name.hpp"
+
+#include "gettext.h"
+
+namespace ActionName {
+
+std::string to_screenname(Enum 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";
+ }
+}
+
+std::string to_string(Enum 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";
+ }
+}
+
+Enum 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;
+}
+
+} // namespace ActionName
+
+/* EOF */
Property changes on: trunk/pingus/src/pingus/action_name.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/pingus/src/pingus/action_name.hpp
===================================================================
--- trunk/pingus/src/pingus/action_name.hpp 2009-11-08 00:27:52 UTC (rev
4076)
+++ trunk/pingus/src/pingus/action_name.hpp 2009-11-08 00:37:04 UTC (rev
4077)
@@ -0,0 +1,70 @@
+// Pingus - A free Lemmings clone
+// Copyright (C) 1998-2009 Ingo Ruhnke <address@hidden>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef HEADER_PINGUS_PINGUS_ACTION_NAME_HPP
+#define HEADER_PINGUS_PINGUS_ACTION_NAME_HPP
+
+#include <string>
+
+namespace ActionName {
+
+/** 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 Enum
+{
+ ANGEL,
+ BASHER,
+ BLOCKER,
+ BOARDER,
+ BOMBER,
+ BRIDGER,
+ CLIMBER,
+ DIGGER,
+ DROWN,
+ EXITER,
+ FALLER,
+ FLOATER,
+ JUMPER,
+ LASERKILL,
+ MINER,
+ ROCKETLAUNCHER,
+ SLIDER,
+ SMASHED,
+ SPLASHED,
+ SUPERMAN,
+ TELEPORTED,
+ WAITER,
+ WALKER
+};
+
+/** Converts a action enum into its internal string representation, as
+ used in the xml or the resource files Bomber => "bomber" */
+std::string to_string(Enum action);
+
+/** Converts a internal action string back into its action enum
+ representation "bomber" => Bomber */
+Enum 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 to_screenname(Enum action);
+
+} // namespace ActionName
+
+#endif
+
+/* EOF */
Property changes on: trunk/pingus/src/pingus/action_name.hpp
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/pingus/src/pingus/actions/basher.cpp
===================================================================
--- trunk/pingus/src/pingus/actions/basher.cpp 2009-11-08 00:27:52 UTC (rev
4076)
+++ trunk/pingus/src/pingus/actions/basher.cpp 2009-11-08 00:37:04 UTC (rev
4077)
@@ -21,6 +21,7 @@
#include "pingus/debug.hpp"
#include "pingus/globals.hpp"
#include "pingus/pingu.hpp"
+#include "pingus/pingu_enums.hpp"
#include "pingus/world.hpp"
#include "pingus/worldobj.hpp"
Modified: trunk/pingus/src/pingus/actions/bomber.cpp
===================================================================
--- trunk/pingus/src/pingus/actions/bomber.cpp 2009-11-08 00:27:52 UTC (rev
4076)
+++ trunk/pingus/src/pingus/actions/bomber.cpp 2009-11-08 00:37:04 UTC (rev
4077)
@@ -21,6 +21,7 @@
#include "pingus/movers/linear_mover.hpp"
#include "pingus/particles/pingu_particle_holder.hpp"
#include "pingus/pingu.hpp"
+#include "pingus/pingu_enums.hpp"
#include "pingus/world.hpp"
namespace Actions {
Modified: trunk/pingus/src/pingus/actions/faller.cpp
===================================================================
--- trunk/pingus/src/pingus/actions/faller.cpp 2009-11-08 00:27:52 UTC (rev
4076)
+++ trunk/pingus/src/pingus/actions/faller.cpp 2009-11-08 00:37:04 UTC (rev
4077)
@@ -20,6 +20,7 @@
#include "pingus/colliders/pingu_collider.hpp"
#include "pingus/movers/linear_mover.hpp"
#include "pingus/pingu.hpp"
+#include "pingus/pingu_enums.hpp"
#include "pingus/world.hpp"
#include "pingus/worldobj.hpp"
Modified: trunk/pingus/src/pingus/actions/miner.cpp
===================================================================
--- trunk/pingus/src/pingus/actions/miner.cpp 2009-11-08 00:27:52 UTC (rev
4076)
+++ trunk/pingus/src/pingus/actions/miner.cpp 2009-11-08 00:37:04 UTC (rev
4077)
@@ -20,6 +20,7 @@
#include "engine/display/scene_context.hpp"
#include "engine/sound/sound.hpp"
#include "pingus/pingu.hpp"
+#include "pingus/pingu_enums.hpp"
#include "pingus/world.hpp"
#include "pingus/worldobj.hpp"
Modified: trunk/pingus/src/pingus/components/action_button.hpp
===================================================================
--- trunk/pingus/src/pingus/components/action_button.hpp 2009-11-08
00:27:52 UTC (rev 4076)
+++ trunk/pingus/src/pingus/components/action_button.hpp 2009-11-08
00:37:04 UTC (rev 4077)
@@ -22,7 +22,7 @@
#include "engine/display/font.hpp"
#include "engine/gui/component.hpp"
#include "engine/gui/rect_component.hpp"
-#include "pingus/pingu_enums.hpp"
+#include "pingus/action_name.hpp"
#include "pingus/state_sprite.hpp"
class Server;
Modified: trunk/pingus/src/pingus/pingu.hpp
===================================================================
--- trunk/pingus/src/pingus/pingu.hpp 2009-11-08 00:27:52 UTC (rev 4076)
+++ trunk/pingus/src/pingus/pingu.hpp 2009-11-08 00:37:04 UTC (rev 4077)
@@ -21,7 +21,7 @@
#include "math/vector3f.hpp"
#include "pingus/direction.hpp"
-#include "pingus/pingu_enums.hpp"
+#include "pingus/action_name.hpp"
class ActionHolder;
class PinguAction;
Modified: trunk/pingus/src/pingus/pingu_action.cpp
===================================================================
--- trunk/pingus/src/pingus/pingu_action.cpp 2009-11-08 00:27:52 UTC (rev
4076)
+++ trunk/pingus/src/pingus/pingu_action.cpp 2009-11-08 00:37:04 UTC (rev
4077)
@@ -18,6 +18,7 @@
#include "pingus/collision_map.hpp"
#include "pingus/pingu.hpp"
+#include "pingus/pingu_enums.hpp"
#include "pingus/world.hpp"
#include "pingus/worldobj.hpp"
Modified: trunk/pingus/src/pingus/pingu_action.hpp
===================================================================
--- trunk/pingus/src/pingus/pingu_action.hpp 2009-11-08 00:27:52 UTC (rev
4076)
+++ trunk/pingus/src/pingus/pingu_action.hpp 2009-11-08 00:37:04 UTC (rev
4077)
@@ -17,7 +17,7 @@
#ifndef HEADER_PINGUS_PINGUS_PINGU_ACTION_HPP
#define HEADER_PINGUS_PINGUS_PINGU_ACTION_HPP
-#include "pingus/pingu_enums.hpp"
+#include "pingus/action_name.hpp"
class ActionHolder;
class SceneContext;
Modified: trunk/pingus/src/pingus/pingu_enums.cpp
===================================================================
--- trunk/pingus/src/pingus/pingu_enums.cpp 2009-11-08 00:27:52 UTC (rev
4076)
+++ trunk/pingus/src/pingus/pingu_enums.cpp 2009-11-08 00:37:04 UTC (rev
4077)
@@ -16,101 +16,4 @@
#include "pingus/pingu_enums.hpp"
-#include "gettext.h"
-
-namespace ActionName {
-
-std::string to_screenname(Enum 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";
- }
-}
-
-std::string to_string(Enum 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";
- }
-}
-
-Enum 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;
-}
-
-} // namespace Actions
-
/* EOF */
Modified: trunk/pingus/src/pingus/pingu_enums.hpp
===================================================================
--- trunk/pingus/src/pingus/pingu_enums.hpp 2009-11-08 00:27:52 UTC (rev
4076)
+++ trunk/pingus/src/pingus/pingu_enums.hpp 2009-11-08 00:37:04 UTC (rev
4077)
@@ -17,54 +17,6 @@
#ifndef HEADER_PINGUS_PINGUS_PINGU_ENUMS_HPP
#define HEADER_PINGUS_PINGUS_PINGU_ENUMS_HPP
-#include <string>
-
-namespace ActionName {
-
-/** 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 Enum
-{
- ANGEL,
- BASHER,
- BLOCKER,
- BOARDER,
- BOMBER,
- BRIDGER,
- CLIMBER,
- DIGGER,
- DROWN,
- EXITER,
- FALLER,
- FLOATER,
- JUMPER,
- LASERKILL,
- MINER,
- ROCKETLAUNCHER,
- SLIDER,
- SMASHED,
- SPLASHED,
- SUPERMAN,
- TELEPORTED,
- WAITER,
- WALKER
-};
-
-/** Converts a action enum into its internal string representation, as
- used in the xml or the resource files Bomber => "bomber" */
-std::string to_string(Enum action);
-
-/** Converts a internal action string back into its action enum
- representation "bomber" => Bomber */
-Enum 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 to_screenname(Enum action);
-
-} // namespace ActionName
-
// Pingu "globals". Make [deadly_velocity = 20 * sqrt("normal gravity")] so
// that the "deadly distance" is the same and therefore doesn't break levels.
const float deadly_velocity = 10.0f;
Modified: trunk/pingus/src/pingus/screens/game_session.hpp
===================================================================
--- trunk/pingus/src/pingus/screens/game_session.hpp 2009-11-08 00:27:52 UTC
(rev 4076)
+++ trunk/pingus/src/pingus/screens/game_session.hpp 2009-11-08 00:37:04 UTC
(rev 4077)
@@ -21,7 +21,7 @@
#include <string>
#include "engine/screen/gui_screen.hpp"
-#include "pingus/pingu_enums.hpp"
+#include "pingus/action_name.hpp"
#include "pingus/pingus_level.hpp"
namespace Input {
Modified: trunk/pingus/src/pingus/server_event.hpp
===================================================================
--- trunk/pingus/src/pingus/server_event.hpp 2009-11-08 00:27:52 UTC (rev
4076)
+++ trunk/pingus/src/pingus/server_event.hpp 2009-11-08 00:37:04 UTC (rev
4077)
@@ -18,7 +18,7 @@
#define HEADER_PINGUS_PINGUS_SERVER_EVENT_HPP
#include "math/vector3f.hpp"
-#include "pingus/pingu_enums.hpp"
+#include "pingus/action_name.hpp"
#include "util/file_reader.hpp"
class Server;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r4077 - in trunk/pingus/src: editor pingus pingus/actions pingus/components pingus/screens,
grumbel at BerliOS <=