[Orxonox-commit 7370] r11986 - code/branches/RacingBots_FS18/src/modules/gametypes
arismu at orxonox.net
arismu at orxonox.net
Thu May 24 15:03:31 CEST 2018
Author: arismu
Date: 2018-05-24 15:03:31 +0200 (Thu, 24 May 2018)
New Revision: 11986
Modified:
code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRace.cc
code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRace.h
code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRaceController.cc
code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRaceController.h
Log:
messages
Modified: code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRace.cc
===================================================================
--- code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRace.cc 2018-05-24 12:39:49 UTC (rev 11985)
+++ code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRace.cc 2018-05-24 13:03:31 UTC (rev 11986)
@@ -141,7 +141,7 @@
c += 3;
}
- std::string message("Use headphones to hear the countdown! Press W for forward acceleration, W+space bar for boost!");
+ std::string message("Use headphones to hear the countdown! Press W for forward acceleration, press W+space for boost!");
this->getGametypeInfo()->sendAnnounceMessage(message);
ChatManager::message(message);
@@ -190,13 +190,15 @@
int s = this->clock_.getSeconds();
int ms = static_cast<int>(this->clock_.getMilliseconds() - 1000*s);
std::string message;
- message = multi_cast<std::string>(s)+"You could not reach the last checkpoint before your opponents. YOU LOOSE!";
-
if (this->bTimeIsUp_)
{
message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
+ "You loose!";
}
+ else if(this->bLost){
+ message = multi_cast<std::string>(s)+"You could not reach the last checkpoint before your opponents. YOU LOOSE!";
+
+ }
else
{
@@ -206,6 +208,7 @@
if (!this->hasEnded())
{
+
this->getGametypeInfo()->sendAnnounceMessage(message);
ChatManager::message(message);
}
@@ -221,12 +224,16 @@
int ms = this->clock_.getMilliseconds() % 1000;
-
- const std::string& message = player->getName() + " reached the checkpoint " + multi_cast<std::string>(checkpoint->getCheckpointIndex() + 1)
+ std::string message(player->getName() + " reached the checkpoint " + multi_cast<std::string>(checkpoint->getCheckpointIndex() + 1)
+ + " after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds.");
+
+ this->getGametypeInfo()->sendAnnounceMessage(message);
+ ChatManager::message(message);
+ /* const std::string& message = player->getName() + " reached the checkpoint " + multi_cast<std::string>(checkpoint->getCheckpointIndex() + 1)
+ "after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds.";
this->getGametypeInfo()->sendAnnounceMessage(message);
- ChatManager::message(message);
- if(checkpoint->getCheckpointIndex()==20){
+ ChatManager::message(message);*/
+ if(checkpoint->getCheckpointIndex()==19){
const std::string& message = player->getName() + " reached the checkpoint " + multi_cast<std::string>(checkpoint->getCheckpointIndex() + 1)
+ "after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds and WON THE GAME.";
Modified: code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRace.h
===================================================================
--- code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRace.h 2018-05-24 12:39:49 UTC (rev 11985)
+++ code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRace.h 2018-05-24 13:03:31 UTC (rev 11986)
@@ -41,6 +41,7 @@
#include "SpaceRaceManager.h"
+
namespace orxonox
{
/**
@@ -87,7 +88,7 @@
virtual bool allowPawnDamage(Pawn* victim, Pawn* originator) override;
virtual bool allowPawnDeath(Pawn* victim, Pawn* originator) override;
bool countdown_mode = false;
- float time_passed = 4.0f;
+ float time_passed = 11.0f;
bool bLost=false;
Modified: code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRaceController.cc
===================================================================
--- code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRaceController.cc 2018-05-24 12:39:49 UTC (rev 11985)
+++ code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRaceController.cc 2018-05-24 13:03:31 UTC (rev 11986)
@@ -106,14 +106,15 @@
}
return returnVec;
}
- /*void SpaceRaceController::endtheGame() const {
+ void SpaceRaceController::endtheGame() const {
SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype());
- assert(gametype);
- if (!gametype)
+ assert(gametype)
+; if (!gametype)
return;
+ gametype->bLost=true;
gametype->end();
- }*/
+ }
/*
* called from 'findStaticCheckpoints'
* return how many ways go from the given Checkpoint to the last Checkpoint (of the Game)
@@ -175,6 +176,7 @@
for (int checkpointIndex : raceCheckpoint->getNextCheckpoints())
{
RaceCheckPoint* nextRaceCheckPoint = findCheckpoint(checkpointIndex);
+
float distance = recCalculateDistance(nextRaceCheckPoint, this->getControllableEntity()->getPosition());
if (distance < minDistance || minNextRaceCheckPoint == nullptr)
@@ -183,9 +185,12 @@
minNextRaceCheckPoint = nextRaceCheckPoint;
}
+ //There is a bug. If the user passes through the 19th checkpoint with the opponents, the game will end immediately
+ if(nextRaceCheckPoint->isLast())
+ endtheGame();
}
- if(minNextRaceCheckPoint == nullptr) { orxout()<<"nullptr found @181 SpaceRaceController" << endl;}
+ if(minNextRaceCheckPoint == nullptr) { orxout()<<"nullptr found @192 SpaceRaceController" << endl;}
return minNextRaceCheckPoint;
}
Modified: code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRaceController.h
===================================================================
--- code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRaceController.h 2018-05-24 12:39:49 UTC (rev 11985)
+++ code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRaceController.h 2018-05-24 13:03:31 UTC (rev 11986)
@@ -57,7 +57,7 @@
float distanceSpaceshipToCheckPoint(RaceCheckPoint*);
RaceCheckPoint* nextPointFind(RaceCheckPoint*);
RaceCheckPoint* adjustNextPoint();
- //void endtheGame() const;
+ void endtheGame() const;
std::vector<RaceCheckPoint*> findStaticCheckpoints(RaceCheckPoint*, const std::vector<RaceCheckPoint*>&);
std::vector<RaceCheckPoint*> staticCheckpoints();
More information about the Orxonox-commit
mailing list