pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src ActionHolder.cc,1.32,1.33 ActionHolde


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src ActionHolder.cc,1.32,1.33 ActionHolder.hh,1.14,1.15 Server.cc,1.27,1.28 Server.hh,1.17,1.18 TrueServer.cc,1.30,1.31 TrueServer.hh,1.11,1.12
Date: 8 Jun 2002 22:38:34 -0000

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

Modified Files:
        ActionHolder.cc ActionHolder.hh Server.cc Server.hh 
        TrueServer.cc TrueServer.hh 
Log Message:
some cleanup, first step to get rid of shared_ptr<PinguAction>

Index: ActionHolder.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/ActionHolder.cc,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- ActionHolder.cc     16 Aug 2001 22:00:50 -0000      1.32
+++ ActionHolder.cc     8 Jun 2002 22:38:32 -0000       1.33
@@ -23,11 +23,25 @@
 #include "PingusError.hh"
 #include "Timer.hh"
 #include "globals.hh"
+#include "PLF.hh"
 
 #include "PinguActionFactory.hh"
 #include "ActionHolder.hh"
 
 using namespace boost;
+
+ActionHolder::ActionHolder (PLF* plf)
+{
+  std::vector<ActionData> action_data = plf->get_actions ();
+  
+  for(std::vector<ActionData>::iterator i = action_data.begin(); i != 
action_data.end(); ++i) {
+    set_actions(i->name, i->number_of);
+  }
+}
+
+ActionHolder::~ActionHolder ()
+{
+}
 
 void
 ActionHolder::set_actions(const std::string& name, int available)

Index: ActionHolder.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/ActionHolder.hh,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- ActionHolder.hh     16 Aug 2001 22:00:50 -0000      1.14
+++ ActionHolder.hh     8 Jun 2002 22:38:32 -0000       1.15
@@ -27,6 +27,8 @@
 
 #include "PinguAction.hh"
 
+class PLF;
+
 ///
 class PinguAction;
 
@@ -47,6 +49,9 @@
   std::map<std::string, int> available_actions;
 
 public:
+  ActionHolder (PLF* plf);
+  ~ActionHolder ();
+
   /** Sets the number of actions, which are available in the pool.
    * @param name the name of the action
    * @param available the number of actions available

Index: Server.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/Server.cc,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- Server.cc   8 Jun 2002 20:19:54 -0000       1.27
+++ Server.cc   8 Jun 2002 22:38:32 -0000       1.28
@@ -53,7 +53,8 @@
   }
 }
 
-Server::Server()
+Server::Server(PLF* plf)
+  : action_holder (plf)
 {
   demo_mode = false;
   get_next_event = true;
@@ -62,11 +63,6 @@
 }
 
 Server::~Server()
-{
-}
-
-void 
-Server::start(PLF* /*level_data*/)
 {
 }
 

Index: Server.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/Server.hh,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- Server.hh   8 Jun 2002 20:19:54 -0000       1.17
+++ Server.hh   8 Jun 2002 22:38:32 -0000       1.18
@@ -63,13 +63,12 @@
   bool finished;
 
 public:
-  Server();
+  Server(PLF*);
   virtual ~Server();
 
   virtual bool enough_time_passed() = 0;
   virtual void update(float delta);
-  virtual void start(PLF* level_data);
-
+  
   virtual void set_fast_forward(bool) = 0;
   virtual bool get_fast_forward() = 0;
 

Index: TrueServer.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/TrueServer.cc,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- TrueServer.cc       8 Jun 2002 20:19:54 -0000       1.30
+++ TrueServer.cc       8 Jun 2002 22:38:32 -0000       1.31
@@ -28,14 +28,35 @@
 using namespace std;
 
 TrueServer::TrueServer(PLF* arg_plf)
-  : plf (arg_plf)
+  : Server (arg_plf),
+    plf (arg_plf)
 {
   filename = plf->get_filename();
   local_game_speed = game_speed;
   world = 0;
   finished = false;
   client_needs_redraw = true;
-  start(plf);
+
+  plf = arg_plf;
+  
+  filename = plf->get_filename();
+
+  std::vector<ActionData> bdata;
+
+  fast_forward = false;
+  pause = false;
+  last_time = 0;
+  local_game_speed = game_speed;
+
+  world = new World ();
+
+  // FIXME: this is complete trash, delete it and place it in world
+  // object or so...
+  world->set_action_holder(&action_holder);
+
+  world->init(plf);
+
+  GameTime::reset();
 }
 
 TrueServer::~TrueServer()
@@ -72,44 +93,6 @@
       Server::update(delta);
       world->update(delta);
     }
-}
-
-void
-TrueServer::start(PLF* arg_plf)
-{
-  Timer timer;
-
-  plf = arg_plf;
-  
-  filename = plf->get_filename();
-
-  std::vector<ActionData> bdata;
-
-  timer.start();
-  
-  std::cout << "TrueServer: Generating actions..." << std::flush;
-
-  bdata = plf->get_actions();
-
-  for(std::vector<ActionData>::iterator b = bdata.begin(); b != bdata.end(); 
++b) {
-    action_holder.set_actions(b->name, b->number_of);
-  }
-  std::cout << "done " << timer.stop() << std::endl;
-
-  fast_forward = false;
-  pause = false;
-  last_time = 0;
-  local_game_speed = game_speed;
-
-  world = new World ();
-
-  // FIXME: this is complete trash, delete it and place it in world
-  // object or so...
-  world->set_action_holder(&action_holder);
-
-  world->init(plf);
-
-  GameTime::reset();
 }
 
 bool

Index: TrueServer.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/TrueServer.hh,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- TrueServer.hh       7 Jun 2002 19:10:33 -0000       1.11
+++ TrueServer.hh       8 Jun 2002 22:38:32 -0000       1.12
@@ -39,7 +39,6 @@
   TrueServer(PLF* plf);
   virtual ~TrueServer();
 
-  void start(PLF* level_data);
   bool enough_time_passed(void);
   void update(float delta);
   bool needs_redraw();




reply via email to

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