* A throw-class that is given when the script wants to suspend. */
| 19 | * A throw-class that is given when the script wants to suspend. |
| 20 | */ |
| 21 | class Script_Suspend { |
| 22 | public: |
| 23 | /** |
| 24 | * Create the suspend exception. |
| 25 | * @param time The amount of ticks to suspend. |
| 26 | * @param callback The callback to call when the script may resume again. |
| 27 | */ |
| 28 | Script_Suspend(int time, Script_SuspendCallbackProc *callback) : |
| 29 | time(time), |
| 30 | callback(callback) |
| 31 | {} |
| 32 | |
| 33 | /** |
| 34 | * Get the amount of ticks the script should be suspended. |
| 35 | * @return The amount of ticks to suspend the script. |
| 36 | */ |
| 37 | int GetSuspendTime() { return time; } |
| 38 | |
| 39 | /** |
| 40 | * Get the callback to call when the script can run again. |
| 41 | * @return The callback function to run. |
| 42 | */ |
| 43 | Script_SuspendCallbackProc *GetSuspendCallback() { return callback; } |
| 44 | |
| 45 | private: |
| 46 | int time; ///< Amount of ticks to suspend the script. |
| 47 | Script_SuspendCallbackProc *callback; ///< Callback function to call when the script can run again. |
| 48 | }; |
| 49 | |
| 50 | #endif /* SCRIPT_SUSPEND_HPP */ |
no outgoing calls
no test coverage detected