Changeset 3086
- Timestamp:
- May 27, 2009, 1:44:48 AM (16 years ago)
- Location:
- code/trunk/src/orxonox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/objects/controllers/ArtificialController.cc
r3049 r3086 36 36 #include "objects/gametypes/TeamDeathmatch.h" 37 37 #include "objects/controllers/WaypointPatrolController.h" 38 #include "objects/worldentities/pawns/TeamBaseMatchBase.h" 38 39 39 40 namespace orxonox … … 203 204 } 204 205 206 TeamBaseMatchBase* base = 0; 207 base = dynamic_cast<TeamBaseMatchBase*>(entity1); 208 if (base) 209 { 210 switch (base->getState()) 211 { 212 case BaseState::controlTeam1: 213 team1 = 0; 214 break; 215 case BaseState::controlTeam2: 216 team1 = 1; 217 break; 218 case BaseState::uncontrolled: 219 default: 220 team1 = -1; 221 } 222 } 223 base = dynamic_cast<TeamBaseMatchBase*>(entity2); 224 if (base) 225 { 226 switch (base->getState()) 227 { 228 case BaseState::controlTeam1: 229 team2 = 0; 230 break; 231 case BaseState::controlTeam2: 232 team2 = 1; 233 break; 234 case BaseState::uncontrolled: 235 default: 236 team2 = -1; 237 } 238 } 239 205 240 return (team1 == team2 && team1 != -1); 206 241 } -
code/trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc
r3033 r3086 41 41 42 42 this->scoreTimer_.setTimer(10, true, this, createExecutor(createFunctor(&TeamBaseMatch::winPoints))); 43 this->outputTimer_.setTimer( 30, true, this, createExecutor(createFunctor(&TeamBaseMatch::showPoints)));43 this->outputTimer_.setTimer(10, true, this, createExecutor(createFunctor(&TeamBaseMatch::showPoints))); 44 44 45 45 this->pointsTeam1_ = 0; … … 79 79 std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.find(base); 80 80 if (it != this->bases_.end()) 81 return (!this->pawnsAreInTheSameTeam( victim, base));82 } 83 return (!this->pawnsAreInTheSameTeam(victim, originator));81 return (!this->pawnsAreInTheSameTeam(originator, base)); 82 } 83 return TeamDeathmatch::allowPawnDamage(victim, originator); 84 84 } 85 85 … … 90 90 std::map<PlayerInfo*, int>::const_iterator it1 = this->teamnumbers_.find(pawn1->getPlayer()); 91 91 int teamnrbase = -1; 92 int teamnrplayer = getTeam(pawn1->getPlayer());92 int teamnrplayer = this->getTeam(pawn1->getPlayer()); 93 93 94 94 switch (base->getState()) … … 106 106 107 107 if (teamnrbase == teamnrplayer) 108 return false;109 } 110 return true;108 return true; 109 } 110 return false; 111 111 } 112 112 … … 126 126 { 127 127 COUT(0) << "Points standing:" << std::endl << "Team 1: "<< pointsTeam1_ << std::endl << "Team 2: " << pointsTeam2_ << std::endl; 128 if(pointsTeam1_ >=1700 ) COUT(0) << "Team 1 is near victory!" << std::endl;129 if(pointsTeam2_ >=1700 ) COUT(0) << "Team 2 is near victory!" << std::endl;128 if(pointsTeam1_ >=1700 && pointsTeam1_ < 2000) COUT(0) << "Team 1 is near victory!" << std::endl; 129 if(pointsTeam2_ >=1700 && pointsTeam2_ < 2000) COUT(0) << "Team 2 is near victory!" << std::endl; 130 130 } 131 131 … … 157 157 void TeamBaseMatch::endGame() 158 158 { 159 if(this->pointsTeam1_>=2000 || this->pointsTeam2_ >=2000) 160 { 159 if (this->pointsTeam1_ >= 2000 || this->pointsTeam2_ >= 2000) 160 { 161 if (this->pointsTeam1_ > this->pointsTeam2_) 162 COUT(0) << "Team 1 has won the match" << std::endl; 163 else 164 COUT(0) << "Team 2 has won the match" << std::endl; 165 161 166 this->end(); 167 this->scoreTimer_.stopTimer(); 168 this->outputTimer_.stopTimer(); 162 169 } 163 170 } -
code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.h
r3084 r3086 147 147 class _OrxonoxExport PawnListener : virtual public OrxonoxClass 148 148 { 149 friend class Pawn;150 151 149 public: 152 150 PawnListener(); 153 151 virtual ~PawnListener() {} 154 152 155 protected:156 153 virtual void destroyedPawn(Pawn* pawn) = 0; 157 154 }; -
code/trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc
r3033 r3086 48 48 gametype->addBase(this); 49 49 } 50 51 this->setRadarObjectShape(RadarViewable::Triangle); 50 52 } 51 53 … … 70 72 case BaseState::uncontrolled: 71 73 default: 72 colour = ColourValue(0.5, 0.5, 0. 7, 1.0);74 colour = ColourValue(0.5, 0.5, 0.5, 1.0); 73 75 break; 74 76 } … … 84 86 } 85 87 } 88 89 this->setRadarObjectColour(colour); 90 91 // Call this so bots stop shooting at the base after they converted it 92 for (ObjectList<PawnListener>::iterator it = ObjectList<PawnListener>::begin(); it != ObjectList<PawnListener>::end(); ++it) 93 it->destroyedPawn(this); 86 94 } 87 95 } -
code/trunk/src/orxonox/overlays/hud/HUDRadar.cc
r2896 r3086 64 64 65 65 this->shapeMaterials_[RadarViewable::Dot] = "RadarDot.tga"; 66 this->shapeMaterials_[RadarViewable::Triangle] = "Radar Square.tga";66 this->shapeMaterials_[RadarViewable::Triangle] = "RadarTriangle.tga"; 67 67 this->shapeMaterials_[RadarViewable::Square] = "RadarSquare.tga"; 68 68
Note: See TracChangeset
for help on using the changeset viewer.