[Orxonox-commit 301] r2935 - in branches/gametypes/src/orxonox/objects: gametypes worldentities/pawns
mockm at orxonox.net
mockm at orxonox.net
Mon Apr 27 17:12:59 CEST 2009
Author: mockm
Date: 2009-04-27 17:12:59 +0200 (Mon, 27 Apr 2009)
New Revision: 2935
Modified:
branches/gametypes/src/orxonox/objects/gametypes/UnderAttack.cc
branches/gametypes/src/orxonox/objects/worldentities/pawns/Destroyer.cc
Log:
new revision of gametype UnderAttack
Modified: branches/gametypes/src/orxonox/objects/gametypes/UnderAttack.cc
===================================================================
--- branches/gametypes/src/orxonox/objects/gametypes/UnderAttack.cc 2009-04-27 14:26:49 UTC (rev 2934)
+++ branches/gametypes/src/orxonox/objects/gametypes/UnderAttack.cc 2009-04-27 15:12:59 UTC (rev 2935)
@@ -120,11 +120,16 @@
}
void UnderAttack::tick(float dt)
{
- gameTime_ = gameTime_ - dt;
- if (gameTime_<= 0)
+ SUPER(UnderAttack, tick, dt);
+
+ if (this->hasStarted())
{
- gameEnded_ = true;
- COUT(0) << "Time is up! Team 1 has won!" << std::endl;
+ gameTime_ = gameTime_ - dt;
+ if (gameTime_<= 0 && !gameEnded_)
+ {
+ gameEnded_ = true;
+ COUT(0) << "Time is up! Team 1 has won!" << std::endl;
+ }
}
}
Modified: branches/gametypes/src/orxonox/objects/worldentities/pawns/Destroyer.cc
===================================================================
--- branches/gametypes/src/orxonox/objects/worldentities/pawns/Destroyer.cc 2009-04-27 14:26:49 UTC (rev 2934)
+++ branches/gametypes/src/orxonox/objects/worldentities/pawns/Destroyer.cc 2009-04-27 15:12:59 UTC (rev 2935)
@@ -38,6 +38,7 @@
#include "core/Template.h"
#include "core/XMLPort.h"
#include "objects/items/Engine.h"
+#include "objects/gametypes/UnderAttack.h"
namespace orxonox
{
@@ -47,6 +48,11 @@
{
RegisterObject(Destroyer);
+ UnderAttack* gametype = dynamic_cast<UnderAttack*>(this->getGametype());
+ if (gametype)
+ {
+ gametype->addDestroyer(this);
+ }
}
}
More information about the Orxonox-commit
mailing list