script_group.hpp

Go to the documentation of this file.
00001 /* $Id: script_group.hpp 23636 2011-12-19 21:06:06Z truebrain $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * 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.
00006  * 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.
00007  * 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/>.
00008  */
00009 
00012 #ifndef SCRIPT_GROUP_HPP
00013 #define SCRIPT_GROUP_HPP
00014 
00015 #include "script_vehicle.hpp"
00016 #include "../../group_type.h"
00017 
00022 class ScriptGroup : public ScriptObject {
00023 public:
00027   enum GroupID {
00028     /* Note: these values represent part of the in-game static values */
00029     GROUP_ALL     = ::ALL_GROUP,     
00030     GROUP_DEFAULT = ::DEFAULT_GROUP, 
00031     GROUP_INVALID = ::INVALID_GROUP, 
00032   };
00033 
00040   static bool IsValidGroup(GroupID group_id);
00041 
00049   static GroupID CreateGroup(ScriptVehicle::VehicleType vehicle_type);
00050 
00058   static bool DeleteGroup(GroupID group_id);
00059 
00066   static ScriptVehicle::VehicleType GetVehicleType(GroupID group_id);
00067 
00077   static bool SetName(GroupID group_id, Text *name);
00078 
00085   static char *GetName(GroupID group_id);
00086 
00095   static bool EnableAutoReplaceProtection(GroupID group_id, bool enable);
00096 
00103   static bool GetAutoReplaceProtection(GroupID group_id);
00104 
00112   static int32 GetNumEngines(GroupID group_id, EngineID engine_id);
00113 
00125   static bool MoveVehicle(GroupID group_id, VehicleID vehicle_id);
00126 
00135   static bool EnableWagonRemoval(bool keep_length);
00136 
00141   static bool HasWagonRemoval();
00142 
00154   static bool SetAutoReplace(GroupID group_id, EngineID engine_id_old, EngineID engine_id_new);
00155 
00164   static EngineID GetEngineReplacement(GroupID group_id, EngineID engine_id);
00165 
00173   static bool StopAutoReplace(GroupID group_id, EngineID engine_id);
00174 };
00175 
00176 #endif /* SCRIPT_GROUP_HPP */