- Timestamp:
- Aug 4, 2011, 12:45:06 AM (13 years ago)
- Location:
- code/branches/output
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/output/data/levels/presentationDM.oxw
r8706 r8822 16 16 name = "Presentation" 17 17 description = "A simple testlevel" 18 gametype = Deathmatch 18 19 > 19 20 <templates> -
code/branches/output/src/libraries/network/Host.cc
r8408 r8822 91 91 void Host::Chat(const std::string& message) 92 92 { 93 if(instances_s.size()==0) 93 for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it) 94 it->incomingChat(message, 0); 95 96 bool result = true; 97 for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it ) 94 98 { 95 for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it) 96 it->incomingChat(message, 0); 97 // return true; 99 if( (*it)->isActive() ) 100 { 101 if( !(*it)->chat(message) ) 102 result = false; 103 } 98 104 } 99 else 100 { 101 bool result = true; 102 for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it ) 103 { 104 if( (*it)->isActive() ) 105 { 106 if( !(*it)->chat(message) ) 107 result = false; 108 } 109 } 110 // return result; 111 } 105 // return result; 112 106 } 113 107 114 108 bool Host::Broadcast(const std::string& message) 115 109 { 116 if(instances_s.size()==0) 110 for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it) 111 it->incomingChat(message, NETWORK_PEER_ID_BROADCAST); 112 113 bool result = true; 114 for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it ) 117 115 { 118 for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it) 119 it->incomingChat(message, NETWORK_PEER_ID_BROADCAST); 120 return true; 116 if( (*it)->isActive() ) 117 { 118 if( !(*it)->broadcast(message) ) 119 result = false; 120 } 121 121 } 122 else 123 { 124 bool result = true; 125 for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it ) 126 { 127 if( (*it)->isActive() ) 128 { 129 if( !(*it)->broadcast(message) ) 130 result = false; 131 } 132 } 133 return result; 134 } 122 return result; 135 123 } 136 124 … … 161 149 return false; 162 150 } 163 151 164 152 Host* Host::getActiveInstance() 165 153 { -
code/branches/output/src/modules/gametypes/RaceCheckPoint.cc
r8811 r8822 29 29 #include "RaceCheckPoint.h" 30 30 31 #include "util/Convert.h" 31 32 #include "core/CoreIncludes.h" 32 33 #include "core/XMLPort.h" 34 #include "network/Host.h" 33 35 #include "SpaceRace.h" 34 #include "util/Convert.h"35 36 36 37 namespace orxonox 37 38 { 38 39 CreateFactory(RaceCheckPoint); 39 40 40 41 RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this)) 41 42 { … … 50 51 this->setRadarVisibility(false); 51 52 } 52 53 53 54 RaceCheckPoint::~RaceCheckPoint() 54 55 { 55 56 } 56 57 57 58 void RaceCheckPoint::tick(float dt) 58 59 { … … 66 67 } 67 68 68 69 69 70 void RaceCheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode) 70 71 { … … 75 76 XMLPortParam(RaceCheckPoint, "timelimit", setTimelimit, getTimeLimit, xmlelement, mode).defaultValues(0); 76 77 } 77 78 78 79 void RaceCheckPoint::triggered(bool bIsTriggered) 79 80 { … … 99 100 } 100 101 } 101 102 102 103 void RaceCheckPoint::setTimelimit(float timeLimit) 103 104 { … … 110 111 const std::string& message = "You have " + multi_cast<std::string>(this->bTimeLimit_) 111 112 + " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1); 112 orxout(level::message) << message << endl;113 113 const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage(message); 114 Host::Broadcast(message); 114 115 } 115 116 } 116 117 } 117 118 118 119 } -
code/branches/output/src/modules/gametypes/SpaceRace.cc
r8811 r8822 38 38 { 39 39 CreateUnloadableFactory(SpaceRace); 40 40 41 41 SpaceRace::SpaceRace(BaseObject* creator) : Gametype(creator) 42 42 { … … 46 46 this->numberOfBots_ = 0; 47 47 } 48 48 49 49 void SpaceRace::end() 50 50 { 51 51 this->Gametype::end(); 52 52 53 53 if (this->bTimeIsUp_) 54 54 { … … 59 59 + "You didn't reach the check point " + multi_cast<std::string>(this->bCheckpointsReached_+1) 60 60 + " before the time limit. You lose!"; 61 orxout(level::message) << message << endl;62 61 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 63 62 Host::Broadcast(message); … … 70 69 const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s) 71 70 + "." + multi_cast<std::string>(ms) + " seconds."; 72 orxout(level::message) << message << endl;73 71 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 74 72 Host::Broadcast(message); 73 /* 75 74 float time = this->clock_.getSecondsPrecise(); 76 75 this->scores_.insert(time); 77 76 std::set<float>::iterator it; 78 77 for (it=this->scores_.begin(); it!=this->scores_.end(); it++) 79 orxout(level::message) << multi_cast<std::string>(*it) << endl; 78 orxout(level::message) << multi_cast<std::string>(*it) << endl; 79 */ 80 80 } 81 81 } … … 86 86 87 87 std::string message("The match has started! Reach the check points as quickly as possible!"); 88 orxout(level::message) << message << endl;89 88 Host::Broadcast(message); 90 89 } 91 90 92 91 void SpaceRace::newCheckpointReached() 93 92 { … … 99 98 + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) 100 99 + " seconds."; 101 orxout(level::message) << message << endl;102 100 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 103 101 Host::Broadcast(message); -
code/branches/output/src/modules/overlays/hud/ChatOverlay.cc
r8811 r8822 87 87 88 88 this->messages_.push_back(multi_cast<Ogre::DisplayString>(text)); 89 orxout(level::message) << "Chat: " << text << endl;90 89 91 90 Timer* timer = new Timer(); -
code/branches/output/src/orxonox/gametypes/Asteroids.cc
r8809 r8822 74 74 75 75 std::string message("The match has started! Reach the first chekpoint within 15 seconds! But be aware, there may be pirates around..."); 76 orxout(level::message) << message << endl;77 76 Host::Broadcast(message); 78 77 … … 84 83 85 84 std::string message("The match has ended."); 86 orxout(level::message) << message << endl;87 85 Host::Broadcast(message); 88 86 } -
code/branches/output/src/orxonox/gametypes/Deathmatch.cc
r8809 r8822 48 48 49 49 std::string message("The match has started!"); 50 orxout(level::message) << message << endl;51 50 Host::Broadcast(message); 52 51 } … … 57 56 58 57 std::string message("The match has ended."); 59 orxout(level::message) << message << endl;60 58 Host::Broadcast(message); 61 59 } … … 66 64 67 65 const std::string& message = player->getName() + " entered the game"; 68 orxout(level::message) << message << endl;69 66 Host::Broadcast(message); 70 67 } … … 77 74 { 78 75 const std::string& message = player->getName() + " left the game"; 79 orxout(level::message) << message << endl;80 76 Host::Broadcast(message); 81 77 } … … 91 87 { 92 88 const std::string& message = player->getOldName() + " changed name to " + player->getName(); 93 orxout(level::message) << message << endl;94 89 Host::Broadcast(message); 95 90 } … … 113 108 message = victim->getPlayer()->getName() + " died"; 114 109 115 orxout(level::message) << message << endl;116 110 Host::Broadcast(message); 117 111 } … … 127 121 { 128 122 const std::string& message = player->getName() + " scores!"; 129 orxout(level::message) << message << endl;130 123 Host::Broadcast(message); 131 124 } -
code/branches/output/src/orxonox/gametypes/Dynamicmatch.cc
r8809 r8822 343 343 Gametype::playerEntered(player); 344 344 const std::string& message = player->getName() + " entered the game"; 345 orxout(level::message) << message << endl;346 345 Host::Broadcast(message); 347 346 } … … 359 358 } 360 359 const std::string& message = player->getName() + " left the game"; 361 orxout(level::message) << message << endl;362 360 Host::Broadcast(message); 363 361 //remove player from map … … 617 615 { 618 616 const std::string& message = player->getOldName() + " changed name to " + player->getName(); 619 orxout(level::message) << message << endl;620 617 Host::Broadcast(message); 621 618 } … … 630 627 { 631 628 std::string message("Dynamicmatch started!"); 632 orxout(level::message) << message << endl;633 629 Host::Broadcast(message); 634 630 } … … 647 643 { 648 644 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!"); 649 orxout(level::message) << message << endl;650 645 Host::Broadcast(message); 651 646 callInstructions_.setTimer(10, false, createExecutor(createFunctor(&Dynamicmatch::furtherInstructions, this))); … … 655 650 { 656 651 std::string message("After 3 Minutes the game is over."); 657 orxout(level::message) << message << endl;658 652 Host::Broadcast(message); 659 653 }*/ … … 663 657 664 658 std::string message("Time out. Press F2 to see the points you scored."); 665 orxout(level::message) << message << endl;666 659 Host::Broadcast(message); 667 660 } -
code/branches/output/src/orxonox/gametypes/LastManStanding.cc
r8809 r8822 90 90 const std::string& message = ""; // resets Camper-Warning-message 91 91 this->gtinfo_->sendFadingMessage(message,it->first->getClientID()); 92 } 92 } 93 93 } 94 94 return true; … … 105 105 this->playersAlive--; 106 106 const std::string& message = victim->getPlayer()->getName() + " has lost all lives"; 107 orxout(level::message) << message << endl;108 107 Host::Broadcast(message); 109 108 } … … 128 127 { 129 128 Gametype::end(); 130 129 131 130 for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it) 132 131 { … … 148 147 return 0; 149 148 } 150 149 151 150 int LastManStanding::getNumPlayersAlive() const 152 151 { … … 190 189 this->timeToAct_[player]=timeRemaining+3.0f+respawnDelay;//reset timer 191 190 this->playerDelayTime_[player]=respawnDelay; 192 191 193 192 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player); 194 193 if (it != this->players_.end()) … … 198 197 const std::string& message = ""; // resets Camper-Warning-message 199 198 this->gtinfo_->sendFadingMessage(message,it->first->getClientID()); 200 } 199 } 201 200 } 202 201 … … 239 238 } 240 239 for (std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it) 241 { 240 { 242 241 if (playerGetLives(it->first)<=0)//Players without lives shouldn't be affected by time. 243 continue; 242 continue; 244 243 it->second-=dt;//Decreases punishment time. 245 if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up. 244 if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up. 246 245 { 247 246 playerDelayTime_[it->first]-=dt; -
code/branches/output/src/orxonox/gametypes/LastTeamStanding.cc
r8809 r8822 119 119 this->teamsAlive--; 120 120 const std::string& message = victim->getPlayer()->getName() + " has lost all lives"; 121 orxout(level::message) << message << endl;122 121 Host::Broadcast(message); 123 122 } -
code/branches/output/src/orxonox/gametypes/UnderAttack.cc
r8809 r8822 70 70 this->end(); //end gametype 71 71 std::string message("Ship destroyed! Team 0 has won!"); 72 orxout(level::message) << message << endl;73 72 Host::Broadcast(message); 74 73 this->gameEnded_ = true; … … 153 152 this->end(); 154 153 std::string message("Time is up! Team 1 has won!"); 155 orxout(level::message) << message << endl;156 154 Host::Broadcast(message); 157 155 … … 173 171 const std::string& message = multi_cast<std::string>(timesequence_) + " seconds left!"; 174 172 /* 175 orxout(level::message) << message << endl;176 173 Host::Broadcast(message); 177 174 */
Note: See TracChangeset
for help on using the changeset viewer.