[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src pingu_holder.cxx,1.7,1.8
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src pingu_holder.cxx,1.7,1.8 |
Date: |
18 Sep 2002 11:03:02 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv5595
Modified Files:
pingu_holder.cxx
Log Message:
seperated draw/update in the pingu holder
Index: pingu_holder.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_holder.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- pingu_holder.cxx 18 Sep 2002 10:50:57 -0000 1.7
+++ pingu_holder.cxx 18 Sep 2002 11:03:00 -0000 1.8
@@ -20,6 +20,7 @@
#include <iostream>
#include "pingu_holder.hxx"
#include "pingu.hxx"
+#include "pingu_action.hxx"
PinguHolder::PinguHolder()
{
@@ -64,10 +65,35 @@
void
PinguHolder::draw (GraphicContext& gc)
{
+ // Draw all walkers
+ for(std::list<Pingu*>::iterator pingu = pingus.begin();
+ pingu != pingus.end();
+ ++pingu)
+ {
+ if ((*pingu)->get_action()->get_type() == Actions::Walker)
+ (*pingu)->draw (gc);
+ }
+
+ // Draw all non-walkers, so that they are easier spotable
+ // FIXME: This might be usefull, but looks kind of ugly
+ for(std::list<Pingu*>::iterator pingu = pingus.begin();
+ pingu != pingus.end();
+ ++pingu)
+ {
+ if ((*pingu)->get_action()->get_type() != Actions::Walker)
+ (*pingu)->draw (gc);
+ }
+}
+
+void
+PinguHolder::update(float delta)
+{
PinguIter pingu = pingus.begin();
while(pingu != pingus.end())
{
+ (*pingu)->update(delta);
+
// FIXME: The draw-loop is not the place for things like this,
// this belongs in the update loop
if ((*pingu)->get_status() == PS_DEAD)
@@ -84,33 +110,9 @@
}
else
{
- // We don't draw the actions here, since we want them above
- // all other pingus, for better visibility
- if (!(*pingu)->get_action())
- (*pingu)->draw (gc);
-
// move to the next Pingu
pingu++;
}
- }
-
- // We draw all actions here, so we have them above all others
- for(pingu = pingus.begin(); pingu != pingus.end(); pingu++)
- {
- if ((*pingu)->get_action())
- (*pingu)->draw (gc);
- }
-}
-
-void
-PinguHolder::update(float delta)
-{
- // FIXME: This is a relictn, pingus should handle that themself
- // FIXME: WorldObj::for_each_pingu (Func f); might cause throuble
- // FIXME: with MSVC
- for(PinguIter pingu = begin(); pingu != end(); ++pingu)
- {
- (*pingu)->update(delta);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src pingu_holder.cxx,1.7,1.8,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs smasher.cxx,1.7,1.8
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src hotspot.cxx,1.5,1.6 pingu_holder.cxx,1.8,1.9 pingu_holder.hxx,1.5,1.6
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs smasher.cxx,1.7,1.8
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src hotspot.cxx,1.5,1.6 pingu_holder.cxx,1.8,1.9 pingu_holder.hxx,1.5,1.6
- Index(es):