pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3587 - in trunk/pingus/src: . components


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3587 - in trunk/pingus/src: . components
Date: Mon, 30 Jun 2008 01:10:15 +0200

Author: grumbel
Date: 2008-06-30 01:10:11 +0200 (Mon, 30 Jun 2008)
New Revision: 3587

Removed:
   trunk/pingus/src/true_server.cpp
   trunk/pingus/src/true_server.hpp
Modified:
   trunk/pingus/src/client.cpp
   trunk/pingus/src/client.hpp
   trunk/pingus/src/components/action_button.cpp
   trunk/pingus/src/components/action_button.hpp
   trunk/pingus/src/components/button_panel.cpp
   trunk/pingus/src/components/button_panel.hpp
   trunk/pingus/src/components/pingus_counter.cpp
   trunk/pingus/src/components/playfield.cpp
   trunk/pingus/src/components/smallmap.cpp
   trunk/pingus/src/components/time_display.cpp
   trunk/pingus/src/demo_session.cpp
   trunk/pingus/src/game_session.cpp
   trunk/pingus/src/game_session.hpp
   trunk/pingus/src/server.cpp
   trunk/pingus/src/server.hpp
Log:
Merged TrueServer into Server

Modified: trunk/pingus/src/client.cpp
===================================================================
--- trunk/pingus/src/client.cpp 2008-06-29 21:48:11 UTC (rev 3586)
+++ trunk/pingus/src/client.cpp 2008-06-29 23:10:11 UTC (rev 3587)
@@ -21,6 +21,7 @@
 #include "globals.hpp"
 #include "components/playfield.hpp"
 #include "timer.hpp"
+#include "server.hpp"
 #include "resource.hpp"
 #include "sound/sound.hpp"
 #include "components/time_display.hpp"
@@ -28,13 +29,12 @@
 #include "components/smallmap.hpp"
 #include "display/cursor.hpp"
 #include "display/display.hpp"
-#include "true_server.hpp"
 #include "components/button_panel.hpp"
 #include "world.hpp"
 #include "math.hpp"
 #include "gui/gui_manager.hpp"
 
-Client::Client (TrueServer * s)
+Client::Client(Server * s)
   : server       (s),
     skip_frame   (0),
     do_replay    (false),

Modified: trunk/pingus/src/client.hpp
===================================================================
--- trunk/pingus/src/client.hpp 2008-06-29 21:48:11 UTC (rev 3586)
+++ trunk/pingus/src/client.hpp 2008-06-29 23:10:11 UTC (rev 3587)
@@ -40,7 +40,7 @@
 class HurryUp;
 class PingusCounter;
 class Playfield;
-class TrueServer;
+class Server;
 class SmallMap;
 class TimeDisplay;
 
@@ -48,7 +48,7 @@
 class Client : public GUIScreen
 {
 private:
-  TrueServer* server;
+  Server* server;
 
   int  skip_frame;
   bool do_replay;
@@ -63,10 +63,10 @@
   bool enabled;
 
 public:
-  Client(TrueServer* s);
+  Client(Server* s);
   virtual ~Client();
 
-  TrueServer* get_server() { return server; }
+  Server* get_server() { return server; }
   Playfield* get_playfield() { return playfield; }
 
   bool replay();

Modified: trunk/pingus/src/components/action_button.cpp
===================================================================
--- trunk/pingus/src/components/action_button.cpp       2008-06-29 21:48:11 UTC 
(rev 3586)
+++ trunk/pingus/src/components/action_button.cpp       2008-06-29 23:10:11 UTC 
(rev 3587)
@@ -21,7 +21,7 @@
 #include "../cheat.hpp"
 #include "../resource.hpp"
 #include "action_button.hpp"
-#include "../true_server.hpp"
+#include "../server.hpp"
 #include "../world.hpp"
 #include "../display/drawing_context.hpp"
 #include "../display/display.hpp"
@@ -150,7 +150,7 @@
     }
 }
 
-ArmageddonButton::ArmageddonButton (TrueServer* s, int x, int y)
+ArmageddonButton::ArmageddonButton(Server* s, int x, int y)
   : server (s),
     x_pos (x),
     y_pos (y),
@@ -230,7 +230,7 @@
   UNUSED_ARG(y);
 }
 
-ForwardButton::ForwardButton (TrueServer* s, int x, int y)
+ForwardButton::ForwardButton(Server* s, int x, int y)
   : server (s),
     x_pos (x), y_pos (y),
     background  (Resource::load_sprite("core/buttons/hbuttonbgb")),
@@ -278,7 +278,7 @@
   UNUSED_ARG(y);
 }
 
-PauseButton::PauseButton (TrueServer* s, int x, int y)
+PauseButton::PauseButton(Server* s, int x, int y)
   : server (s),
     x_pos(x), y_pos(y),
     background  (Resource::load_sprite("core/buttons/hbuttonbgb")),

Modified: trunk/pingus/src/components/action_button.hpp
===================================================================
--- trunk/pingus/src/components/action_button.hpp       2008-06-29 21:48:11 UTC 
(rev 3586)
+++ trunk/pingus/src/components/action_button.hpp       2008-06-29 23:10:11 UTC 
(rev 3587)
@@ -26,8 +26,7 @@
 #include "../state_sprite.hpp"
 #include "../gui/component.hpp"
 
-
-class TrueServer;
+class Server;
 class ActionHolder;
 class Vector;
 
@@ -38,7 +37,7 @@
 class ArmageddonButton : public GUI::Component
 {
 private:
-  TrueServer* server;
+  Server* server;
   int   x_pos;
   int   y_pos;
   bool  pressed;
@@ -49,7 +48,7 @@
 
   friend class ButtonPanel;
 public:
-  ArmageddonButton(TrueServer*, int x, int y);
+  ArmageddonButton(Server*, int x, int y);
   virtual ~ArmageddonButton();
 
   void draw(DrawingContext& gc);
@@ -71,7 +70,7 @@
 class ForwardButton : public GUI::Component
 {
 private:
-  TrueServer* server;
+  Server* server;
   int x_pos;
   int y_pos;
   Sprite surface;
@@ -79,7 +78,7 @@
   Sprite backgroundhl;
   friend class ButtonPanel;
 public:
-  ForwardButton(TrueServer*, int x, int y);
+  ForwardButton(Server*, int x, int y);
   virtual ~ForwardButton();
 
   void draw(DrawingContext& gc);
@@ -100,7 +99,7 @@
 class PauseButton : public GUI::Component
 {
 private:
-  TrueServer* server;
+  Server* server;
   int x_pos;
   int y_pos;
   Sprite surface;
@@ -108,7 +107,7 @@
   Sprite backgroundhl;
   friend class ButtonPanel;
 public:
-  PauseButton(TrueServer*, int x, int y);
+  PauseButton(Server*, int x, int y);
   virtual ~PauseButton();
 
   void draw(DrawingContext& gc);

Modified: trunk/pingus/src/components/button_panel.cpp
===================================================================
--- trunk/pingus/src/components/button_panel.cpp        2008-06-29 21:48:11 UTC 
(rev 3586)
+++ trunk/pingus/src/components/button_panel.cpp        2008-06-29 23:10:11 UTC 
(rev 3587)
@@ -20,7 +20,7 @@
 #include <iostream>
 #include <algorithm>
 #include "../globals.hpp"
-#include "../true_server.hpp"
+#include "../server.hpp"
 #include "../client.hpp"
 #include "button_panel.hpp"
 

Modified: trunk/pingus/src/components/button_panel.hpp
===================================================================
--- trunk/pingus/src/components/button_panel.hpp        2008-06-29 21:48:11 UTC 
(rev 3586)
+++ trunk/pingus/src/components/button_panel.hpp        2008-06-29 23:10:11 UTC 
(rev 3587)
@@ -33,7 +33,7 @@
   friend class ClientEvent;
 
   Client* client;
-  TrueServer* server;
+  Server* server;
 
   std::vector<ActionButton*> a_buttons;
   typedef std::vector<ActionButton*>::iterator AButtonIter;

Modified: trunk/pingus/src/components/pingus_counter.cpp
===================================================================
--- trunk/pingus/src/components/pingus_counter.cpp      2008-06-29 21:48:11 UTC 
(rev 3586)
+++ trunk/pingus/src/components/pingus_counter.cpp      2008-06-29 23:10:11 UTC 
(rev 3587)
@@ -23,7 +23,7 @@
 #include "../resource.hpp"
 #include "../world.hpp"
 #include "../pingu_holder.hpp"
-#include "../true_server.hpp"
+#include "../server.hpp"
 #include "../globals.hpp"
 #include "../fonts.hpp"
 #include "pingus_counter.hpp"

Modified: trunk/pingus/src/components/playfield.cpp
===================================================================
--- trunk/pingus/src/components/playfield.cpp   2008-06-29 21:48:11 UTC (rev 
3586)
+++ trunk/pingus/src/components/playfield.cpp   2008-06-29 23:10:11 UTC (rev 
3587)
@@ -25,7 +25,7 @@
 #include "../display/scene_context.hpp"
 #include "../world.hpp"
 #include "../server.hpp"
-#include "../true_server.hpp"
+#include "../server.hpp"
 #include "../pingu.hpp"
 #include "../display/display.hpp"
 #include "button_panel.hpp"

Modified: trunk/pingus/src/components/smallmap.cpp
===================================================================
--- trunk/pingus/src/components/smallmap.cpp    2008-06-29 21:48:11 UTC (rev 
3586)
+++ trunk/pingus/src/components/smallmap.cpp    2008-06-29 23:10:11 UTC (rev 
3587)
@@ -23,7 +23,7 @@
 #include "../world.hpp"
 #include "../resource.hpp"
 #include "../col_map.hpp"
-#include "../true_server.hpp"
+#include "../server.hpp"
 #include "../smallmap_image.hpp"
 #include "../pingu.hpp"
 #include "../math.hpp"

Modified: trunk/pingus/src/components/time_display.cpp
===================================================================
--- trunk/pingus/src/components/time_display.cpp        2008-06-29 21:48:11 UTC 
(rev 3586)
+++ trunk/pingus/src/components/time_display.cpp        2008-06-29 23:10:11 UTC 
(rev 3587)
@@ -24,7 +24,7 @@
 #include "../globals.hpp"
 #include "../resource.hpp"
 #include "../world.hpp"
-#include "../true_server.hpp"
+#include "../server.hpp"
 #include "../client.hpp"
 #include "../game_time.hpp"
 #include "../string_util.hpp"

Modified: trunk/pingus/src/demo_session.cpp
===================================================================
--- trunk/pingus/src/demo_session.cpp   2008-06-29 21:48:11 UTC (rev 3586)
+++ trunk/pingus/src/demo_session.cpp   2008-06-29 23:10:11 UTC (rev 3587)
@@ -21,7 +21,7 @@
 #include <ClanLib/Display/keys.h>
 #include "math.hpp"
 #include "xml_pdf.hpp"
-#include "true_server.hpp"
+#include "server.hpp"
 #include "world.hpp"
 #include "demo_player.hpp"
 #include "components/pingus_counter.hpp"
@@ -36,7 +36,7 @@
   pdf    = new XMLPDF(filename);
 
   // Create server
-  server      = new TrueServer(pdf->get_plf());
+  server      = new Server(pdf->get_plf());
   demo_player = new DemoPlayer(server, pdf);
 
   // Create GUI

Modified: trunk/pingus/src/game_session.cpp
===================================================================
--- trunk/pingus/src/game_session.cpp   2008-06-29 21:48:11 UTC (rev 3586)
+++ trunk/pingus/src/game_session.cpp   2008-06-29 23:10:11 UTC (rev 3587)
@@ -20,7 +20,7 @@
 #include <iostream>
 #include "screen/screen_manager.hpp"
 #include "client.hpp"
-#include "true_server.hpp"
+#include "server.hpp"
 #include "game_session.hpp"
 #include "game_session_result.hpp"
 #include "timer.hpp"
@@ -41,7 +41,7 @@
   plf_timer.stop();
 
   Timer server_timer("GameSession server creation");
-  server = new TrueServer(plf);
+  server = new Server(plf);
   server_timer.stop();
 
   Timer client_timer("GameSession client creation");

Modified: trunk/pingus/src/game_session.hpp
===================================================================
--- trunk/pingus/src/game_session.hpp   2008-06-29 21:48:11 UTC (rev 3586)
+++ trunk/pingus/src/game_session.hpp   2008-06-29 23:10:11 UTC (rev 3587)
@@ -26,7 +26,7 @@
 
 
 class Client;
-class TrueServer;
+class Server;
 class PingusGameSessionResult;
 class DemoPlayer;
 
@@ -41,7 +41,7 @@
   bool show_result_screen;
 
   /// The server
-  TrueServer* server;
+  Server* server;
 
   /// The client
   Client* client;

Modified: trunk/pingus/src/server.cpp
===================================================================
--- trunk/pingus/src/server.cpp 2008-06-29 21:48:11 UTC (rev 3586)
+++ trunk/pingus/src/server.cpp 2008-06-29 23:10:11 UTC (rev 3587)
@@ -33,7 +33,9 @@
     world(new World (plf)),
     action_holder (plf),
     goal_manager(new GoalManager(this)),
-    demo_recorder(0)
+    demo_recorder(0),
+    fast_forward(false),
+    pause(false)
 {
   if (enable_demo_recording)
     demo_recorder = new DemoRecorder(this);
@@ -56,8 +58,24 @@
 void
 Server::update()
 {
-  world->update();
-  goal_manager->update();
+  if (fast_forward && !pause)
+    {
+      // To let the game run faster we just update it multiple
+      // times
+      for (int i = 0; i < 4; ++i)
+       {
+          world->update();
+          goal_manager->update();
+       }
+    }
+  else
+    {
+      if (!pause)
+        {
+          world->update();
+          goal_manager->update();
+        }
+    }
 }
 
 void
@@ -104,5 +122,35 @@
   return get_world()->get_game_time()->get_ticks();
 }
 
+void
+Server::set_fast_forward(bool value)
+{
+  fast_forward = value;
+}
 
+bool
+Server::get_fast_forward()
+{
+  return fast_forward;
+}
+
+void
+Server::set_pause(bool value)
+{
+  pause = value;
+}
+
+bool
+Server::get_pause()
+{
+  return pause;
+}
+
+void
+Server::set_finished ()
+{
+  goal_manager->set_abort_goal();
+  set_pause(false);
+}
+
 /* EOF */

Modified: trunk/pingus/src/server.hpp
===================================================================
--- trunk/pingus/src/server.hpp 2008-06-29 21:48:11 UTC (rev 3586)
+++ trunk/pingus/src/server.hpp 2008-06-29 23:10:11 UTC (rev 3587)
@@ -44,11 +44,14 @@
 
   DemoRecorder* demo_recorder;
 
+  bool fast_forward;
+  bool pause;
+
 public:
   Server(const PingusLevel& arg_plf);
-  virtual ~Server();
+  ~Server();
 
-  virtual void update();
+  void update();
 
   PingusLevel get_plf () { return plf; }
 
@@ -63,12 +66,18 @@
 
   /** set the server into the finshed state, this is used when you
       press ESCAPE inside a game */
-  virtual void set_finished() =0;
+  void set_finished();
 
   /* Event handling stuff */
   void send_armageddon_event();
   void send_pingu_action_event(Pingu* pingu, Actions::ActionName action);
 
+  void set_fast_forward(bool value);
+  bool get_fast_forward();
+
+  void set_pause(bool);
+  bool get_pause();
+
 private:
   Server (const Server&);
   Server& operator= (const Server&);

Deleted: trunk/pingus/src/true_server.cpp
===================================================================
--- trunk/pingus/src/true_server.cpp    2008-06-29 21:48:11 UTC (rev 3586)
+++ trunk/pingus/src/true_server.cpp    2008-06-29 23:10:11 UTC (rev 3587)
@@ -1,86 +0,0 @@
-//  $Id$
-//
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 1999 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 2
-//  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, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#include "goal_manager.hpp"
-#include "true_server.hpp"
-
-
-TrueServer::TrueServer(const PingusLevel& arg_plf)
-  : Server(arg_plf)
-{
-  fast_forward = false;
-  pause = false;
-}
-
-TrueServer::~TrueServer()
-{
-}
-
-void
-TrueServer::update()
-{
-  if (fast_forward && !pause)
-    {
-      // To let the game run faster we just update it multiple
-      // times
-      for (int i = 0; i < 4; ++i)
-       {
-          Server::update();
-       }
-    }
-  else
-    {
-      if (!pause)
-        Server::update();
-    }
-}
-
-void
-TrueServer::set_fast_forward(bool value)
-{
-  fast_forward = value;
-}
-
-bool
-TrueServer::get_fast_forward()
-{
-  return fast_forward;
-}
-
-void
-TrueServer::set_pause(bool value)
-{
-  pause = value;
-}
-
-bool
-TrueServer::get_pause()
-{
-  return pause;
-}
-
-void
-TrueServer::set_finished ()
-{
-  goal_manager->set_abort_goal();
-  set_pause(false);
-}
-
-
-/* EOF */

Deleted: trunk/pingus/src/true_server.hpp
===================================================================
--- trunk/pingus/src/true_server.hpp    2008-06-29 21:48:11 UTC (rev 3586)
+++ trunk/pingus/src/true_server.hpp    2008-06-29 23:10:11 UTC (rev 3587)
@@ -1,59 +0,0 @@
-//  $Id$
-//
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 1999 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 2
-//  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, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#ifndef HEADER_PINGUS_TRUE_SERVER_HPP
-#define HEADER_PINGUS_TRUE_SERVER_HPP
-
-#include "pingus_level.hpp"
-#include "server.hpp"
-
-
-/** FIXME: This whole Server/Client concept is screwed and the
-    TrueServer/Server thing even more... */
-class TrueServer : public Server
-{
-private:
-  bool fast_forward;
-  bool pause;
-
-public:
-  TrueServer(const PingusLevel& plf);
-  virtual ~TrueServer();
-
-  void update();
-
-  void set_fast_forward(bool value);
-  bool get_fast_forward();
-
-  void set_pause(bool);
-  bool get_pause();
-
-  /** set the server into the finshed state, this is used when you
-      press ESCAPE inside a game */
-  void set_finished();
-
-private:
-  TrueServer (const TrueServer&);
-  TrueServer& operator= (const TrueServer&);
-};
-
-
-#endif
-
-/* EOF */





reply via email to

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