コード例 #1
0
ファイル: ai_heroes.cpp プロジェクト: gerstrong/fheroes2plus
void AI::HeroesTurn(Heroes & hero)
{
    DEBUG(DBG_AI, DBG_TRACE, hero.GetName() << ", start: " <<
	    (hero.Modes(Heroes::SHIPMASTER) ? "SHIPMASTER," : "") <<
            (hero.Modes(AI::HEROES_SCOUTER) ? "SCOUTER," : "") <<
            (hero.Modes(AI::HEROES_HUNTER) ? "HUNTER," : "") <<
            (hero.Modes(Heroes::PATROL) ? "PATROL," : "") <<
            (hero.Modes(AI::HEROES_WAITING) ? "WAITING," : "") <<
            (hero.Modes(AI::HEROES_STUPID) ? "STUPID" : ""));

    Interface::StatusWindow & status = Interface::Basic::Get().GetStatusWindow();

    while(hero.MayStillMove() &&
	    !hero.Modes(AI::HEROES_WAITING|AI::HEROES_STUPID))
    {
        // turn indicator
        status.RedrawTurnProgress(3);

        // get task for heroes
        AI::HeroesGetTask(hero);

        // turn indicator
        status.RedrawTurnProgress(5);

        // heroes AI turn
        AI::HeroesMove(hero);

	// turn indicator
        status.RedrawTurnProgress(7);
    }

    DEBUG(DBG_AI, DBG_TRACE, hero.GetName() << ", end");
}
コード例 #2
0
bool AI::HeroesCanMove(const Heroes & hero)
{
    return hero.MayStillMove() && ! hero.Modes(HEROES_MOVED);
}