Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // char.h
- public:
- int GetHorseActionTime();
- void SetHorseActionTime(const int iTimeSec)
- {
- m_iHorseActionTime = iTimeSec;
- m_iHorseActionLastTime = thecore_pulse();
- }
- private:
- int m_iHorseActionTime;
- int m_iHorseActionLastTime;
- // char.cpp
- int CHARACTER::GetHorseActionTime()
- {
- const int iCurrentTime = thecore_pulse() - m_iHorseActionLastTime;
- const int iWaitTimeSec = PASSES_PER_SEC(m_iHorseActionTime);
- if (iWaitTimeSec >= iCurrentTime)
- {
- ChatPacket(CHAT_TYPE_INFO, "Wait %d sec(s)!", m_iHorseActionTime);
- return iWaitTimeSec != 0;
- }
- return 0;
- }
- // char_horse.cpp
- bool CHARACTER::StartRiding()
- {
- if (GetHorseActionTime() != 0)
- {
- return false;
- }
- /*
- [...]
- */
- if (GetHorseActionTime() == 0)
- {
- SetHorseActionTime(10 /*sec(s)*/);
- }
- return true;
- }
Add Comment
Please, Sign In to add comment