pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src cheat.cxx,NONE,1.1 cheat.hxx,NONE,1.1


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src cheat.cxx,NONE,1.1 cheat.hxx,NONE,1.1 Makefile.am,1.121,1.122 action_button.cxx,1.20,1.21 action_button.hxx,1.14,1.15 action_holder.cxx,1.8,1.9 action_holder.hxx,1.9,1.10 button_panel.cxx,1.21,1.22 button_panel.hxx,1.14,1.15 client.cxx,1.34,1.35 config.cxx,1.6,1.7 config.hxx,1.6,1.7 globals.cxx,1.4,1.5 globals.hxx,1.10,1.11 goal_manager.cxx,1.3,1.4 option_menu.cxx,1.9,1.10 pingus_main.cxx,1.36,1.37 pingus_menu.cxx,1.9,1.10 plf.cxx,1.11,1.12 surface_button.cxx,1.17,1.18 surface_button.hxx,1.11,1.12
Date: 8 Nov 2002 01:38:30 -0000

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

Modified Files:
        Makefile.am action_button.cxx action_button.hxx 
        action_holder.cxx action_holder.hxx button_panel.cxx 
        button_panel.hxx client.cxx config.cxx config.hxx globals.cxx 
        globals.hxx goal_manager.cxx option_menu.cxx pingus_main.cxx 
        pingus_menu.cxx plf.cxx surface_button.cxx surface_button.hxx 
Added Files:
        cheat.cxx cheat.hxx 
Log Message:
added a bunch of cheats


--- NEW FILE: cheat.cxx ---
//  $Id: cheat.cxx,v 1.1 2002/11/08 01:38:27 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2002 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 <iostream>
#include "pingus_error.hxx"
#include "cheat.hxx"

bool Cheat::unlimited_actions = false;
bool Cheat::no_time_limit     = false;
bool Cheat::all_actions       = false;

void
Cheat::activate(const std::string& cheat)
{
  if (cheat == "unlimited-actions" || cheat == "ua") 
    {
      unlimited_actions = true;
    }
  else if (cheat == "all-actions" || cheat == "aa") 
    {
      all_actions = true;
    }
  else if (cheat == "no-time-limit" || cheat == "nt")
    {
      no_time_limit = true;
    }
  else if (cheat == "help")
    {
      print_help();
    }
  else
    {
      PingusError::raise("Cheat: Unknown cheat '" + cheat + "'");
    }
}

void
Cheat::print_help()
{
  std::cout 
    << "Pingus Cheats\n"
    << "-------------\n"
    << "  unlimited-actions(ua) - the number of available actions is not 
limited\n"
    << "  all-actions(aa)       - all actions are available in all levels\n"
    << "  no-time-limit(nt)     - time limit is disabled everywhere\n"
    << std::endl;
  
  exit(EXIT_SUCCESS);
}

/* EOF */

--- NEW FILE: cheat.hxx ---
//  $Id: cheat.hxx,v 1.1 2002/11/08 01:38:27 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2002 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_CHEAT_HXX
#define HEADER_PINGUS_CHEAT_HXX

#include <string>

/** */
namespace Cheat
{
/** unlimited actions are available */
extern bool unlimited_actions;

/** no timelimit for all levels */
extern bool no_time_limit;

/** all actions are available in all levels */
extern bool all_actions;
  
/** Activate the given cheat */
void activate(const std::string&);

/** Print a list off possible cheats to stdout */
void print_help();
}

#endif

/* EOF */

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/Makefile.am,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- Makefile.am 4 Nov 2002 00:00:05 -0000       1.121
+++ Makefile.am 8 Nov 2002 01:38:27 -0000       1.122
@@ -93,6 +93,8 @@
 button_panel.hxx \
 capture_rectangle.cxx \
 capture_rectangle.hxx \
+cheat.hxx \
+cheat.cxx \
 client.cxx \
 client.hxx \
 col_map.cxx \
@@ -189,14 +191,6 @@
 message_box.hxx \
 multiline_text.cxx \
 multiline_text.hxx \
-multiplayer_client.cxx \
-multiplayer_client.hxx \
-multiplayer_client_child.cxx \
-multiplayer_client_child.hxx \
-multiplayer_config.cxx \
-multiplayer_config.hxx \
-multiplayer_game.cxx \
-multiplayer_game.hxx \
 music_provider.cxx \
 music_provider.hxx \
 my_gettext.hxx \

Index: action_button.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/action_button.cxx,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- action_button.cxx   20 Oct 2002 18:28:48 -0000      1.20
+++ action_button.cxx   8 Nov 2002 01:38:27 -0000       1.21
@@ -22,6 +22,7 @@
 #include <ClanLib/Display/Input/mouse.h>
 
 #include "globals.hxx"
+#include "cheat.hxx"
 #include "pingus_resource.hxx"
 #include "action_button.hxx"
 #include "true_server.hxx"
@@ -30,7 +31,8 @@
 
 using namespace Actions;
 
-ActionButton::ActionButton() {}
+ActionButton::ActionButton(ActionHolder* h)
+: action_holder(h){}
 
 ActionButton::~ActionButton() {}
 
@@ -59,7 +61,6 @@
   */
 
   font   = PingusResource::load_font("Fonts/pingus_small", "fonts");
-  font_h = PingusResource::load_font("Fonts/pingus_small", "fonts");
   font_b = PingusResource::load_font("Fonts/pingus",       "fonts");
 
   surface = PingusResource::load_surface("Pingus/" + action_to_string(name) + 
to_string(owner_id), "pingus");
@@ -94,13 +95,9 @@
   return name;
 }
 
-void
-ActionButton::set_action_holder(ActionHolder* h)
-{
-  action_holder = h;
-}
-
-VerticalActionButton::VerticalActionButton(int x, int y, ActionName name_, int 
owner_id) :
+VerticalActionButton::VerticalActionButton(ActionHolder* h, 
+                                           int x, int y, ActionName name_, int 
owner_id) 
+  : ActionButton(h),
     background (PingusResource::load_surface("buttons/buttonbackground", 
"core")),
     backgroundhl (PingusResource::load_surface("buttons/buttonbackgroundhl", 
"core"))
 {
@@ -126,51 +123,55 @@
 void
 VerticalActionButton::draw (GraphicContext& gc)
 {
-  std::string str;
-  // FIXME: This could need some optimization, throwing strings all
-  // FIXME: around, doesn't look like a good idea. 
-  available = action_holder->get_available(name);
-
-  if (!unlimited_actions)
-    str = to_string(available);
+  UNUSED_ARG(gc);
 
   if (pressed) 
     {
       if (fast_mode) {
-       CL_Display::fill_rect(x_pos, y_pos, x_pos + 60, y_pos + 35,
-                             1.0, 1.0, 1.0, 1.0);
+        CL_Display::fill_rect(x_pos, y_pos, x_pos + 60, y_pos + 35,
+                              1.0, 1.0, 1.0, 1.0);
       } else {
-       //CL_Display::fill_rect(x_pos, y_pos, x_pos + 60, y_pos + 35 ,
-       //1.0, 1.0, 1.0, 0.5);
-       backgroundhl.put_screen(x_pos, y_pos);
+        //CL_Display::fill_rect(x_pos, y_pos, x_pos + 60, y_pos + 35 ,
+        //1.0, 1.0, 1.0, 0.5);
+        backgroundhl.put_screen(x_pos, y_pos);
       }
-      font_h->print_center(x_pos + 46, y_pos + 10, str.c_str ());
     }
   else
     {
       action_c = 0;
 
       if (fast_mode) {
-       // do nothing
+        // do nothing
       } else {
-       background.put_screen (x_pos, y_pos);
+        background.put_screen (x_pos, y_pos);
       }
-      font->print_center(x_pos + 46, y_pos + 10, str.c_str ());
     }
 
+
+  surface.put_screen(x_pos + 20 - surface.get_width ()/2,
+                     y_pos + 17 - surface.get_height()/2,
+                     action_c);
+      
   // print the action name next to the button, when mouse pointer is on
   // the button.
-  if (    action_help 
+  // FIXME: this should use the GUI events, not CL_Mouse
+  if (action_help 
       && CL_Mouse::get_x() > x_pos      && CL_Mouse::get_x() < x_pos + 60
       && CL_Mouse::get_y() < y_pos + 35 && CL_Mouse::get_y() > y_pos) 
-  {
-       font_b->print_left(x_pos + 65, y_pos, action_to_string(name).c_str());
-  }
+    {
+      font_b->print_left(x_pos + 65, y_pos, action_to_string(name).c_str());
+    }
 
-  surface.put_screen(x_pos + 20 - surface.get_width ()/2,
-                    y_pos + 17 - surface.get_height()/2,
-                    action_c);
-  UNUSED_ARG(gc);
+  if (Cheat::unlimited_actions)
+    {
+      // FIXME: insert unlimited surface here
+      font->print_center(x_pos + 46, y_pos + 10, "oo");
+    }
+  else
+    {
+      std::string str = to_string(action_holder->get_available(name));
+      font->print_center(x_pos + 46, y_pos + 10, str.c_str ());
+    }
 }
 
 ArmageddonButton::ArmageddonButton (TrueServer* s, int x, int y)

Index: action_button.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/action_button.hxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- action_button.hxx   4 Oct 2002 16:54:03 -0000       1.14
+++ action_button.hxx   8 Nov 2002 01:38:27 -0000       1.15
@@ -134,12 +134,10 @@
   int x_pos;
   int y_pos;
   CL_Font*    font;
-  CL_Font*    font_h;
   // Added for printing action names next to the button.
   CL_Font*    font_b;
 
   ActionName name;
-  int available;
   bool is_multi_direct;
 
   ActionHolder* action_holder;
@@ -147,7 +145,7 @@
 public:  
   bool pressed;
 
-  ActionButton();
+  ActionButton(ActionHolder*);
   virtual ~ActionButton();
 
   void init(int x, int y, ActionName name_, int owner_id);
@@ -163,8 +161,6 @@
 
   virtual bool   is_at(int x, int y) = 0;
 
-  void set_action_holder(ActionHolder* h);
-  
 private:
   ActionButton (const ActionButton&);
   ActionButton& operator= (const ActionButton&);
@@ -183,7 +179,7 @@
   CL_Surface backgroundhl;
 
 public:
-  VerticalActionButton(int x, int y, ActionName name, int owner_id);
+  VerticalActionButton(ActionHolder* h, int x, int y, ActionName name, int 
owner_id);
   virtual ~VerticalActionButton();
 
   void draw(GraphicContext& gc);

Index: action_holder.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/action_holder.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- action_holder.cxx   3 Nov 2002 13:29:09 -0000       1.8
+++ action_holder.cxx   8 Nov 2002 01:38:27 -0000       1.9
@@ -23,12 +23,13 @@
 
 #include "pingu_action_factory.hxx"
 #include "action_holder.hxx"
+#include "cheat.hxx"
 
 ActionHolder::ActionHolder (PLF* plf)
 {
   std::vector<ActionData> action_data = plf->get_actions();
   
-  if (action_data.size() == 0)
+  if (action_data.size() == 0 || Cheat::all_actions)
     {
       std::cout << "Error: ActionHolder: No actions given in this level! Using 
defaults" << std::endl;
       action_data = default_actions;
@@ -47,6 +48,18 @@
   PinguActionFactory::instance()->delete_actions();
 }
 
+std::vector<ActionName>
+ActionHolder::get_available_actions()
+{
+  std::vector<ActionName> ret;
+
+  for(std::map<ActionName, int>::iterator i= available_actions.begin();
+      i != available_actions.end(); ++i)
+    ret.push_back(i->first);
+  
+  return ret;
+}
+
 void
 ActionHolder::set_actions (ActionName name, int available)
 {
@@ -56,22 +69,30 @@
 void
 ActionHolder::push_action (ActionName name)
 {
-  available_actions[name]++;
+  if (!Cheat::unlimited_actions)
+    available_actions[name]++;
 }
 
 bool
 ActionHolder::pop_action (ActionName name)
 {
-  int& avail = available_actions[name];
-
-  if (avail > 0)
+  if (Cheat::unlimited_actions)
     {
-      --avail;
       return true;
     }
   else
     {
-      return false;    
+      int& avail = available_actions[name];
+
+      if (avail > 0)
+        {
+          --avail;
+          return true;
+        }
+      else
+        {
+          return false;    
+        }
     }
 }
 

Index: action_holder.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/action_holder.hxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- action_holder.hxx   12 Oct 2002 00:24:26 -0000      1.9
+++ action_holder.hxx   8 Nov 2002 01:38:27 -0000       1.10
@@ -44,12 +44,15 @@
    *  called <i>name</i> can be created.
    */
   std::map<ActionName, int> available_actions;
-
+  
 public:
   /** Create an action holder from the number of actions given in a
       PLF file */
   ActionHolder (PLF* plf);
   ~ActionHolder ();
+
+  /** @return a list of available actions in the current level */
+  std::vector<ActionName> get_available_actions();
 
   /** Sets the number of actions, which are available in the pool.
    * @param name the name of the action

Index: button_panel.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/button_panel.cxx,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- button_panel.cxx    3 Nov 2002 13:29:09 -0000       1.21
+++ button_panel.cxx    8 Nov 2002 01:38:27 -0000       1.22
@@ -24,47 +24,46 @@
 #include "button_panel.hxx"
 #include "true_server.hxx"
 #include "plf.hxx"
+#include "client.hxx"
 
 using namespace Actions;
 
 CL_Surface ButtonPanel::button_cap;
 
 struct action_sorter {
-  bool operator() (const ActionData& a, const ActionData& b) {
-    return a.name < b.name;
+  bool operator() (const ActionName& a, const ActionName& b) {
+    return a < b;
   }
 };
 
-ButtonPanel::ButtonPanel(PLF* plf, int arg_x_pos, int arg_y_pos)
-  : armageddon_pressed(false),
+ButtonPanel::ButtonPanel(Client* c, int arg_x_pos, int arg_y_pos)
+  : client(c),
+    server(client->get_server()),
+    armageddon_pressed(false),
     left_pressed(0),
     last_press(0),
     x_pos (arg_x_pos), 
     y_pos (arg_y_pos)
 {
+  ActionHolder* aholder = server->get_action_holder();
 
-  std::vector<ActionData> buttons_data = plf->get_actions();
-
-  if (buttons_data.size() == 0)
-    {
-      std::cout << "Error: ButtonPanel: No actions given in this level! Using 
defaults" << std::endl;
-      buttons_data = default_actions;
-    }
+  std::vector<ActionName> actions = aholder->get_available_actions();
 
   // Sort the action so that they always have the same order in the
   // panel
-  std::sort(buttons_data.begin(), buttons_data.end(), action_sorter());
-
-  y_pos -= (buttons_data.size() * 38)/2 + 70;
+  std::sort(actions.begin(), actions.end(), action_sorter());
 
+  y_pos -= (actions.size() * 38)/2 + 70;
 
-  for(std::vector<ActionData>::size_type i = 0; i < buttons_data.size(); ++i)
+  for(std::vector<ActionName>::iterator i = actions.begin();
+      i != actions.end(); ++i)
     {
-      a_buttons.push_back(new VerticalActionButton (x_pos, i * 38 + y_pos,
-                                                   buttons_data[i].name,
+      a_buttons.push_back(new VerticalActionButton (aholder,
+                                                    x_pos, (i - 
actions.begin()) * 38 + y_pos,
+                                                   *i,
                                                    0)); 
//FIXMEcontroller->get_owner ()));
     }
-  
+
   pressed_button = 0;
 }
 
@@ -112,23 +111,6 @@
 
       a_buttons[i]->draw(gc);
     }
-}
-
-void
-ButtonPanel::set_server(TrueServer* s)
-{
-  server = s;
-
-  for(AButtonIter button = a_buttons.begin(); button != a_buttons.end(); 
++button) 
-    {
-      (*button)->set_action_holder(server->get_action_holder());
-    }
-}
-
-void
-ButtonPanel::set_client(Client* c)
-{
-  client = c;
 }
 
 void

Index: button_panel.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/button_panel.hxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- button_panel.hxx    29 Oct 2002 12:47:55 -0000      1.14
+++ button_panel.hxx    8 Nov 2002 01:38:27 -0000       1.15
@@ -33,13 +33,13 @@
 private:
   friend class ClientEvent;
 
+  Client* client;
+  TrueServer* server;
+
   std::vector<ActionButton*> a_buttons;
   typedef std::vector<ActionButton*>::iterator AButtonIter;
   int pressed_button;
 
-  TrueServer* server;
-  Client* client;
-
   int  armageddon_pressed;
   AnimCounter arma_counter;
 
@@ -49,7 +49,7 @@
 
   int x_pos, y_pos;
 public:
-  ButtonPanel(PLF* plf, int arg_x_pos, int arg_y_pos);
+  ButtonPanel(Client* c, int arg_x_pos, int arg_y_pos);
   virtual ~ButtonPanel();
 
   void on_primary_button_press(int x, int y);
@@ -60,8 +60,6 @@
   ActionName get_action_name();
   void   update(float delta);
   void   draw(GraphicContext& gc);
-  void   set_server(TrueServer*);
-  void   set_client(Client*);
 
   /// Set n'th action
   void   set_button(int);

Index: client.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/client.cxx,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- client.cxx  30 Oct 2002 09:34:22 -0000      1.34
+++ client.cxx  8 Nov 2002 01:38:27 -0000       1.35
@@ -69,15 +69,14 @@
                                                   
PingusResource::get("game")));
 
   // These object will get deleted by the gui_manager
-  button_panel = new ButtonPanel(server->get_plf (), 2, 
CL_Display::get_height()/2);
+  button_panel = new ButtonPanel(this, 2, CL_Display::get_height()/2);
   playfield    = new Playfield(this, server->get_plf (), server->get_world());
   hurry_up     = new HurryUp();
   pcounter     = new PingusCounter(server);  
   small_map    = new SmallMap();
   time_display = new TimeDisplay();
 
-  button_panel->set_client(this);
-  button_panel->set_server(server);
+  // FIXME: add all this to the constructor
   hurry_up->set_client(this);
   small_map->set_client(this);
   time_display->set_server(server);

Index: config.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/config.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- config.cxx  14 Oct 2002 11:15:15 -0000      1.6
+++ config.cxx  8 Nov 2002 01:38:27 -0000       1.7
@@ -28,6 +28,8 @@
 /* Headers needed for i18n / gettext */
 #include <clocale>
 #include <config.h>
+
+#include "cheat.hxx"
 #include "my_gettext.hxx"
 
 struct ConfigParserEOF {};
@@ -332,7 +334,7 @@
     }
   else if (valueid == "unlimited_actions")
     {
-      unlimited_actions = str_to_bool(value);
+      Cheat::unlimited_actions = str_to_bool(value);
     }
   else if (valueid == "quick_play")
     {

Index: config.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/config.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- config.hxx  27 Sep 2002 11:26:43 -0000      1.6
+++ config.hxx  8 Nov 2002 01:38:27 -0000       1.7
@@ -24,6 +24,7 @@
 #include <string>
 #include <fstream>
 
+/** FIXME: Rewrite or replace me */
 class ConfigParser
 {
 private:

Index: globals.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/globals.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- globals.cxx 26 Oct 2002 17:29:02 -0000      1.4
+++ globals.cxx 8 Nov 2002 01:38:27 -0000       1.5
@@ -32,7 +32,6 @@
 bool        fs_preload                      = false;  
 bool        fast_mode                       = false;
 bool        previews_enabled                = true;
-bool        unlimited_actions               = false;
 bool        quick_play                      = false;
 bool        maintainer_mode                 = false;
 std::string demo_file;

Index: globals.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/globals.hxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- globals.hxx 12 Oct 2002 23:43:20 -0000      1.10
+++ globals.hxx 8 Nov 2002 01:38:27 -0000       1.11
@@ -40,7 +40,6 @@
 extern bool        fs_preload;                      ///< --fs-preload
 extern bool        fast_mode;                       ///< --fast
 extern bool        previews_enabled;                ///< --disable-previews
-extern bool        unlimited_actions;               ///< --enable-uactions
 extern bool        quick_play;                      ///< -q, --quick_play
 extern bool        maintainer_mode;                 ///< --maintainer-mode
 extern bool        start_editor;                    ///<

Index: goal_manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/goal_manager.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- goal_manager.cxx    13 Oct 2002 13:34:40 -0000      1.3
+++ goal_manager.cxx    8 Nov 2002 01:38:27 -0000       1.4
@@ -38,7 +38,7 @@
   else if (exit_time == 0)
     {
       // we are finished, now wait a few second so that everybody can
-      // the the particles, etc.
+      // see the particles, etc.
       std::cout << "XXXX goal reached: " << goal << std::endl;
       exit_time = server->get_time() + 125;
       return false;

Index: option_menu.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/option_menu.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- option_menu.cxx     3 Oct 2002 12:33:08 -0000       1.9
+++ option_menu.cxx     8 Nov 2002 01:38:27 -0000       1.10
@@ -30,6 +30,7 @@
 #include "string_converter.hxx"
 #include "pingus_menu_manager.hxx"
 #include "display.hxx"
+#include "cheat.hxx"
 
 /* Headers needed for i18n / gettext */
 #include <clocale>
@@ -277,7 +278,7 @@
 
   // Bool options
   add_entry(_("Gimmicks"),  &gimmicks_enabled);
-  add_entry(_("Unlimited Actions"),  &unlimited_actions);
+  add_entry(_("Unlimited Actions"),  &Cheat::unlimited_actions);
   add_entry(_("Print fps"), &print_fps);
   //  add_entry("Debug actions", &debug_actions);  
   add_entry(_("Cursor enabled"), &cursor_enabled);  

Index: pingus_main.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_main.cxx,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- pingus_main.cxx     5 Nov 2002 03:02:48 -0000       1.36
+++ pingus_main.cxx     8 Nov 2002 01:38:27 -0000       1.37
@@ -87,6 +87,7 @@
 #include "pingu_action_factory.hxx"
 #include "credits.hxx"
 #include "sound.hxx"
+#include "cheat.hxx"
 
 using EditorNS::Editor;
 
@@ -226,6 +227,7 @@
       {"min-cpu-usage",     no_argument,       0, 153},
       {"min-frame-skip",    required_argument, 0, 154},
       {"max-frame-skip",    required_argument, 0, 155},
+      {"cheat",             required_argument, 0, 156},
 #ifdef HAVE_LIBCLANGL
       {"use-opengl",        no_argument,       0, 'G'},
 #endif
@@ -234,7 +236,6 @@
       {"fast",            no_argument,       0, 132},
       {"disable-previews",no_argument,       0, 133}, 
       {"maintainer-mode", no_argument,       0, 134},
-      {"enable-uactions", no_argument,       0, 136},
       {"disable-auto-scrolling",   no_argument,       0, 137},
 
 #ifdef HAVE_LIBSDL_MIXER
@@ -409,10 +410,6 @@
       maintainer_mode = true;
       break;
 
-    case 136:
-      unlimited_actions = true;
-      break;
-
     case 137:
       auto_scrolling = false;
       break;
@@ -533,12 +530,8 @@
       sscanf(optarg, "%d", &max_frame_skip);
       break;
 
-    case 156:
-      action_help = false;
-      break;
-
-    case 157:
-      action_help = true;
+    case 156: // Cheats
+      Cheat::activate(optarg);
       break;
 
     default:

Index: pingus_menu.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_menu.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- pingus_menu.cxx     19 Sep 2002 13:30:08 -0000      1.9
+++ pingus_menu.cxx     8 Nov 2002 01:38:27 -0000       1.10
@@ -46,7 +46,7 @@
       gui_manager->add(new OptionsButton(this));
       gui_manager->add(new CreditButton(this));
       gui_manager->add(new QuitButton(this));
-      gui_manager->add(new MultiplayerButton(this));
+      //gui_manager->add(new MultiplayerButton(this));
       gui_manager->add(new ThemeButton(this));
       gui_manager->add(new StoryButton(this));
       gui_manager->add(editor_button);

Index: plf.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/plf.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- plf.cxx     4 Oct 2002 16:54:04 -0000       1.11
+++ plf.cxx     8 Nov 2002 01:38:27 -0000       1.12
@@ -22,6 +22,7 @@
 #include "globals.hxx"
 #include "system.hxx"
 #include "pingus_error.hxx"
+#include "cheat.hxx"
 
 PLF::PLF()
 {
@@ -111,7 +112,13 @@
 int
 PLF::get_time(void)
 {
-  return max_time;
+  // FIXME: Cheats shouldn't be handled in the PLF, but instead in the
+  // client code, but since we havn't any holder for the time in the
+  // client, we quick&dirty place it here.
+  if (Cheat::no_time_limit)
+    return -1;
+  else
+    return max_time;
 }
 
 int

Index: surface_button.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/surface_button.cxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- surface_button.cxx  3 Nov 2002 23:31:35 -0000       1.17
+++ surface_button.cxx  8 Nov 2002 01:38:27 -0000       1.18
@@ -392,6 +392,7 @@
   theme_selector.display();
 }
 
+#if 0
 MultiplayerButton::MultiplayerButton (PingusMenu* menu_)
   : menu(menu_)
 {
@@ -415,5 +416,5 @@
 {
   multiplayer_config.display ();
 }
-
+#endif
 /* EOF */

Index: surface_button.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/surface_button.hxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- surface_button.hxx  14 Oct 2002 11:15:15 -0000      1.11
+++ surface_button.hxx  8 Nov 2002 01:38:27 -0000       1.12
@@ -23,7 +23,6 @@
 #include <string>
 #include <ClanLib/Display/Display/surface.h>
 
-#include "multiplayer_config.hxx"
 #include "gui/component.hxx"
 
 class CL_Font;
@@ -169,6 +168,7 @@
   ThemeButton& operator= (const ThemeButton&);
 };
 
+#if 0
 class MultiplayerButton : public SurfaceButton
 {
 private:
@@ -183,6 +183,7 @@
   MultiplayerButton (const MultiplayerButton&);
   MultiplayerButton& operator= (const MultiplayerButton&);
 };
+#endif 
 
 #endif
 





reply via email to

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