virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Integer range = runtime[0].mFloat; runtime.pop(); Interpreter::Type_Integer duration = runtime[0].mFloat; runtime.pop(); Interpreter::Type_Integer time = runtime[0].mFloat; runtime.pop(); std::vector<int> idleList; for (int i=2; i<10 && arg0; ++i) { Interpreter::Type_Integer idleValue = runtime[0].mInteger; idleList.push_back(idleValue); runtime.pop(); --arg0; } // discard additional arguments (reset), because we have no idea what they mean. for (unsigned int i=0; i<arg0; ++i) runtime.pop(); MWMechanics::AiWander wanderPackage(range, duration, time, idleList); MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSequence().stack(wanderPackage); }
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Integer range = static_cast<Interpreter::Type_Integer>(runtime[0].mFloat); runtime.pop(); Interpreter::Type_Integer duration = static_cast<Interpreter::Type_Integer>(runtime[0].mFloat); runtime.pop(); Interpreter::Type_Integer time = static_cast<Interpreter::Type_Integer>(runtime[0].mFloat); runtime.pop(); std::vector<unsigned char> idleList; bool repeat = false; for(int i=1; i < 10 && arg0; ++i) { if(!repeat) repeat = true; Interpreter::Type_Integer idleValue = runtime[0].mInteger; idleValue = std::min(255, std::max(0, idleValue)); idleList.push_back(idleValue); runtime.pop(); --arg0; } if(arg0) { repeat = runtime[0].mInteger != 0; runtime.pop(); --arg0; } // discard additional arguments (reset), because we have no idea what they mean. for (unsigned int i=0; i<arg0; ++i) runtime.pop(); MWMechanics::AiWander wanderPackage(range, duration, time, idleList, repeat); ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(wanderPackage, ptr); }