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_execmode.hpp Switch the script to Execute Mode. */
10 #ifndef SCRIPT_EXECMODE_HPP
11 #define SCRIPT_EXECMODE_HPP
13 #include "script_object.hpp"
16 * Class to switch current mode to Execute Mode.
17 * If you create an instance of this class, the mode will be switched to
18 * Execute. The original mode is stored and recovered from when ever the
19 * instance is destroyed.
20 * In Execute mode all commands you do are executed for real.
23 class ScriptExecMode
: public ScriptObject
{
25 ScriptModeProc
*last_mode
; ///< The previous mode we were in.
26 ScriptObject
*last_instance
; ///< The previous instance of the mode.
30 * The callback proc for Execute mode.
32 static bool ModeProc();
36 * Creating instance of this class switches the build mode to Execute.
37 * @note When the instance is destroyed, it restores the mode that was
38 * current when the instance was created!
43 * Destroying this instance reset the building mode to the mode it was
44 * in when the instance was created.
51 void FinalRelease() override
;
54 #endif /* SCRIPT_EXECMODE_HPP */