[Orxonox-commit 4244] r8915 - code/branches/spaceraceTwo/src/modules/gametypes
eceline at orxonox.net
eceline at orxonox.net
Wed Nov 2 14:51:40 CET 2011
Author: eceline
Date: 2011-11-02 14:51:40 +0100 (Wed, 02 Nov 2011)
New Revision: 8915
Modified:
code/branches/spaceraceTwo/src/modules/gametypes/RaceCheckPoint.cc
code/branches/spaceraceTwo/src/modules/gametypes/RaceCheckPoint.h
code/branches/spaceraceTwo/src/modules/gametypes/SpaceRace.cc
code/branches/spaceraceTwo/src/modules/gametypes/SpaceRaceManager.cc
code/branches/spaceraceTwo/src/modules/gametypes/SpaceRaceManager.h
Log:
Vektoren
Modified: code/branches/spaceraceTwo/src/modules/gametypes/RaceCheckPoint.cc
===================================================================
--- code/branches/spaceraceTwo/src/modules/gametypes/RaceCheckPoint.cc 2011-11-02 13:29:50 UTC (rev 8914)
+++ code/branches/spaceraceTwo/src/modules/gametypes/RaceCheckPoint.cc 2011-11-02 13:51:40 UTC (rev 8915)
@@ -54,6 +54,12 @@
RaceCheckPoint::~RaceCheckPoint()
{
+ //if (this->isInitialized())
+ {
+ //for (size_t i = 0; i < this->nextcheckpoints_.size(); ++i)
+ // this->nextcheckpoints_[i]->destroy();
+ }
+ nextcheckpoints_.clear();
}
void RaceCheckPoint::tick(float dt)
@@ -75,6 +81,7 @@
XMLPortParam(RaceCheckPoint, "checkpointindex", setCheckpointIndex, getCheckpointIndex, xmlelement, mode).defaultValues(0);
XMLPortParam(RaceCheckPoint, "islast", setLast, getLast, xmlelement, mode).defaultValues(false);
XMLPortParam(RaceCheckPoint, "timelimit", setTimelimit, getTimeLimit, xmlelement, mode).defaultValues(0);
+ //XMLPortParamTemplate(RaceCheckPoint, "nextcheckpoints", setNextcheckpoint, getNextcheckpoint, xmlelement, mode,std::vector<int>);
}
void RaceCheckPoint::triggered(bool bIsTriggered)
Modified: code/branches/spaceraceTwo/src/modules/gametypes/RaceCheckPoint.h
===================================================================
--- code/branches/spaceraceTwo/src/modules/gametypes/RaceCheckPoint.h 2011-11-02 13:29:50 UTC (rev 8914)
+++ code/branches/spaceraceTwo/src/modules/gametypes/RaceCheckPoint.h 2011-11-02 13:51:40 UTC (rev 8915)
@@ -56,10 +56,16 @@
{ this->bIsLast_ = isLast; }
inline bool getLast()
{ return this->bIsLast_; }
- inline void setCheckpointIndex(int checkpointIndex)
+
+ inline void setCheckpointIndex(int checkpointIndex)
{ this->bCheckpointIndex_ = checkpointIndex; }
inline int getCheckpointIndex()
{ return this->bCheckpointIndex_; }
+
+ inline void setNextcheckpoint(std::vector<int> checkpoints)
+ { this->nextcheckpoints_ = checkpoints; }
+ inline std::vector<int> getNextcheckpoint()
+ { return this->nextcheckpoints_; }
virtual void setTimelimit(float timeLimit);
inline float getTimeLimit()
{ return this->bTimeLimit_;}
@@ -70,8 +76,10 @@
int bCheckpointIndex_; //The index of this check point. This value will be compared with the number of check points reached in the level. The check points must be indexed in ascending order beginning from zero and without any jumps between the indexes.
bool bIsLast_; //True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level.
float bTimeLimit_; //The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses.
+
+ std::vector<int> nextcheckpoints_; //the indexes of the next check points
};
}
-#endif /* _RaceCheckPoint_H__ */
\ No newline at end of file
+#endif /* _RaceCheckPoint_H__ */
Modified: code/branches/spaceraceTwo/src/modules/gametypes/SpaceRace.cc
===================================================================
--- code/branches/spaceraceTwo/src/modules/gametypes/SpaceRace.cc 2011-11-02 13:29:50 UTC (rev 8914)
+++ code/branches/spaceraceTwo/src/modules/gametypes/SpaceRace.cc 2011-11-02 13:51:40 UTC (rev 8915)
@@ -134,14 +134,8 @@
}
- void SpaceRace::tick(float dt)
- {SUPER(SpaceRace,tick,dt);
- //if(const_cast<GametypeInfo*>(this->getGametypeInfo())->isStartCountdownRunning()){
- //const_cast<GametypeInfo*>(this->getGametypeInfo())->start();}
- }
-
void SpaceRace::newCheckpointReached()
{
Modified: code/branches/spaceraceTwo/src/modules/gametypes/SpaceRaceManager.cc
===================================================================
--- code/branches/spaceraceTwo/src/modules/gametypes/SpaceRaceManager.cc 2011-11-02 13:29:50 UTC (rev 8914)
+++ code/branches/spaceraceTwo/src/modules/gametypes/SpaceRaceManager.cc 2011-11-02 13:51:40 UTC (rev 8915)
@@ -43,11 +43,31 @@
SpaceRaceManager::SpaceRaceManager(BaseObject* creator) : BaseObject(creator)
{
RegisterObject(SpaceRaceManager);
-
-
+
}
-
+ SpaceRaceManager::~SpaceRaceManager()
+ {
+ if (this->isInitialized())
+ {
+ for (size_t i = 0; i < this->checkpoints_.size(); ++i)
+ this->checkpoints_[i]->destroy();
+ }
+ }
+
+ void SpaceRaceManager::addCheckpoint(RaceCheckPoint* checkpoint)
+ {
+ this->checkpoints_.push_back(checkpoint);
+ }
+
+ RaceCheckPoint* SpaceRaceManager::getCheckpoint(unsigned int index) const
+ {
+ if (index < this->checkpoints_.size())
+ return this->checkpoints_[index];
+ else
+ return 0;
+ }
+
void SpaceRaceManager::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
SUPER(SpaceRaceManager, XMLPort, xmlelement, mode);
Modified: code/branches/spaceraceTwo/src/modules/gametypes/SpaceRaceManager.h
===================================================================
--- code/branches/spaceraceTwo/src/modules/gametypes/SpaceRaceManager.h 2011-11-02 13:29:50 UTC (rev 8914)
+++ code/branches/spaceraceTwo/src/modules/gametypes/SpaceRaceManager.h 2011-11-02 13:51:40 UTC (rev 8915)
@@ -54,15 +54,18 @@
public:
SpaceRaceManager(BaseObject* creator);
- virtual ~SpaceRaceManager() {}
+ virtual ~SpaceRaceManager() ;
void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
+ void addCheckpoint(RaceCheckPoint* checkpoint);
+ RaceCheckPoint* getCheckpoint(unsigned int index) const;
+
void tick(float dt);
protected:
private:
+ std::vector<RaceCheckPoint*> checkpoints_;
};
}
More information about the Orxonox-commit
mailing list