[Orxonox-commit 4151] r8822 - in code/branches/output: data/levels src/libraries/network src/modules/gametypes src/modules/overlays/hud src/orxonox/gametypes
landauf at orxonox.net
landauf at orxonox.net
Thu Aug 4 00:45:06 CEST 2011
Author: landauf
Date: 2011-08-04 00:45:06 +0200 (Thu, 04 Aug 2011)
New Revision: 8822
Modified:
code/branches/output/data/levels/presentationDM.oxw
code/branches/output/src/libraries/network/Host.cc
code/branches/output/src/modules/gametypes/RaceCheckPoint.cc
code/branches/output/src/modules/gametypes/SpaceRace.cc
code/branches/output/src/modules/overlays/hud/ChatOverlay.cc
code/branches/output/src/orxonox/gametypes/Asteroids.cc
code/branches/output/src/orxonox/gametypes/Deathmatch.cc
code/branches/output/src/orxonox/gametypes/Dynamicmatch.cc
code/branches/output/src/orxonox/gametypes/LastManStanding.cc
code/branches/output/src/orxonox/gametypes/LastTeamStanding.cc
code/branches/output/src/orxonox/gametypes/UnderAttack.cc
Log:
Chat works again
Removed console output for almost all gameplay messages (use chat/notifications instead)
Deathmatch level now actually uses Deathmatch gametype
Modified: code/branches/output/data/levels/presentationDM.oxw
===================================================================
--- code/branches/output/data/levels/presentationDM.oxw 2011-08-03 22:09:03 UTC (rev 8821)
+++ code/branches/output/data/levels/presentationDM.oxw 2011-08-03 22:45:06 UTC (rev 8822)
@@ -15,6 +15,7 @@
<Level
name = "Presentation"
description = "A simple testlevel"
+ gametype = Deathmatch
>
<templates>
<Template link=lodtemplate_default />
Modified: code/branches/output/src/libraries/network/Host.cc
===================================================================
--- code/branches/output/src/libraries/network/Host.cc 2011-08-03 22:09:03 UTC (rev 8821)
+++ code/branches/output/src/libraries/network/Host.cc 2011-08-03 22:45:06 UTC (rev 8822)
@@ -90,48 +90,36 @@
void Host::Chat(const std::string& message)
{
- if(instances_s.size()==0)
+ for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
+ it->incomingChat(message, 0);
+
+ bool result = true;
+ for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
{
- for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
- it->incomingChat(message, 0);
-// return true;
- }
- else
- {
- bool result = true;
- for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
+ if( (*it)->isActive() )
{
- if( (*it)->isActive() )
- {
- if( !(*it)->chat(message) )
- result = false;
- }
+ if( !(*it)->chat(message) )
+ result = false;
}
-// return result;
}
+// return result;
}
bool Host::Broadcast(const std::string& message)
{
- if(instances_s.size()==0)
+ for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
+ it->incomingChat(message, NETWORK_PEER_ID_BROADCAST);
+
+ bool result = true;
+ for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
{
- for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
- it->incomingChat(message, NETWORK_PEER_ID_BROADCAST);
- return true;
- }
- else
- {
- bool result = true;
- for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
+ if( (*it)->isActive() )
{
- if( (*it)->isActive() )
- {
- if( !(*it)->broadcast(message) )
- result = false;
- }
+ if( !(*it)->broadcast(message) )
+ result = false;
}
- return result;
}
+ return result;
}
bool Host::incomingChat(const std::string& message, unsigned int playerID)
@@ -160,7 +148,7 @@
}
return false;
}
-
+
Host* Host::getActiveInstance()
{
std::vector<Host*>::iterator it = Host::instances_s.begin();
Modified: code/branches/output/src/modules/gametypes/RaceCheckPoint.cc
===================================================================
--- code/branches/output/src/modules/gametypes/RaceCheckPoint.cc 2011-08-03 22:09:03 UTC (rev 8821)
+++ code/branches/output/src/modules/gametypes/RaceCheckPoint.cc 2011-08-03 22:45:06 UTC (rev 8822)
@@ -28,15 +28,16 @@
#include "RaceCheckPoint.h"
+#include "util/Convert.h"
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
+#include "network/Host.h"
#include "SpaceRace.h"
-#include "util/Convert.h"
namespace orxonox
{
CreateFactory(RaceCheckPoint);
-
+
RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
{
RegisterObject(RaceCheckPoint);
@@ -49,11 +50,11 @@
this->setRadarObjectShape(RadarViewable::Triangle);
this->setRadarVisibility(false);
}
-
+
RaceCheckPoint::~RaceCheckPoint()
{
}
-
+
void RaceCheckPoint::tick(float dt)
{
SUPER(RaceCheckPoint, tick, dt);
@@ -65,7 +66,7 @@
this->setRadarVisibility(false);
}
-
+
void RaceCheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
SUPER(RaceCheckPoint, XMLPort, xmlelement, mode);
@@ -74,7 +75,7 @@
XMLPortParam(RaceCheckPoint, "islast", setLast, getLast, xmlelement, mode).defaultValues(false);
XMLPortParam(RaceCheckPoint, "timelimit", setTimelimit, getTimeLimit, xmlelement, mode).defaultValues(0);
}
-
+
void RaceCheckPoint::triggered(bool bIsTriggered)
{
DistanceTrigger::triggered(bIsTriggered);
@@ -98,7 +99,7 @@
}
}
}
-
+
void RaceCheckPoint::setTimelimit(float timeLimit)
{
this->bTimeLimit_ = timeLimit;
@@ -109,10 +110,10 @@
{
const std::string& message = "You have " + multi_cast<std::string>(this->bTimeLimit_)
+ " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1);
- orxout(level::message) << message << endl;
const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage(message);
+ Host::Broadcast(message);
}
}
}
-
+
}
Modified: code/branches/output/src/modules/gametypes/SpaceRace.cc
===================================================================
--- code/branches/output/src/modules/gametypes/SpaceRace.cc 2011-08-03 22:09:03 UTC (rev 8821)
+++ code/branches/output/src/modules/gametypes/SpaceRace.cc 2011-08-03 22:45:06 UTC (rev 8822)
@@ -37,7 +37,7 @@
namespace orxonox
{
CreateUnloadableFactory(SpaceRace);
-
+
SpaceRace::SpaceRace(BaseObject* creator) : Gametype(creator)
{
RegisterObject(SpaceRace);
@@ -45,11 +45,11 @@
this->bTimeIsUp_ = false;
this->numberOfBots_ = 0;
}
-
+
void SpaceRace::end()
{
this->Gametype::end();
-
+
if (this->bTimeIsUp_)
{
this->clock_.capture();
@@ -58,7 +58,6 @@
const std::string& message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
+ "You didn't reach the check point " + multi_cast<std::string>(this->bCheckpointsReached_+1)
+ " before the time limit. You lose!";
- orxout(level::message) << message << endl;
const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
Host::Broadcast(message);
}
@@ -69,14 +68,15 @@
int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);
const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s)
+ "." + multi_cast<std::string>(ms) + " seconds.";
- orxout(level::message) << message << endl;
const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
Host::Broadcast(message);
+/*
float time = this->clock_.getSecondsPrecise();
this->scores_.insert(time);
std::set<float>::iterator it;
for (it=this->scores_.begin(); it!=this->scores_.end(); it++)
- orxout(level::message) << multi_cast<std::string>(*it) << endl;
+ orxout(level::message) << multi_cast<std::string>(*it) << endl;
+*/
}
}
@@ -85,10 +85,9 @@
Gametype::start();
std::string message("The match has started! Reach the check points as quickly as possible!");
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
-
+
void SpaceRace::newCheckpointReached()
{
this->bCheckpointsReached_++;
@@ -98,7 +97,6 @@
const std::string& message = "Checkpoint " + multi_cast<std::string>(this->getCheckpointsReached())
+ " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
+ " seconds.";
- orxout(level::message) << message << endl;
const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
Host::Broadcast(message);
}
Modified: code/branches/output/src/modules/overlays/hud/ChatOverlay.cc
===================================================================
--- code/branches/output/src/modules/overlays/hud/ChatOverlay.cc 2011-08-03 22:09:03 UTC (rev 8821)
+++ code/branches/output/src/modules/overlays/hud/ChatOverlay.cc 2011-08-03 22:45:06 UTC (rev 8822)
@@ -86,7 +86,6 @@
}
this->messages_.push_back(multi_cast<Ogre::DisplayString>(text));
- orxout(level::message) << "Chat: " << text << endl;
Timer* timer = new Timer();
this->timers_.insert(timer); // store the timer in a set to destroy it in the destructor
Modified: code/branches/output/src/orxonox/gametypes/Asteroids.cc
===================================================================
--- code/branches/output/src/orxonox/gametypes/Asteroids.cc 2011-08-03 22:09:03 UTC (rev 8821)
+++ code/branches/output/src/orxonox/gametypes/Asteroids.cc 2011-08-03 22:45:06 UTC (rev 8822)
@@ -73,7 +73,6 @@
Gametype::start();
std::string message("The match has started! Reach the first chekpoint within 15 seconds! But be aware, there may be pirates around...");
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
@@ -83,7 +82,6 @@
Gametype::end();
std::string message("The match has ended.");
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
}
Modified: code/branches/output/src/orxonox/gametypes/Deathmatch.cc
===================================================================
--- code/branches/output/src/orxonox/gametypes/Deathmatch.cc 2011-08-03 22:09:03 UTC (rev 8821)
+++ code/branches/output/src/orxonox/gametypes/Deathmatch.cc 2011-08-03 22:45:06 UTC (rev 8822)
@@ -47,7 +47,6 @@
Gametype::start();
std::string message("The match has started!");
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
@@ -56,7 +55,6 @@
Gametype::end();
std::string message("The match has ended.");
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
@@ -65,7 +63,6 @@
Gametype::playerEntered(player);
const std::string& message = player->getName() + " entered the game";
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
@@ -76,7 +73,6 @@
if (valid_player)
{
const std::string& message = player->getName() + " left the game";
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
@@ -90,7 +86,6 @@
if (valid_player)
{
const std::string& message = player->getOldName() + " changed name to " + player->getName();
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
@@ -112,7 +107,6 @@
else
message = victim->getPlayer()->getName() + " died";
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
@@ -126,7 +120,6 @@
if (player)
{
const std::string& message = player->getName() + " scores!";
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
}
Modified: code/branches/output/src/orxonox/gametypes/Dynamicmatch.cc
===================================================================
--- code/branches/output/src/orxonox/gametypes/Dynamicmatch.cc 2011-08-03 22:09:03 UTC (rev 8821)
+++ code/branches/output/src/orxonox/gametypes/Dynamicmatch.cc 2011-08-03 22:45:06 UTC (rev 8822)
@@ -342,7 +342,6 @@
numberOf[chaser]++;
Gametype::playerEntered(player);
const std::string& message = player->getName() + " entered the game";
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
@@ -358,7 +357,6 @@
case 2: numberOf[killer]--; break;
}
const std::string& message = player->getName() + " left the game";
- orxout(level::message) << message << endl;
Host::Broadcast(message);
//remove player from map
playerParty_.erase (player);
@@ -616,7 +614,6 @@
if (valid_player)
{
const std::string& message = player->getOldName() + " changed name to " + player->getName();
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
@@ -629,7 +626,6 @@
if(!tutorial)
{
std::string message("Dynamicmatch started!");
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
else if(tutorial) // Announce selectionphase
@@ -646,7 +642,6 @@
/*void Dynamicmatch::instructions()
{
std::string message("Earn points:\n\n\n\tIf you're red: Chase the blue player!\n\n\tIf you're blue shoot at a red player or hide.\n\n\tIf you're green: You've got the licence to kill red players!");
- orxout(level::message) << message << endl;
Host::Broadcast(message);
callInstructions_.setTimer(10, false, createExecutor(createFunctor(&Dynamicmatch::furtherInstructions, this)));
}
@@ -654,7 +649,6 @@
void Dynamicmatch::furtherInstructions()
{
std::string message("After 3 Minutes the game is over.");
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}*/
void Dynamicmatch::end()
@@ -662,7 +656,6 @@
Gametype::end();
std::string message("Time out. Press F2 to see the points you scored.");
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
SpawnPoint* Dynamicmatch::getBestSpawnPoint(PlayerInfo* player) const
Modified: code/branches/output/src/orxonox/gametypes/LastManStanding.cc
===================================================================
--- code/branches/output/src/orxonox/gametypes/LastManStanding.cc 2011-08-03 22:09:03 UTC (rev 8821)
+++ code/branches/output/src/orxonox/gametypes/LastManStanding.cc 2011-08-03 22:45:06 UTC (rev 8822)
@@ -89,7 +89,7 @@
return true;
const std::string& message = ""; // resets Camper-Warning-message
this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
- }
+ }
}
return true;
}
@@ -104,7 +104,6 @@
{
this->playersAlive--;
const std::string& message = victim->getPlayer()->getName() + " has lost all lives";
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
@@ -127,7 +126,7 @@
void LastManStanding::end()
{
Gametype::end();
-
+
for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
{
if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
@@ -147,7 +146,7 @@
else
return 0;
}
-
+
int LastManStanding::getNumPlayersAlive() const
{
return this->playersAlive;
@@ -189,7 +188,7 @@
return;
this->timeToAct_[player]=timeRemaining+3.0f+respawnDelay;//reset timer
this->playerDelayTime_[player]=respawnDelay;
-
+
std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
if (it != this->players_.end())
{
@@ -197,7 +196,7 @@
return;
const std::string& message = ""; // resets Camper-Warning-message
this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
- }
+ }
}
void LastManStanding::punishPlayer(PlayerInfo* player)
@@ -238,11 +237,11 @@
this->end();
}
for (std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it)
- {
+ {
if (playerGetLives(it->first)<=0)//Players without lives shouldn't be affected by time.
- continue;
+ continue;
it->second-=dt;//Decreases punishment time.
- if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
+ if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
{
playerDelayTime_[it->first]-=dt;
if (playerDelayTime_[it->first]<=0)
Modified: code/branches/output/src/orxonox/gametypes/LastTeamStanding.cc
===================================================================
--- code/branches/output/src/orxonox/gametypes/LastTeamStanding.cc 2011-08-03 22:09:03 UTC (rev 8821)
+++ code/branches/output/src/orxonox/gametypes/LastTeamStanding.cc 2011-08-03 22:45:06 UTC (rev 8822)
@@ -118,7 +118,6 @@
if(eachTeamsPlayers[team] == 0) //last team member died
this->teamsAlive--;
const std::string& message = victim->getPlayer()->getName() + " has lost all lives";
- orxout(level::message) << message << endl;
Host::Broadcast(message);
}
return allow;
Modified: code/branches/output/src/orxonox/gametypes/UnderAttack.cc
===================================================================
--- code/branches/output/src/orxonox/gametypes/UnderAttack.cc 2011-08-03 22:09:03 UTC (rev 8821)
+++ code/branches/output/src/orxonox/gametypes/UnderAttack.cc 2011-08-03 22:45:06 UTC (rev 8822)
@@ -69,7 +69,6 @@
{
this->end(); //end gametype
std::string message("Ship destroyed! Team 0 has won!");
- orxout(level::message) << message << endl;
Host::Broadcast(message);
this->gameEnded_ = true;
@@ -152,7 +151,6 @@
this->gameEnded_ = true;
this->end();
std::string message("Time is up! Team 1 has won!");
- orxout(level::message) << message << endl;
Host::Broadcast(message);
for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
@@ -172,7 +170,6 @@
{
const std::string& message = multi_cast<std::string>(timesequence_) + " seconds left!";
/*
- orxout(level::message) << message << endl;
Host::Broadcast(message);
*/
this->gtinfo_->sendAnnounceMessage(message);
More information about the Orxonox-commit
mailing list