From 8ec732ece9b0d831304dcc8ca0f9783e259d3014 Mon Sep 17 00:00:00 2001 From: Fabien_HENON Date: Tue, 19 Jul 2011 18:39:29 +0200 Subject: [PATCH] Changed: #1304: Parsing the "guild" parameter for the actions that need it. --- .../mission_manager/mission_action.cpp | 82 ++++++++++++++++--- 1 file changed, 72 insertions(+), 10 deletions(-) diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp index eb627551d..f8a762f95 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp @@ -511,9 +511,9 @@ class CMissionActionRecvItem : public IMissionAction { _SourceLine = line; bool ret = true; - if ( script.size() != 2 && script.size() != 3 ) + if ( script.size() != 2 && script.size() != 3 && script.size() != 4) { - MISLOGSYNTAXERROR(" [] [][:npc_name][:group]"); + MISLOGSYNTAXERROR(" [] [][:npc_name][:group][:guild]"); return false; } vector args; @@ -569,6 +569,17 @@ class CMissionActionRecvItem : public IMissionAction _Group = true; } + // We check for the guild option + _Guild = false; + for (std::vector< std::string >::const_iterator it = script.begin(); it != script.end(); ++it) + { + if (CMissionParser::getNoBlankString(*it) == "guild") + { + _Guild = true; + break; + } + } + if ( _Quantity == 0 ) { @@ -760,6 +771,7 @@ class CMissionActionRecvItem : public IMissionAction uint16 _Quantity; CSheetId _SheetId; bool _Group; + bool _Guild; MISSION_ACTION_GETNEWPTR(CMissionActionRecvItem) }; @@ -772,9 +784,9 @@ class CMissionActionRecvNamedItem : public IMissionAction bool buildAction ( uint32 line, const std::vector< std::string > & script, CMissionGlobalParsingData & globalData, CMissionSpecificParsingData & missionData) { _SourceLine = line; - if ( script.size() != 2 && script.size() != 3 ) + if ( script.size() != 2 && script.size() != 3 && script.size() != 4) { - MISLOGSYNTAXERROR(" [] [:group]"); + MISLOGSYNTAXERROR(" [] [:group] [:guild]"); return false; } vector args; @@ -813,6 +825,17 @@ class CMissionActionRecvNamedItem : public IMissionAction _Group = true; } + // We check for the guild option + _Guild = false; + for (std::vector< std::string >::const_iterator it = script.begin(); it != script.end(); ++it) + { + if (CMissionParser::getNoBlankString(*it) == "guild") + { + _Guild = true; + break; + } + } + if ( _Quantity == 0 ) { MISLOGERROR("quantity = 0"); @@ -945,6 +968,7 @@ class CMissionActionRecvNamedItem : public IMissionAction std::string _NamedItem; uint16 _Quantity; bool _Group; + bool _Guild; MISSION_ACTION_GETNEWPTR(CMissionActionRecvNamedItem) }; @@ -1043,9 +1067,9 @@ class CMissionActionDestroyItem : { // Parse the line _SourceLine = line; - if ( script.size() != 2 && script.size() != 3) + if ( script.size() != 2 && script.size() != 3 && script.size() != 4) { - MISLOGSYNTAXERROR(" [] []:[npc_name]"); + MISLOGSYNTAXERROR(" [] []:[npc_name] [:guild]"); return false; } @@ -1060,6 +1084,17 @@ class CMissionActionDestroyItem : ret= false; } + // We check for the guild option + _Guild = false; + for (std::vector< std::string >::const_iterator it = script.begin(); it != script.end(); ++it) + { + if (CMissionParser::getNoBlankString(*it) == "guild") + { + _Guild = true; + break; + } + } + return ret; } @@ -1104,6 +1139,7 @@ class CMissionActionDestroyItem : } }; TAIAlias _Npc; + bool _Guild; MISSION_ACTION_GETNEWPTR(CMissionActionDestroyItem) }; @@ -1607,9 +1643,9 @@ class CMissionActionRecvMoney : public IMissionAction { bool ret = true; _SourceLine = line; - if ( script.size() != 2 ) + if ( script.size() != 2 && script.size() != 3) { - MISLOGSYNTAXERROR(" OR *[;]"); + MISLOGSYNTAXERROR(" [: guild] OR *[;]"); return false; } @@ -1637,6 +1673,18 @@ class CMissionActionRecvMoney : public IMissionAction ret = false; } } + + // We check for the guild option + _Guild = false; + for (std::vector< std::string >::const_iterator it = script.begin(); it != script.end(); ++it) + { + if (CMissionParser::getNoBlankString(*it) == "guild") + { + _Guild = true; + break; + } + } + return ret; } @@ -1663,6 +1711,7 @@ class CMissionActionRecvMoney : public IMissionAction } }; uint _Amount; + bool _Guild; MISSION_ACTION_GETNEWPTR(CMissionActionRecvMoney) }; @@ -1675,9 +1724,9 @@ class CMissionActionRecvFame : public IMissionAction bool buildAction ( uint32 line, const std::vector< std::string > & script, CMissionGlobalParsingData & globalData, CMissionSpecificParsingData & missionData) { _SourceLine = line; - if ( script.size() != 2 ) + if ( script.size() != 2 && script.size() != 3) { - MISLOGSYNTAXERROR(" "); + MISLOGSYNTAXERROR(" [:guild]"); return false; } vector args; @@ -1700,6 +1749,18 @@ class CMissionActionRecvFame : public IMissionAction MISLOGERROR("fame = 0"); return false; } + + // We check for the guild option + _Guild = false; + for (std::vector< std::string >::const_iterator it = script.begin(); it != script.end(); ++it) + { + if (CMissionParser::getNoBlankString(*it) == "guild") + { + _Guild = true; + break; + } + } + return true; } @@ -1722,6 +1783,7 @@ class CMissionActionRecvFame : public IMissionAction }; uint32 _Faction; sint32 _Value; + bool _Guild; MISSION_ACTION_GETNEWPTR(CMissionActionRecvFame) };