[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src goal_manager.cxx,1.1,1.2 goal_manager
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src goal_manager.cxx,1.1,1.2 goal_manager.hxx,1.1,1.2 |
Date: |
9 Oct 2002 23:09:47 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv902
Modified Files:
goal_manager.cxx goal_manager.hxx
Log Message:
added little wait-time before the finished is passed through to the server
Index: goal_manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/goal_manager.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- goal_manager.cxx 4 Oct 2002 16:54:04 -0000 1.1
+++ goal_manager.cxx 9 Oct 2002 23:09:45 -0000 1.2
@@ -24,7 +24,7 @@
#include "goal_manager.hxx"
GoalManager::GoalManager(Server* s)
- : server(s), goal(GT_NONE)
+ : server(s), goal(GT_NONE), exit_time(0)
{
}
@@ -35,40 +35,51 @@
{
return false;
}
- else
+ else if (exit_time == 0)
{
+ // we are finished, now wait a few second so that everybody can
+ // the the particles, etc.
std::cout << "XXXX goal reached: " << goal << std::endl;
- return true;
+ exit_time = server->get_time() + 125;
+ return false;
+ }
+ else
+ {
+ return (exit_time < server->get_time());
}
}
void
GoalManager::update()
{
- World* world = server->get_world();
- PinguHolder* pingus = world->get_pingus();
- PLF* plf = server->get_plf();
-
- if (pingus->get_number_of_allowed() == pingus->get_number_of_released()
- && pingus->get_number_of_alive() == 0)
- {
- goal = GT_NO_PINGUS_IN_WORLD;
- }
- else if (pingus->get_number_of_alive() == 0 && world->check_armageddon())
- {
- goal = GT_ARMAGEDDON;
- }
- else if (plf->get_time() != -1
- && plf->get_time() <= server->get_time())
+ if (exit_time == 0)
{
- goal = GT_OUT_OF_TIME;
+ World* world = server->get_world();
+ PinguHolder* pingus = world->get_pingus();
+ PLF* plf = server->get_plf();
+
+ if (pingus->get_number_of_allowed() == pingus->get_number_of_released()
+ && pingus->get_number_of_alive() == 0)
+ {
+ goal = GT_NO_PINGUS_IN_WORLD;
+ }
+ else if (pingus->get_number_of_alive() == 0 && world->check_armageddon())
+ {
+ goal = GT_ARMAGEDDON;
+ }
+ else if (plf->get_time() != -1
+ && plf->get_time() <= server->get_time())
+ {
+ goal = GT_OUT_OF_TIME;
+ }
}
}
void
GoalManager::set_abort_goal()
{
- goal = GT_GAME_ABORTED;
+ if (exit_time == 0)
+ goal = GT_GAME_ABORTED;
}
/* EOF */
Index: goal_manager.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/goal_manager.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- goal_manager.hxx 4 Oct 2002 16:54:04 -0000 1.1
+++ goal_manager.hxx 9 Oct 2002 23:09:45 -0000 1.2
@@ -36,6 +36,9 @@
GT_GAME_ABORTED }; // if the user pressed Escape to exit the
level };
GoalType goal;
+ /** time at which is_finished() will return true */
+ unsigned int exit_time;
+
public:
GoalManager(Server* plf);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src goal_manager.cxx,1.1,1.2 goal_manager.hxx,1.1,1.2,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/data/images/groundpieces/ground/green piece1.png,NONE,1.1 piece2.png,NONE,1.1 piece3.png,NONE,1.1
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs entrance.cxx,1.6,1.7 entrance.hxx,1.3,1.4 exit.cxx,1.4,1.5 exit.hxx,1.2,1.3
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/data/images/groundpieces/ground/green piece1.png,NONE,1.1 piece2.png,NONE,1.1 piece3.png,NONE,1.1
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs entrance.cxx,1.6,1.7 entrance.hxx,1.3,1.4 exit.cxx,1.4,1.5 exit.hxx,1.2,1.3
- Index(es):