2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 /** @file script_suspend.hpp The Script_Suspend tracks the suspension of a script. */
10 #ifndef SCRIPT_SUSPEND_HPP
11 #define SCRIPT_SUSPEND_HPP
14 * The callback function when a script suspends.
16 typedef void (Script_SuspendCallbackProc
)(class ScriptInstance
*instance
);
19 * A throw-class that is given when the script wants to suspend.
21 class Script_Suspend
{
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.
28 Script_Suspend(int time
, Script_SuspendCallbackProc
*callback
) :
34 * Get the amount of ticks the script should be suspended.
35 * @return The amount of ticks to suspend the script.
37 int GetSuspendTime() { return time
; }
40 * Get the callback to call when the script can run again.
41 * @return The callback function to run.
43 Script_SuspendCallbackProc
*GetSuspendCallback() { return callback
; }
46 int time
; ///< Amount of ticks to suspend the script.
47 Script_SuspendCallbackProc
*callback
; ///< Callback function to call when the script can run again.
50 #endif /* SCRIPT_SUSPEND_HPP */