Changed: #1304: Implementation of basic CGuild functions for guild missions

--HG--
branch : gsoc2011-guildmissions
This commit is contained in:
Fabien_HENON 2011-06-29 14:44:30 +02:00
parent a7f4bfa718
commit 19cfe26032
2 changed files with 60 additions and 11 deletions

View file

@ -34,6 +34,7 @@
#include "outpost_manager/outpost_manager.h"
#include "primitives_parser.h"
#include "modules/shard_unifier_client.h"
#include "mission_manager/mission_manager.h"
/// todo guild remove entity id translator
#include "nel/misc/eid_translator.h"
@ -686,23 +687,54 @@ void CGuild::unregisterGuild()
//
//}
//----------------------------------------------------------------------------
void CGuild::removeMission(CMissionGuild * mission, TMissionResult result)
void CGuild::removeMission( uint idx, TMissionResult result)
{
/// todo guild mission
if ( idx >= _Missions.size() )
return;
/// if the mission was finished, the result is success
if ( _Missions[idx]->getFinished() )
{
if ( _Missions[idx]->getMissionSuccess() )
result = mr_success;
else
result = mr_fail;
}
CMissionTemplate *tpl = CMissionManager::getInstance()->getTemplate(_Missions[idx]->getTemplateId());
if ( tpl && !tpl->Tags.NoList )
{
_Missions[idx]->clearUsersJournalEntry();
}
CMissionManager::getInstance()->deInstanciateMission(_Missions[idx]);
delete _Missions[idx];
_Missions.erase(_Missions.begin() + idx) ;
}
//----------------------------------------------------------------------------
void CGuild::addSuccessfulMission(CMissionTemplate * templ)
{
/// todo guild mission
/*TMissionHistory &mh = _MissionHistories[templ.Alias];
mh.Successfull = true;*/
/// TODO: Add the mission histories
}
//----------------------------------------------------------------------------
bool CGuild::processMissionEvent( CMissionEvent & event, TAIAlias alias )
bool CGuild::processMissionEvent( CMissionEvent & event, TAIAlias alias)
{
/// todo guild mission
return true;
}
//----------------------------------------------------------------------------
bool CGuild::isMissionSuccessfull(TAIAlias alias)
{
/*std::map<TAIAlias, TMissionHistory>::iterator it(_MissionHistories.find(alias));
if (it != _MissionHistories.end())
return it->second.Successfull;*/
/// TODO: Add the mission histories
return false;
}

View file

@ -27,6 +27,7 @@
#include "outpost_manager/outpost_guild_db_updater.h"
#include "guild_interface.h"
#include "database_guild.h"
#include "mission_manager/mission_guild.h"
class CMissionGuild;
class CGuildMember;
@ -176,17 +177,30 @@ public:
///\name Mission management
//@{
void removeMission(CMissionGuild * mission, TMissionResult result);
void removeMission(CMissionGuild * mission, TMissionResult result)
{
for (uint i = 0; i < _Missions.size(); i++)
{
if ( _Missions[i] == mission )
{
removeMission(i, result);
}
}
}
void removeMission( uint idx, TMissionResult result);
void addSuccessfulMission(CMissionTemplate * templ);
bool processMissionEvent( CMissionEvent & event, TAIAlias alias = CAIAliasTranslator::Invalid);
bool isMissionSuccessfull(TAIAlias alias);
///\return the mission
inline std::vector<CMissionGuild*> & getMissions()
{
return std::vector<CMissionGuild*>();
// To Do
return _Missions;
}
void addMission(CMissionGuild* guildMission)
{
_Missions.push_back(guildMission);
guildMission->updateUsersJournalEntry();
}
void addMission(CMissionGuild* guildMission) {}
bool isMissionSuccessfull(TAIAlias alias) { return false; }
//@}
/// inventory management
@ -359,6 +373,9 @@ private:
/// list of outposts challenged by guild
std::vector<TAIAlias> _ChallengedOutposts;
///the missions took by the guild
std::vector<CMissionGuild*> _Missions;
NLMISC_COMMAND_FRIEND( guildDB );
};
#endif // RY_GUILD_H