From 6462021f14f696ba11fda2609d9d19653ba7549b Mon Sep 17 00:00:00 2001 From: Fabien_HENON Date: Mon, 25 Jul 2011 12:27:19 +0200 Subject: [PATCH] Changed: #1304: Update of CMissionStepDoMissions to support missions done several times (by different guild members) --HG-- branch : gsoc2011-guildmissions --- .../mission_manager/mission_step_misc.cpp | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_misc.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_misc.cpp index ff8496eba..2078c6c6a 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_misc.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_misc.cpp @@ -1141,7 +1141,13 @@ MISSION_REGISTER_STEP(CMissionStepCast,"cast") // ---------------------------------------------------------------------------- class CMissionStepDoMissions : public IMissionStepTemplate { - std::vector< std::string > _Missions; + struct MissionNb + { + std::string Mission; + uint32 NbNeedCompletion; + }; + + std::vector< MissionNb > _Missions; virtual bool buildStep( uint32 line, const std::vector< std::string > & script, CMissionGlobalParsingData & globalData, CMissionSpecificParsingData & missionData ) { @@ -1158,7 +1164,13 @@ class CMissionStepDoMissions : public IMissionStepTemplate _Missions.resize(subs.size()); for ( uint i = 0; i < subs.size(); i++ ) { - _Missions[i] = CMissionParser::getNoBlankString( subs[i] ); + std::vector< std::string > params; + NLMISC::splitString( subs[i]," \t", params ); + _Missions[i].Mission = CMissionParser::getNoBlankString( params[0] ); + if (params.size() > 1) + NLMISC::fromString(params[1], _Missions[i].NbNeedCompletion); + else + _Missions[i].NbNeedCompletion = 1; } return true; } @@ -1168,7 +1180,7 @@ class CMissionStepDoMissions : public IMissionStepTemplate if ( event.Type == CMissionEvent::MissionDone ) { CMissionEventMissionDone & eventSpe = (CMissionEventMissionDone&)event; - TAIAlias alias = CAIAliasTranslator::getInstance()->getMissionUniqueIdFromName( _Missions[subStepIndex] ); + TAIAlias alias = CAIAliasTranslator::getInstance()->getMissionUniqueIdFromName( _Missions[subStepIndex].Mission ); if ( eventSpe.Mission == alias ) { LOGMISSIONSTEPSUCCESS("mission"); @@ -1181,6 +1193,12 @@ class CMissionStepDoMissions : public IMissionStepTemplate void getInitState( std::vector& ret ) { ret.resize( _Missions.size(), 1 ); + uint32 i = 0; + for (std::vector::const_iterator it = _Missions.begin(); it != _Missions.end(); ++it) + { + ret[i] = it->NbNeedCompletion; + i++; + } } virtual void getTextParams( uint & nbSubSteps,const std::string* & textPtr,TVectorParamCheck& retParams, const std::vector& subStepStates)