Changed: #1304: Checks in the mission compiler if the do_mission objective is correct (for a guild mission) when we add a number (the number of members from the guild needed to complete the mission) after a mission name

--HG--
branch : gsoc2011-guildmissions
This commit is contained in:
Fabien_HENON 2011-07-23 18:14:31 +02:00
parent 9f05d66a81
commit 78dbefb759

View file

@ -3153,9 +3153,12 @@ class CContentMission: public CContentObjective
} }
public: public:
CContentMission(): _Prim(0) {}
void init(CMissionData &md, IPrimitive *prim) void init(CMissionData &md, IPrimitive *prim)
{ {
_Missions = md.getPropertyArray(prim, "mission_names", true, false); _Missions = md.getPropertyArray(prim, "mission_names", true, false);
_Prim = prim;
CContentObjective::init(md, prim); CContentObjective::init(md, prim);
} }
@ -3172,6 +3175,14 @@ public:
ret += _Missions[i]; ret += _Missions[i];
if (i < _Missions.size()-1) if (i < _Missions.size()-1)
ret += "; "; ret += "; ";
// We check to see if we specified a number after the mission name. If so, we check if it's a guild mission
std::size_t pos = _Missions[i].find_first_of(" \t");
if (pos != std::string::npos && !md.isGuildMission())
{
string err = toString("primitive(%s): CContentMission: Number of members needed to complete the mission specified but the mission is not a guild mission.", _Prim->getName().c_str());
throw EParseException(_Prim, err.c_str());
}
} }
// Add the 'nb_guild_members_needed' parameter if needed // Add the 'nb_guild_members_needed' parameter if needed
//ret += CContentObjective::genNbGuildMembersNeededOption(md); //ret += CContentObjective::genNbGuildMembersNeededOption(md);
@ -3179,6 +3190,8 @@ public:
return ret; return ret;
} }
IPrimitive *_Prim;
}; };
REGISTER_STEP_CONTENT(CContentMission, "do_mission"); REGISTER_STEP_CONTENT(CContentMission, "do_mission");