Changeset 8798 in orxonox.OLD for branches/network/src
- Timestamp:
- Jun 26, 2006, 3:48:47 PM (18 years ago)
- Location:
- branches/network/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/util/game_rules.cc
r8362 r8798 21 21 22 22 #include "util/mission_goal.h" 23 24 #include "shared_network_data.h" 23 25 24 26 #include "debug.h" … … 86 88 void GameRules::registerKill(const Kill& kill) 87 89 { 90 if ( !SharedNetworkData::getInstance()->isGameServer() ) 91 return; 88 92 PRINTF(0)("Received Event: Kill\n"); 89 93 this->killList.push_back(kill); -
branches/network/src/util/multiplayer_team_deathmatch.cc
r8786 r8798 45 45 46 46 #include "shell_command.h" 47 48 #include "spawning_point.h" 47 49 48 50 … … 237 239 if ( !SharedNetworkData::getInstance()->isGameServer() ) 238 240 return; 241 242 //handle kills 243 for ( std::vector<Kill>::iterator it = this->killList.begin(); it != this->killList.end(); ) 244 { 245 std::vector<Kill>::iterator delit = it; 246 247 onKill( it->getKiller()->getOwner(), it->getVictim()->getOwner() ); 248 249 it++; 250 killList.erase( delit ); 251 } 239 252 240 253 gameStateTimer -= dt; … … 735 748 stats.setScore( stats.getScore() - 1 ); 736 749 737 killedStats.getPlayable()->toList( OM_DEAD );738 739 750 if ( killedUserId == SharedNetworkData::getInstance()->getHostID() ) 740 751 { … … 743 754 } 744 755 745 //TODO respawn killed palyer 756 const std::list<BaseObject*> * list = ClassList::getList( CL_SPAWNING_POINT ); 757 758 assert( list ); 759 760 std::vector<SpawningPoint*> spList; 761 762 for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ ) 763 { 764 SpawningPoint * sp = dynamic_cast<SpawningPoint*>(*it); 765 766 if ( sp->getTeamId() < 0 || sp->getTeamId() == killedStats.getTeamId() ) 767 spList.push_back( sp ); 768 } 746 769 770 int n = spList.size()*rand(); 771 772 spList[n]->pushEntity( killedStats.getPlayable(), 3 ); 747 773 } 748 774 -
branches/network/src/world_entities/spawning_point.cc
r8068 r8798 59 59 { 60 60 this->setClassID(CL_SPAWNING_POINT, "SpawningPoint"); 61 62 this->teamId = -1; 61 63 } 62 64 … … 81 83 LoadParam(root, "delay", this, SpawningPoint, setSpawningDelay) 82 84 .describe("sets the delay of the spawning point"); 85 86 /* load teamId */ 87 LoadParam(root, "teamId", this, SpawningPoint, setTeamId) 88 .describe("sets teamId"); 83 89 84 90 -
branches/network/src/world_entities/spawning_point.h
r8068 r8798 50 50 /** sets the spawning point mode @param mode: the mode */ 51 51 void SpawningPoint::setSpawningMode(int mode) { this->mode = (SpawningPointMode)mode; } 52 53 inline int getTeamId(){ return this->teamId; } 54 inline void setTeamId( int teamId ){ this->teamId = teamId; } 52 55 53 56 void pushEntity(WorldEntity* entity, float delay = 0); … … 72 75 float localTimer; //!< the local timer 73 76 float seed; //!< the random seed of the position 77 int teamId; //!< only spawn players of this team 74 78 ClassID classid; //!< the classid of the entity to spawn 75 79 SpawningPointMode mode; //!< the mode of the spawning point
Note: See TracChangeset
for help on using the changeset viewer.