bool Script::Execute() { // TODO: Move this to a better place if (fTarget != NULL) fTarget.Target()->NewScriptRound(); fLastTrigger = NULL; // for each CR block // for each CO block // check triggers // if any trigger // find response_set block // choose response // execute actions ::node* nextScript = fRootNode; while (nextScript != NULL) { #if DEBUG_SCRIPTS std::cout << "*** SCRIPT START: " << fTarget.Target()->Name(); std::cout << " ***" << std::endl; #endif ::node* condRes = FindNode(BLOCK_CONDITION_RESPONSE, nextScript); while (condRes != NULL) { ::node* condition = FindNode(BLOCK_CONDITION, condRes); while (condition != NULL) { if (!_CheckTriggers(condition)) break; ::node* responseSet = condition->Next(); if (responseSet == NULL) break; if (!_ExecuteActions(responseSet)) { // TODO: When the above method returns false, // The script should stop running. return false; } condition = responseSet->Next(); } condRes = condRes->Next(); }; #if DEBUG_SCRIPTS std::cout << "*** SCRIPT END " << fTarget.Target()->Name(); std::cout << " ***" << std::endl; #endif nextScript = nextScript->next; } SetProcessed(); return true; }
void Game_Vehicle::Refresh() { if (IsInUse()) { SetMapId(Game_Map::GetMapId()); } else if (IsInCurrentMap()) { SetProcessed(true); // RPG_RT compatibility MoveTo(GetX(), GetY()); } switch (type) { case None: break; case Boat: case Ship: SetMoveSpeed(RPG::EventPage::MoveSpeed_normal); break; case Airship: SetMoveSpeed(RPG::EventPage::MoveSpeed_double); break; } }