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_holder.cxx,1.10,1.11 client.cx


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src action_holder.cxx,1.10,1.11 client.cxx,1.41,1.42 credits.cxx,1.16,1.17 game_session.cxx,1.26,1.27 game_session.hxx,1.15,1.16 level_result.cxx,1.9,1.10 pingu_action_factory.cxx,1.12,1.13 pingu_action_factory.hxx,1.10,1.11 pingus_menu_manager.cxx,1.19,1.20 plf.cxx,1.13,1.14 plf.hxx,1.8,1.9 theme_selector.cxx,1.9,1.10 xml_plf.cxx,1.32,1.33
Date: 19 Feb 2003 11:33:02 -0000

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

Modified Files:
        action_holder.cxx client.cxx credits.cxx game_session.cxx 
        game_session.hxx level_result.cxx pingu_action_factory.cxx 
        pingu_action_factory.hxx pingus_menu_manager.cxx plf.cxx 
        plf.hxx theme_selector.cxx xml_plf.cxx 
Log Message:
- fixed music support for levels
- removed call to delete_actions(), this causes memory leak, but gets rid of 
crashing


Index: action_holder.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/action_holder.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- action_holder.cxx   29 Dec 2002 23:29:00 -0000      1.10
+++ action_holder.cxx   19 Feb 2003 11:33:00 -0000      1.11
@@ -41,10 +41,6 @@
 
 ActionHolder::~ActionHolder ()
 {
-  //FIXME: This is not really a good place to free the actions
-  //FIXME: But not otherwise to possible at the moment due to the
-  //FIXME: singleton thing.
-  PinguActionFactory::instance()->delete_actions();
 }
 
 std::vector<ActionName>

Index: client.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/client.cxx,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- client.cxx  19 Feb 2003 10:37:31 -0000      1.41
+++ client.cxx  19 Feb 2003 11:33:00 -0000      1.42
@@ -360,7 +360,15 @@
   is_finished = false;
   skip_frame = 0;
 
-  PingusSound::play_music(path_manager.complete ("music/" + server->get_plf 
()->get_music().res_name));
+  std::cout << "Starting Music: " << server->get_plf()->get_music() << 
std::endl;
+  if (server->get_plf()->get_music() == "none")
+    {
+      PingusSound::stop_music();
+    }
+  else
+    {
+      PingusSound::play_music(server->get_plf ()->get_music());
+    }
 
   if (verbose)
     std::cout << "Client: Entering main_loop. Startup time: " 

Index: credits.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/credits.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- credits.cxx 19 Feb 2003 09:50:35 -0000      1.16
+++ credits.cxx 19 Feb 2003 11:33:00 -0000      1.17
@@ -145,7 +145,7 @@
 Credits::on_startup ()
 {
   offset = CL_Display::get_height() + 50;
-  PingusSound::play_music("music/pingus-2.it");
+  PingusSound::play_music("pingus-2.it");
 }
 
 Credits*

Index: game_session.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/game_session.cxx,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- game_session.cxx    19 Feb 2003 09:50:36 -0000      1.26
+++ game_session.cxx    19 Feb 2003 11:33:00 -0000      1.27
@@ -61,6 +61,18 @@
   delete plf;
 }
 
+void
+PingusGameSession::on_startup()
+{
+  client->on_startup();
+}
+
+void
+PingusGameSession::on_shutdown()
+{
+  client->on_shutdown();
+}
+
 PingusGameSessionResult
 PingusGameSession::get_result ()
 {

Index: game_session.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/game_session.hxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- game_session.hxx    19 Feb 2003 09:50:36 -0000      1.15
+++ game_session.hxx    19 Feb 2003 11:33:00 -0000      1.16
@@ -75,6 +75,9 @@
   /** Pass a delta to the screen */
   void update (const GameDelta& delta);
 
+  void on_startup();
+  void on_shutdown();
+
   void on_pause_press ();
   void on_fast_forward_press ();
   void on_armageddon_press ();

Index: level_result.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/level_result.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- level_result.cxx    19 Feb 2003 09:50:36 -0000      1.9
+++ level_result.cxx    19 Feb 2003 11:33:00 -0000      1.10
@@ -46,7 +46,7 @@
 {
   char  str[128];
 
-  PingusSound::play_music("../data/music/pingus-2.it");
+  PingusSound::play_music("pingus-2.it");
 
   Display::hide_cursor();
 

Index: pingu_action_factory.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_action_factory.cxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- pingu_action_factory.cxx    18 Feb 2003 21:38:08 -0000      1.12
+++ pingu_action_factory.cxx    19 Feb 2003 11:33:00 -0000      1.13
@@ -48,6 +48,8 @@
 
 using namespace Actions;
 
+PinguActionFactory* PinguActionFactory::instance_ = 0;
+
 PinguActionFactory::PinguActionFactory ()
 {
 }
@@ -63,10 +65,9 @@
     {
       delete i->second;
     }
+  factories.clear();
 }
 
-PinguActionFactory* PinguActionFactory::instance_ = 0;
-
 PinguActionFactory* 
 PinguActionFactory::instance ()
 {
@@ -121,6 +122,7 @@
 PinguAction* 
 PinguActionFactory::create (Pingu* pingu, ActionName id)
 {
+  //std::cout << "PinguActionFactory: number of actions: " << 
all_actions.size() << std::endl;
   std::map<ActionName, PinguActionAbstractFactory*>::iterator it = 
factories.find(id);
   
   if (it == factories.end())

Index: pingu_action_factory.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_action_factory.hxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- pingu_action_factory.hxx    28 Dec 2002 16:57:38 -0000      1.10
+++ pingu_action_factory.hxx    19 Feb 2003 11:33:00 -0000      1.11
@@ -50,7 +50,7 @@
 
   /** Delete all actions which this class has allocated. This needs to
       be called seperatly from the constructor, due to the used
-      singleton pattern. [FIXME] */
+      singleton pattern. [FIXME: if not called memory leak will result] */
   void delete_actions ();
 
   /** Allocate the given action */

Index: pingus_menu_manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_menu_manager.cxx,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- pingus_menu_manager.cxx     19 Feb 2003 09:50:36 -0000      1.19
+++ pingus_menu_manager.cxx     19 Feb 2003 11:33:00 -0000      1.20
@@ -149,7 +149,7 @@
 void
 PingusMenuManager::on_startup()
 {
-  PingusSound::play_music("../data/music/pingus-1.it");
+  PingusSound::play_music("pingus-1.it");
 }
 
 PingusMenuManager*

Index: plf.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/plf.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- plf.cxx     29 Dec 2002 23:29:00 -0000      1.13
+++ plf.cxx     19 Feb 2003 11:33:00 -0000      1.14
@@ -33,7 +33,7 @@
   number_of_pingus = 100;
   difficulty = 5;  
   playable = false;
-  music = ResDescriptor("file", "pingus-4.it");
+  music = "none";
 }
 
 // Destroy all data
@@ -84,7 +84,7 @@
   return actions;
 }
 
-ResDescriptor
+std::string
 PLF::get_music()
 {
   return music;

Index: plf.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/plf.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- plf.hxx     27 Sep 2002 11:26:44 -0000      1.8
+++ plf.hxx     19 Feb 2003 11:33:00 -0000      1.9
@@ -44,7 +44,7 @@
   /** Author of this level */
   std::string author;
 
-  ResDescriptor music;
+  std::string music;
 
   /** Start x-position of the camera */
   int  start_x_pos;
@@ -98,7 +98,7 @@
 
   /** Returns the ResDescriptor where the music for this level can be
       found. The ResDescriptor points normaly to a file. */
-  ResDescriptor get_music(void);
+  std::string get_music(void);
 
   /** Returns the start position for the camera */
   int         get_startx(void);

Index: theme_selector.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/theme_selector.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- theme_selector.cxx  19 Feb 2003 09:50:36 -0000      1.9
+++ theme_selector.cxx  19 Feb 2003 11:33:00 -0000      1.10
@@ -134,7 +134,7 @@
          loading_screen.draw();
          (*(theme_selector->current_theme))->play();
          enabled = true;
-         PingusSound::play_music("music/pingus-1.it");
+         PingusSound::play_music("pingus-1.it");
          break;
        }
     }
@@ -264,7 +264,7 @@
     }
   current_theme = themes.end()-1;
 
-  PingusSound::play_music(path_manager.complete("music/pingus-1.it"));
+  PingusSound::play_music("pingus-1.it");
 
   Display::set_cursor(CL_MouseCursorProvider::load("Cursors/cursor", 
                                                   
PingusResource::get("game")));

Index: xml_plf.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/xml_plf.cxx,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- xml_plf.cxx 29 Dec 2002 23:29:00 -0000      1.32
+++ xml_plf.cxx 19 Feb 2003 11:33:00 -0000      1.33
@@ -19,6 +19,7 @@
 
 #include <iostream>
 #include "xml_helper.hxx"
+#include "xml_file_reader.hxx"
 #include "xml_plf.hxx"
 #include "globals.hxx"
 #include "system.hxx"
@@ -310,6 +311,19 @@
 void
 XMLPLF::parse_global (xmlNodePtr cur)
 {
+  XMLFileReader reader(doc, cur);
+  
+  reader.read_string("author", author);
+  reader.read_int("number-of-pingus", number_of_pingus);
+  reader.read_int("number-to-save", number_to_save);
+  reader.read_int("time", max_time);
+  reader.read_int("difficulty", difficulty);
+  reader.read_bool("playable", playable);
+  reader.read_string("comment", comment);
+  reader.read_string("music", music);
+  reader.read_int("width", width);
+  reader.read_int("height", height);
+
   cur = cur->children;
   while (cur)
     {
@@ -343,48 +357,6 @@
              description[default_language] = desc;
          }
        }
-      else if (XMLhelper::equal_str(cur->name, "author"))
-       {
-         XMLhelper::node_list_get_string(doc, cur->children, 1, author);
-         //std::cout << "Author: " << author << " -----------------------" << 
std::endl;
-       }
-      else if (XMLhelper::equal_str(cur->name, "number-of-pingus"))
-       {
-         number_of_pingus = XMLhelper::parse_int(doc, cur);
-       }
-      else if (XMLhelper::equal_str(cur->name, "difficulty"))
-       {
-         difficulty = XMLhelper::parse_int(doc, cur);
-       }
-      else if (XMLhelper::equal_str(cur->name, "playable"))
-       {
-         playable = XMLhelper::parse_bool(doc, cur);
-       }
-      else if (XMLhelper::equal_str(cur->name, "comment"))
-       {
-         comment = XMLhelper::parse_string(doc, cur);
-       }
-      else if (XMLhelper::equal_str(cur->name, "number-to-save"))
-       {
-         number_to_save = XMLhelper::parse_int(doc, cur);
-       }
-      else if (XMLhelper::equal_str(cur->name, "time"))
-       {
-         max_time = XMLhelper::parse_int(doc, cur);
-       }
-      else if (XMLhelper::equal_str(cur->name, "height"))
-       {
-         height = XMLhelper::parse_int(doc, cur);
-       }
-      else if (XMLhelper::equal_str(cur->name, "width"))
-       {
-         width = XMLhelper::parse_int(doc, cur);
-       }
-      else
-       {
-         std::cout << "XMLPLF: global: Unhandled: " << cur->name << std::endl;
-       }
-
       cur = cur->next;
     }
 }





reply via email to

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