pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src ButtonPanel.cc,1.27,1.28 CaptureRecta


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src ButtonPanel.cc,1.27,1.28 CaptureRectangle.cc,1.17,1.18 CaptureRectangle.hh,1.13,1.14 Client.cc,1.80,1.81 Client.hh,1.37,1.38 HurryUp.cc,1.11,1.12 PingusCounter.cc,1.9,1.10 Playfield.cc,1.32,1.33 Playfield.hh,1.22,1.23 SmallMap.cc,1.40,1.41
Date: 8 Jun 2002 18:39:59 -0000

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

Modified Files:
        ButtonPanel.cc CaptureRectangle.cc CaptureRectangle.hh 
        Client.cc Client.hh HurryUp.cc PingusCounter.cc Playfield.cc 
        Playfield.hh SmallMap.cc 
Log Message:
Some more shared_ptr<> byebye...

Index: ButtonPanel.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/ButtonPanel.cc,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- ButtonPanel.cc      7 Jun 2002 19:10:33 -0000       1.27
+++ ButtonPanel.cc      8 Jun 2002 18:39:57 -0000       1.28
@@ -25,6 +25,8 @@
 #include "Controller.hh"
 #include "PLF.hh"
 #include "Client.hh"
+#include "Server.hh"
+#include "World.hh"
 
 using boost::shared_ptr;
 CL_Surface ButtonPanel::button_cap;

Index: CaptureRectangle.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/CaptureRectangle.cc,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- CaptureRectangle.cc 8 Jun 2002 16:08:16 -0000       1.17
+++ CaptureRectangle.cc 8 Jun 2002 18:39:57 -0000       1.18
@@ -32,11 +32,9 @@
 
 using namespace boost;
 
-Pingu* CaptureRectangle::pingu; 
-shared_ptr<PinguAction> CaptureRectangle::button_action;
-
 CaptureRectangle::CaptureRectangle()
-  : owner_id (0),
+  : pingu (0),
+    owner_id (0),
     good (PingusResource::load_surface("Cursors/capgood", "game")),
     bad (PingusResource::load_surface("Cursors/capbad",  "game")),
     arrow_left (PingusResource::load_surface("Cursors/arrow_left",  "game")),

Index: CaptureRectangle.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/CaptureRectangle.hh,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- CaptureRectangle.hh 8 Jun 2002 16:08:16 -0000       1.13
+++ CaptureRectangle.hh 8 Jun 2002 18:39:57 -0000       1.14
@@ -37,8 +37,8 @@
 class CaptureRectangle
 {
 private:
-  static Pingu*       pingu; 
-  static boost::shared_ptr<PinguAction> button_action;
+  Pingu*       pingu; 
+  boost::shared_ptr<PinguAction> button_action;
 
   /// The id of the owner of this capture rectangle
   int owner_id;
@@ -51,11 +51,10 @@
   CL_Font* font;
 public:
   CaptureRectangle();  
-  virtual ~CaptureRectangle(); 
+  ~CaptureRectangle(); 
   
-  static void load_data();
-  static void set_pingu(Pingu* pingu);  
-  static void set_action(boost::shared_ptr<PinguAction>);
+  void set_pingu(Pingu* pingu);  
+  void set_action(boost::shared_ptr<PinguAction>);
 
   void draw_offset(int x_offset, int y_offset, float s = 1.0); 
 };

Index: Client.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/Client.cc,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- Client.cc   7 Jun 2002 19:10:33 -0000       1.80
+++ Client.cc   8 Jun 2002 18:39:57 -0000       1.81
@@ -33,22 +33,20 @@
 #include "PingusSound.hh"
 #include "PingusError.hh"
 #include "OptionMenu.hh"
+#include "TimeDisplay.hh"
+#include "PingusCounter.hh"
+#include "SmallMap.hh"
 #include "PLF.hh"
+#include "HurryUp.hh"
 #include "DeltaManager.hh"
 #include "MouseController.hh"
 #include "PathManager.hh"
 #include "GamepadController.hh"
+#include "Cursor.hh"
+#include "Server.hh"
 
 using boost::shared_ptr;
 
-bool Client::gui_is_init;
-shared_ptr<ButtonPanel>   Client::button_panel;
-shared_ptr<PingusCounter> Client::pcounter;
-shared_ptr<Playfield>     Client::playfield;
-shared_ptr<TimeDisplay>   Client::time_display;
-shared_ptr<SmallMap>      Client::small_map;
-shared_ptr<HurryUp>       Client::hurry_up;
-
 Client::Client(boost::shared_ptr<Controller> arg_controller, Server * s)
   : controller (arg_controller),
     cursor (new Cursor ("cursors/animcross", "core", controller))
@@ -60,6 +58,13 @@
   skip_frame = 0;
   do_replay = false;
   is_finished = false;
+
+  playfield = 0;    
+  button_panel = 0;
+  pcounter = 0;
+  small_map = 0;
+  time_display = 0;
+  hurry_up = 0;
  
   Display::add_flip_screen_hook(cursor.get ());
   //Display::add_flip_screen_hook(new Cursor ("cursors/cursor", "core", 
boost::shared_ptr<Controller>(new MouseController ())));
@@ -70,6 +75,13 @@
   //std::cout << "Client:~Client" << std::endl;
   Display::remove_flip_screen_hook(cursor.get ());
   deinit_display();
+
+  delete playfield;    
+  delete button_panel;
+  delete pcounter;
+  delete small_map;
+  delete time_display;
+  delete hurry_up;
 }
 
 void
@@ -104,15 +116,13 @@
                                                   
PingusResource::get("game")));
   Display::show_cursor();
   
-  playfield = shared_ptr<Playfield>(new Playfield(plf, server->get_world(),
-                                                 controller));
+  playfield = new Playfield(plf, server->get_world(), controller);
     
-  button_panel = shared_ptr<ButtonPanel>(new ButtonPanel(plf, controller, 2, 
CL_Display::get_height()/2));
-  pcounter     = shared_ptr<PingusCounter>(new PingusCounter());
-  small_map    = shared_ptr<SmallMap>(new SmallMap());
-  time_display = shared_ptr<TimeDisplay>(new TimeDisplay());
-  hurry_up     = shared_ptr<HurryUp>(new HurryUp());
-  gui_is_init = true;
+  button_panel = new ButtonPanel(plf, controller, 2, 
CL_Display::get_height()/2);
+  pcounter     = new PingusCounter();
+  small_map    = new SmallMap();
+  time_display = new TimeDisplay();
+  hurry_up     = new HurryUp();
    
   button_panel->set_server(server);
   time_display->set_server(server);
@@ -131,12 +141,12 @@
   playfield->set_client(this);
 
   // Adding all GuiObj's to the screen
-  obj.push_back(playfield.get());
-  obj.push_back(pcounter.get());
-  obj.push_back(time_display.get());
-  obj.push_back(button_panel.get());
-  obj.push_back(small_map.get());
-  obj.push_back(hurry_up.get());
+  obj.push_back(playfield);
+  obj.push_back(pcounter);
+  obj.push_back(time_display);
+  obj.push_back(button_panel);
+  obj.push_back(small_map);
+  obj.push_back(hurry_up);
 
   if (verbose) std::cout << "done " << timer.stop() << std::endl;
 }

Index: Client.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/Client.hh,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- Client.hh   7 Jun 2002 19:10:33 -0000       1.37
+++ Client.hh   8 Jun 2002 18:39:57 -0000       1.38
@@ -20,30 +20,28 @@
 #ifndef CLIENT_HH
 #define CLIENT_HH
 
-#include <string>
+#include <ClanLib/core.h>
+#include <ClanLib/display.h>
 
+#include <string>
+#include <vector>
 #include "boost/smart_ptr.hpp"
 
-#include "Server.hh"
 #include "Result.hh"
 
-#include "ButtonPanel.hh"
-#include "TimeDisplay.hh"
-#include "PinguInfo.hh"
-#include "PingusCounter.hh"
-#include "SmallMap.hh"
-#include "HurryUp.hh"
-#include "Controller.hh"
-#include "Cursor.hh"
-#include "Playfield.hh"
-#include "SmallMap.hh"
-
-class Playfield;
 class ButtonPanel;
-class PingusCounter;
+class Controller;
+class Cursor;
+class GuiObj;
 class HurryUp;
+class PLF;
+class PingusCounter;
+class Playfield;
+class Server;
+class SmallMap;
+class TimeDisplay;
 
-/** FIXME: This whole Server/Client concept is screwed */
+/** FIXME: This whole Server/Client concept is a bit screwed */
 class Client
 {
 private:
@@ -51,7 +49,6 @@
   PLF* plf;
   Result result;
   Server* server;
-  PingusGameMode mode;
 
   bool fast_forward;
   bool pause;
@@ -62,14 +59,12 @@
   std::vector<GuiObj*> obj;
   typedef std::vector<GuiObj*>::iterator GuiObjIter;
 
-  static bool gui_is_init;
-
-  static boost::shared_ptr<ButtonPanel>   button_panel;
-  static boost::shared_ptr<PingusCounter> pcounter;
-  static boost::shared_ptr<Playfield>     playfield;
-  static boost::shared_ptr<TimeDisplay>   time_display;
-  static boost::shared_ptr<SmallMap>      small_map;
-  static boost::shared_ptr<HurryUp>       hurry_up;
+  ButtonPanel*   button_panel;
+  PingusCounter* pcounter;
+  Playfield*     playfield;
+  TimeDisplay*   time_display;
+  SmallMap*      small_map;
+  HurryUp*       hurry_up;
 
   boost::shared_ptr<Controller> controller;
   boost::shared_ptr<Cursor>     cursor;
@@ -97,7 +92,7 @@
   virtual ~Client();
 
   Server* get_server() { return server; }
-  boost::shared_ptr<Playfield> get_playfield() { return playfield; }
+  Playfield* get_playfield() { return playfield; }
 
   /** Display the game and enter the main game loop */
   void display();

Index: HurryUp.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/HurryUp.cc,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- HurryUp.cc  7 Jun 2002 20:35:14 -0000       1.11
+++ HurryUp.cc  8 Jun 2002 18:39:57 -0000       1.12
@@ -20,6 +20,7 @@
 #include "PingusResource.hh"
 #include "HurryUp.hh"
 #include "Client.hh"
+#include "Server.hh"
 
 HurryUp::HurryUp()
 {

Index: PingusCounter.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/PingusCounter.cc,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- PingusCounter.cc    15 Jan 2002 17:52:02 -0000      1.9
+++ PingusCounter.cc    8 Jun 2002 18:39:57 -0000       1.10
@@ -28,6 +28,7 @@
 #include <clocale>
 #include <config.h>
 #include "my_gettext.hh"
+#include "Server.hh"
 
 
 PingusCounter::PingusCounter()

Index: Playfield.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/Playfield.cc,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- Playfield.cc        8 Jun 2002 16:08:16 -0000       1.32
+++ Playfield.cc        8 Jun 2002 18:39:57 -0000       1.33
@@ -228,7 +228,7 @@
 }
 
 void
-Playfield::set_buttons(boost::shared_ptr<ButtonPanel> b)
+Playfield::set_buttons(ButtonPanel* b)
 {
   buttons = b;
 }

Index: Playfield.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/Playfield.hh,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- Playfield.hh        8 Jun 2002 16:08:16 -0000       1.22
+++ Playfield.hh        8 Jun 2002 18:39:57 -0000       1.23
@@ -45,7 +45,7 @@
   Server* server;
   Client* client;
   ///Range x_offset2, y_offset2;
-  boost::shared_ptr<ButtonPanel> buttons;
+  ButtonPanel* buttons;
   PinguHolder* pingus;
   PinguInfo* pingu_info;
   World* world;
@@ -105,7 +105,7 @@
 
   /// Members used to communicate between different screen objs
   void set_pingu_info(PinguInfo*);
-  void set_buttons(boost::shared_ptr<ButtonPanel>);
+  void set_buttons(ButtonPanel*);
   void set_server(Server*);
   void set_client(Client*);
 };

Index: SmallMap.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/SmallMap.cc,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- SmallMap.cc 8 Jun 2002 16:08:16 -0000       1.40
+++ SmallMap.cc 8 Jun 2002 18:39:57 -0000       1.41
@@ -156,7 +156,7 @@
 void
 SmallMap::draw()
 {
-  boost::shared_ptr<Playfield> playfield = client->get_playfield();
+  Playfield* playfield = client->get_playfield();
 
   int x_of = playfield->get_x_offset();
   int y_of = playfield->get_y_offset();




reply via email to

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