Changeset 10821 for code/branches/cpp11_v2/src/modules/questsystem
- Timestamp:
- Nov 21, 2015, 7:05:53 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/modules/questsystem
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/modules/questsystem/GlobalQuest.cc
r10765 r10821 94 94 95 95 // Iterate through all players possessing this Quest. 96 for( std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)97 QuestEffect::invokeEffects( *it, this->getFailEffectList());96 for(const auto & elem : players_) 97 QuestEffect::invokeEffects(elem, this->getFailEffectList()); 98 98 99 99 return true; … … 119 119 120 120 // Iterate through all players possessing the Quest. 121 for( std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)122 QuestEffect::invokeEffects( *it, this->getCompleteEffectList());121 for(const auto & elem : players_) 122 QuestEffect::invokeEffects(elem, this->getCompleteEffectList()); 123 123 124 124 Quest::complete(player); … … 242 242 { 243 243 int i = index; 244 for ( std::list<QuestEffect*>::const_iterator effect = this->rewards_.begin(); effect != this->rewards_.end(); ++effect)244 for (const auto & elem : this->rewards_) 245 245 { 246 246 if(i == 0) 247 return *effect;247 return elem; 248 248 249 249 i--; -
code/branches/cpp11_v2/src/modules/questsystem/Quest.cc
r10765 r10821 190 190 191 191 // Iterate through all subquests. 192 for ( std::list<Quest*>::const_iterator subQuest = this->subQuests_.begin(); subQuest != this->subQuests_.end(); ++subQuest)192 for (const auto & elem : this->subQuests_) 193 193 { 194 194 if(i == 0) // We're counting down... 195 return *subQuest;195 return elem; 196 196 197 197 i--; … … 214 214 215 215 // Iterate through all QuestHints. 216 for ( std::list<QuestHint*>::const_iterator hint = this->hints_.begin(); hint != this->hints_.end(); ++hint)216 for (const auto & elem : this->hints_) 217 217 { 218 218 if(i == 0) // We're counting down... 219 return *hint;219 return elem; 220 220 221 221 i--; … … 237 237 238 238 // Iterate through all fail QuestEffects. 239 for ( std::list<QuestEffect*>::const_iterator effect = this->failEffects_.begin(); effect != this->failEffects_.end(); ++effect)239 for (const auto & elem : this->failEffects_) 240 240 { 241 241 if(i == 0) // We're counting down... 242 return *effect;242 return elem; 243 243 244 244 i--; … … 260 260 261 261 // Iterate through all complete QuestEffects. 262 for ( std::list<QuestEffect*>::const_iterator effect = this->completeEffects_.begin(); effect != this->completeEffects_.end(); ++effect)262 for (const auto & elem : this->completeEffects_) 263 263 { 264 264 if(i == 0) // We're counting down... 265 return *effect;265 return elem; 266 266 267 267 i--; -
code/branches/cpp11_v2/src/modules/questsystem/QuestEffect.cc
r10624 r10821 74 74 orxout(verbose, context::quests) << "Invoking QuestEffects on player: " << player << " ." << endl; 75 75 76 for ( std::list<QuestEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)77 temp = temp && ( *effect)->invoke(player);76 for (auto & effects_effect : effects) 77 temp = temp && (effects_effect)->invoke(player); 78 78 79 79 return temp; -
code/branches/cpp11_v2/src/modules/questsystem/QuestEffectBeacon.cc
r10765 r10821 236 236 { 237 237 int i = index; 238 for ( std::list<QuestEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)238 for (const auto & elem : this->effects_) 239 239 { 240 240 if(i == 0) 241 return *effect;241 return elem; 242 242 243 243 i--; -
code/branches/cpp11_v2/src/modules/questsystem/QuestListener.cc
r10765 r10821 97 97 /* static */ void QuestListener::advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status) 98 98 { 99 for ( std::list<QuestListener*>::iterator it = listeners.begin(); it != listeners.end(); ++it) // Iterate through all QuestListeners100 { 101 QuestListener* listener = *it;99 for (auto listener : listeners) // Iterate through all QuestListeners 100 { 101 102 102 if(listener->getMode() == status || listener->getMode() == QuestListener::ALL) // Check whether the status change affects the give QuestListener. 103 103 listener->execute(); -
code/branches/cpp11_v2/src/modules/questsystem/QuestManager.cc
r10765 r10821 235 235 { 236 236 int numQuests = 0; 237 for( std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)238 { 239 if( it->second->getParentQuest() == nullptr && !it->second->isInactive(player))237 for(auto & elem : this->questMap_) 238 { 239 if(elem.second->getParentQuest() == nullptr && !elem.second->isInactive(player)) 240 240 numQuests++; 241 241 } … … 255 255 Quest* QuestManager::getRootQuest(PlayerInfo* player, int index) 256 256 { 257 for( std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)258 { 259 if( it->second->getParentQuest() == nullptr && !it->second->isInactive(player) && index-- == 0)260 return it->second;257 for(auto & elem : this->questMap_) 258 { 259 if(elem.second->getParentQuest() == nullptr && !elem.second->isInactive(player) && index-- == 0) 260 return elem.second; 261 261 } 262 262 return nullptr; … … 280 280 std::list<Quest*> quests = quest->getSubQuestList(); 281 281 int numQuests = 0; 282 for( std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)283 { 284 if(!( *it)->isInactive(player))282 for(auto & quest : quests) 283 { 284 if(!(quest)->isInactive(player)) 285 285 numQuests++; 286 286 } … … 304 304 305 305 std::list<Quest*> quests = quest->getSubQuestList(); 306 for( std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)307 { 308 if(!( *it)->isInactive(player) && index-- == 0)309 return *it;306 for(auto & quest : quests) 307 { 308 if(!(quest)->isInactive(player) && index-- == 0) 309 return quest; 310 310 } 311 311 return nullptr; … … 326 326 std::list<QuestHint*> hints = quest->getHintsList(); 327 327 int numHints = 0; 328 for( std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)329 { 330 if(( *it)->isActive(player))328 for(auto & hint : hints) 329 { 330 if((hint)->isActive(player)) 331 331 numHints++; 332 332 } … … 349 349 { 350 350 std::list<QuestHint*> hints = quest->getHintsList(); 351 for( std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)352 { 353 if(( *it)->isActive(player) && index-- == 0)354 return *it;351 for(auto & hint : hints) 352 { 353 if((hint)->isActive(player) && index-- == 0) 354 return hint; 355 355 } 356 356 return nullptr; -
code/branches/cpp11_v2/src/modules/questsystem/effects/AddReward.cc
r10765 r10821 84 84 { 85 85 int i = index; 86 for ( std::list<Rewardable*>::const_iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward)86 for (const auto & elem : this->rewards_) 87 87 { 88 88 if(i == 0) 89 return *reward;89 return elem; 90 90 i--; 91 91 } … … 106 106 107 107 bool temp = true; 108 for ( std::list<Rewardable*>::iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward)109 temp = temp && ( *reward)->reward(player);108 for (auto & elem : this->rewards_) 109 temp = temp && (elem)->reward(player); 110 110 111 111 orxout(verbose, context::quests) << "Rewardable successfully added to player." << player << " ." << endl;
Note: See TracChangeset
for help on using the changeset viewer.