script_group.hpp

Go to the documentation of this file.
00001 /* $Id$ */
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 
00021 class ScriptGroup : public ScriptObject {
00022 public:
00026   enum GroupID {
00027     /* Values are important, as they represent the internal state of the game (see group_type.h). */
00028     GROUP_ALL = 0xFFFD,     
00029     GROUP_DEFAULT = 0xFFFE, 
00030     GROUP_INVALID = 0xFFFF, 
00031   };
00032 
00039   static bool IsValidGroup(GroupID group_id);
00040 
00048   static GroupID CreateGroup(ScriptVehicle::VehicleType vehicle_type);
00049 
00057   static bool DeleteGroup(GroupID group_id);
00058 
00065   static ScriptVehicle::VehicleType GetVehicleType(GroupID group_id);
00066 
00077   static bool SetName(GroupID group_id, const char *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 */