[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src pingu.cxx,1.35,1.36 pingu_action.cxx,
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src pingu.cxx,1.35,1.36 pingu_action.cxx,1.8,1.9 pingu_action.hxx,1.18,1.19 pingu_action_factory.cxx,1.8,1.9 pingu_action_factory.hxx,1.7,1.8 |
Date: |
13 Oct 2002 16:40:01 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv32210
Modified Files:
pingu.cxx pingu_action.cxx pingu_action.hxx
pingu_action_factory.cxx pingu_action_factory.hxx
Log Message:
Pingu* is now a constructor parameter of a PinguAction, set_pingu() is no
longer necesarry
Index: pingu.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu.cxx,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- pingu.cxx 12 Oct 2002 00:49:10 -0000 1.35
+++ pingu.cxx 13 Oct 2002 16:39:55 -0000 1.36
@@ -55,8 +55,7 @@
// Initialisize the action, after this step the action ptr will
// always be valid in the pingu class
- action = PinguActionFactory::instance()->create(Faller);
- action->set_pingu(this);
+ action = PinguActionFactory::instance()->create(this, Faller);
}
Pingu::~Pingu ()
@@ -219,13 +218,13 @@
bool
Pingu::request_set_action (ActionName action_name)
{
- return request_set_action (PinguActionFactory::instance ()->create
(action_name));
+ return request_set_action (PinguActionFactory::instance ()->create (this,
action_name));
}
void
Pingu::set_action (ActionName action_name)
{
- set_action(PinguActionFactory::instance()->create(action_name));
+ set_action(PinguActionFactory::instance()->create(this, action_name));
}
// Sets an action without any checking
@@ -237,7 +236,6 @@
previous_action = action->get_type();
action = act;
- action->set_pingu(this);
}
bool
Index: pingu_action.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_action.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- pingu_action.cxx 16 Sep 2002 20:31:09 -0000 1.8
+++ pingu_action.cxx 13 Oct 2002 16:39:58 -0000 1.9
@@ -27,20 +27,13 @@
// Initialise class static.
const int PinguAction::pingu_height = 26;
-PinguAction::PinguAction () : pingu (0)
+PinguAction::PinguAction (Pingu* p)
+ : pingu (p)
{
}
PinguAction::~PinguAction ()
{
-}
-
-void
-PinguAction::set_pingu (Pingu* pingu_data)
-{
- pingu = pingu_data;
- assert(pingu);
- init();
}
// Checks if the pingu action needs to catch another pingu (needed for
Index: pingu_action.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_action.hxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- pingu_action.hxx 12 Oct 2002 00:49:10 -0000 1.18
+++ pingu_action.hxx 13 Oct 2002 16:39:58 -0000 1.19
@@ -48,8 +48,7 @@
static const int pingu_height;
public:
-
- PinguAction();
+ PinguAction(Pingu* p);
virtual ~PinguAction();
/// Gives the PinguAction class access to the data of the Pingu.
@@ -67,11 +66,6 @@
/** Checks if this action allows to be overwritten with the given new action
*/
virtual bool change_allowed (Actions::ActionName) { return true; }
- /** Used to load all data, which is needed by the action, its
- seperated and called in set_pingu(), because some data will be
- only valid if set_pingu() is called. */
- virtual void init (void) {};
-
/// The "AI" of the pingu.
virtual void update () = 0;
Index: pingu_action_factory.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_action_factory.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- pingu_action_factory.cxx 25 Aug 2002 09:08:48 -0000 1.8
+++ pingu_action_factory.cxx 13 Oct 2002 16:39:59 -0000 1.9
@@ -94,7 +94,7 @@
}
PinguAction*
-PinguActionFactory::create (ActionName id)
+PinguActionFactory::create (Pingu* pingu, ActionName id)
{
std::map<ActionName, PinguActionAbstractFactory*>::iterator it =
factories.find(id);
@@ -102,7 +102,7 @@
PingusError::raise("PinguActionFactory: Invalid id: " + id);
else
{
- PinguAction* action = it->second->create ();
+ PinguAction* action = it->second->create (pingu);
all_actions.push_back (action);
return action;
}
Index: pingu_action_factory.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_action_factory.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- pingu_action_factory.hxx 27 Sep 2002 11:26:44 -0000 1.7
+++ pingu_action_factory.hxx 13 Oct 2002 16:39:59 -0000 1.8
@@ -49,7 +49,7 @@
void delete_actions ();
/** Allocate the given action */
- PinguAction* create (Actions::ActionName id);
+ PinguAction* create (Pingu* p, Actions::ActionName id);
private:
PinguActionFactory (const PinguActionFactory&);
@@ -63,7 +63,7 @@
PinguActionFactory::instance ()-> register_factory (id, this);
}
- virtual PinguAction* create () =0;
+ virtual PinguAction* create (Pingu* p) =0;
private:
PinguActionAbstractFactory (const PinguActionAbstractFactory&);
@@ -79,8 +79,8 @@
{
}
- PinguAction* create () {
- return new T ();
+ PinguAction* create (Pingu* p) {
+ return new T (p);
}
private:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src pingu.cxx,1.35,1.36 pingu_action.cxx,1.8,1.9 pingu_action.hxx,1.18,1.19 pingu_action_factory.cxx,1.8,1.9 pingu_action_factory.hxx,1.7,1.8,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldmap path_drawable.cxx,NONE,1.1 path_drawable.hxx,NONE,1.1 Makefile.am,1.8,1.9 level_dot.cxx,1.2,1.3 level_dot.hxx,1.2,1.3 path_graph.cxx,1.4,1.5
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/actions angel.cxx,1.13,1.14 angel.hxx,1.12,1.13 basher.cxx,1.20,1.21 basher.hxx,1.13,1.14 blocker.cxx,1.13,1.14 blocker.hxx,1.12,1.13 boarder.cxx,1.11,1.12 boarder.hxx,1.11,1.12 bomber.cxx,1.19,1.20 bomber.hxx,1.14,1.15 bridger.cxx,1.22,1.23 bridger.hxx,1.15,1.16 climber.cxx,1.16,1.17 climber.hxx,1.11,1.12 digger.cxx,1.16,1.17 digger.hxx,1.11,1.12 drown.cxx,1.10,1.11 drown.hxx,1.10,1.11 exiter.cxx,1.10,1.11 exiter.hxx,1.10,1.11 faller.cxx,1.28,1.29 faller.hxx,1.15,1.16 floater.cxx,1.19,1.20 floater.hxx,1.12,1.13 jumper.cxx,1.15,1.16 jumper.hxx,1.10,1.11 laser_kill.cxx,1.11,1.12 laser_kill.hxx,1.11,1.12 miner.cxx,1.14,1.15 miner.hxx,1.10,1.11 rocket_launcher.cxx,1.10,1.11 rocket_launcher.hxx,1.10,1.11 slider.cxx,1.14,1.15 slider.hxx,1.10,1.11 smashed.cxx,1.10,1.11 smashed.hxx,1.11,1.12 splashed.cxx,1.10,1.11 splashed.hxx,1.11,1.12 superman.cxx,1.8,1.9 superman.hxx,1.11,1.12 teleported.cxx,1.9,1.10 teleported.hxx,1.10,1.11 waiter.cxx,1.10,1.11 waiter.hxx,1.10,1.11 walker.cxx,1.27,1.28 walker.hxx,1.10,1.11
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldmap path_drawable.cxx,NONE,1.1 path_drawable.hxx,NONE,1.1 Makefile.am,1.8,1.9 level_dot.cxx,1.2,1.3 level_dot.hxx,1.2,1.3 path_graph.cxx,1.4,1.5
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/actions angel.cxx,1.13,1.14 angel.hxx,1.12,1.13 basher.cxx,1.20,1.21 basher.hxx,1.13,1.14 blocker.cxx,1.13,1.14 blocker.hxx,1.12,1.13 boarder.cxx,1.11,1.12 boarder.hxx,1.11,1.12 bomber.cxx,1.19,1.20 bomber.hxx,1.14,1.15 bridger.cxx,1.22,1.23 bridger.hxx,1.15,1.16 climber.cxx,1.16,1.17 climber.hxx,1.11,1.12 digger.cxx,1.16,1.17 digger.hxx,1.11,1.12 drown.cxx,1.10,1.11 drown.hxx,1.10,1.11 exiter.cxx,1.10,1.11 exiter.hxx,1.10,1.11 faller.cxx,1.28,1.29 faller.hxx,1.15,1.16 floater.cxx,1.19,1.20 floater.hxx,1.12,1.13 jumper.cxx,1.15,1.16 jumper.hxx,1.10,1.11 laser_kill.cxx,1.11,1.12 laser_kill.hxx,1.11,1.12 miner.cxx,1.14,1.15 miner.hxx,1.10,1.11 rocket_launcher.cxx,1.10,1.11 rocket_launcher.hxx,1.10,1.11 slider.cxx,1.14,1.15 slider.hxx,1.10,1.11 smashed.cxx,1.10,1.11 smashed.hxx,1.11,1.12 splashed.cxx,1.10,1.11 splashed.hxx,1.11,1.12 superman.cxx,1.8,1.9 superman.hxx,1.11,1.12 teleported.cxx,1.9,1.10 teleported.hxx,1.10,1.11 waiter.cxx,1.10,1.11 waiter.hxx,1.10,1.11 walker.cxx,1.27,1.28 walker.hxx,1.10,1.11
- Index(es):