void Interface::Basic::EventDefaultAction(void) { Heroes* hero = GetFocusHeroes(); if(hero) { const Maps::Tiles & tile = world.GetTiles(hero->GetIndex()); // 1. action object if(MP2::isActionObject(hero->GetMapsObject(), hero->isShipMaster()) && (! MP2::isMoveObject(hero->GetMapsObject()) || hero->CanMove())) { hero->Action(hero->GetIndex()); if(MP2::OBJ_STONELIGHTS == tile.GetObject(false) || MP2::OBJ_WHIRLPOOL == tile.GetObject(false)) SetRedraw(REDRAW_HEROES); SetRedraw(REDRAW_GAMEAREA); } else // 2. continue if(hero->GetPath().isValid()) hero->SetMove(true); else // 3. hero dialog Game::OpenHeroesDialog(*hero); } else // 4. town dialog if(GetFocusCastle()) { Game::OpenCastleDialog(*GetFocusCastle()); } }
void Heroes::MoveStep(Heroes & hero, s32 index_from, s32 index_to, bool newpos) { if(newpos) { hero.Move2Dest(index_to); hero.GetPath().PopFront(); // possible hero is die if(!hero.isFreeman() && index_to == hero.GetPath().GetDestinationIndex()) { hero.GetPath().Reset(); hero.Action(index_to); hero.SetMove(false); } } else { hero.ApplyPenaltyMovement(); hero.GetPath().Reset(); hero.Action(index_to); hero.SetMove(false); } }