예제 #1
0
iHero* iTavernCtlCnst::RecruitVisitor()
{
	check(CanRecruit());
	iPlayer* pOwner = gGame.Map().FindPlayer(pCastle->Owner());
	check(pOwner);
	m_bRecruited = true;
	return pOwner->RecruitTavernVisitor(pCastle);
}
bool nobBaseWarehouse::TryRecruitJob(const Job job)
{
    RTTR_Assert(!helpers::contains(SOLDIER_JOBS, job) && job != JOB_PACKDONKEY);
    if(!CanRecruit(job))
        return false;

    // All ok, recruit him
    if(JOB_CONSTS[job].tool != GD_NOTHING)
    {
        inventory.Remove(JOB_CONSTS[job].tool);
        gwg->GetPlayer(player).DecreaseInventoryWare(JOB_CONSTS[job].tool, 1);
    }

    inventory.Remove(JOB_HELPER);
    gwg->GetPlayer(player).DecreaseInventoryJob(JOB_HELPER, 1);

    inventory.Add(job);
    gwg->GetPlayer(player).IncreaseInventoryJob(job, 1);
    return true;
}