From 878489e38dc875e644c5de25f690c4aa64aa2d19 Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 28 Mar 2008 16:34:50 +0000 Subject: [PATCH] (svn r12469) -Codechange: split type related stuff from group.h (and openttd.h) to group_type.h. --- projects/openttd_vs80.vcproj | 4 ++++ projects/openttd_vs90.vcproj | 4 ++++ source.list | 1 + src/autoreplace_gui.cpp | 13 +++++++++++++ src/group.h | 8 +------- src/group_gui.cpp | 14 ++++++++++++++ src/group_type.h | 18 ++++++++++++++++++ src/openttd.h | 2 -- src/order.h | 1 + src/vehicle_base.h | 1 + src/window_gui.h | 27 --------------------------- 11 files changed, 57 insertions(+), 36 deletions(-) create mode 100644 src/group_type.h diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj index 5b61359f0e..5dae4b1d64 100644 --- a/projects/openttd_vs80.vcproj +++ b/projects/openttd_vs80.vcproj @@ -983,6 +983,10 @@ RelativePath=".\..\src\group_gui.h" > + + diff --git a/projects/openttd_vs90.vcproj b/projects/openttd_vs90.vcproj index 98c44fdff8..058034e304 100644 --- a/projects/openttd_vs90.vcproj +++ b/projects/openttd_vs90.vcproj @@ -980,6 +980,10 @@ RelativePath=".\..\src\group_gui.h" > + + diff --git a/source.list b/source.list index 8081cf4d65..46fda4ddc4 100644 --- a/source.list +++ b/source.list @@ -154,6 +154,7 @@ gfx_type.h gfxinit.h group.h group_gui.h +group_type.h gui.h heightmap.h industry.h diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 3ea1cbdb4b..9c6eb3466f 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -23,6 +23,19 @@ #include "table/sprites.h" #include "table/strings.h" +struct replaceveh_d { + byte sel_index[2]; + EngineID sel_engine[2]; + uint16 count[2]; + bool wagon_btnstate; ///< true means engine is selected + EngineList list[2]; + bool update_left; + bool update_right; + bool init_lists; + GroupID sel_group; +}; +assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(replaceveh_d)); + static RailType _railtype_selected_in_replace_gui; static bool _rebuild_left_list; diff --git a/src/group.h b/src/group.h index 2693523acc..da6ec7f2ae 100644 --- a/src/group.h +++ b/src/group.h @@ -5,18 +5,12 @@ #ifndef GROUP_H #define GROUP_H +#include "group_type.h" #include "oldpool.h" #include "player_type.h" #include "vehicle_type.h" #include "engine.h" -enum { - ALL_GROUP = 0xFFFD, - DEFAULT_GROUP = 0xFFFE, ///< ungrouped vehicles are in this group. - INVALID_GROUP = 0xFFFF, -}; - -struct Group; DECLARE_OLD_POOL(Group, Group, 5, 2047) struct Group : PoolItem { diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 8525c883c9..667dcaea9c 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -29,6 +29,20 @@ #include "table/strings.h" #include "table/sprites.h" +struct grouplist_d { + const Group **sort_list; + list_d l; // General list struct +}; +assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(grouplist_d)); + +struct groupveh_d : vehiclelist_d { + GroupID group_sel; + VehicleID vehicle_sel; + + grouplist_d gl; +}; +assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(groupveh_d)); + struct Sorting { Listing aircraft; Listing roadveh; diff --git a/src/group_type.h b/src/group_type.h new file mode 100644 index 0000000000..9d4f269ed1 --- /dev/null +++ b/src/group_type.h @@ -0,0 +1,18 @@ +/* $Id$ */ + +/** @file group_type.h Types of a group. */ + +#ifndef GROUP_TYPE_H +#define GROUP_TYPE_H + +typedef uint16 GroupID; + +enum { + ALL_GROUP = 0xFFFD, + DEFAULT_GROUP = 0xFFFE, ///< ungrouped vehicles are in this group. + INVALID_GROUP = 0xFFFF, +}; + +struct Group; + +#endif /* GROUP_TYPE_H */ diff --git a/src/openttd.h b/src/openttd.h index 1459f5a616..53be15a00b 100644 --- a/src/openttd.h +++ b/src/openttd.h @@ -12,7 +12,6 @@ struct Waypoint; struct ViewPort; struct DrawPixelInfo; -struct Group; typedef byte VehicleOrderID; ///< The index of an order within its current vehicle (not pool related) typedef byte LandscapeID; typedef uint16 EngineID; @@ -24,7 +23,6 @@ typedef EngineID *EngineList; ///< engine list type placeholder acceptable for C typedef uint16 WaypointID; typedef uint16 OrderID; typedef uint16 SignID; -typedef uint16 GroupID; typedef uint16 EngineRenewID; enum GameModes { diff --git a/src/order.h b/src/order.h index 952cfa760d..b9557adce0 100644 --- a/src/order.h +++ b/src/order.h @@ -11,6 +11,7 @@ #include "vehicle_type.h" #include "tile_type.h" #include "date_type.h" +#include "group_type.h" typedef uint16 DestinationID; diff --git a/src/vehicle_base.h b/src/vehicle_base.h index 8bcaa2b475..75982b0a72 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -20,6 +20,7 @@ #include "order.h" #include "cargopacket.h" #include "texteff.hpp" +#include "group_type.h" /** Road vehicle states */ enum RoadVehicleStates { diff --git a/src/window_gui.h b/src/window_gui.h index 97e3b9520e..de3c2f231b 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -331,19 +331,6 @@ struct tooltips_d { }; assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tooltips_d)); -struct replaceveh_d { - byte sel_index[2]; - EngineID sel_engine[2]; - uint16 count[2]; - bool wagon_btnstate; ///< true means engine is selected - EngineList list[2]; - bool update_left; - bool update_right; - bool init_lists; - GroupID sel_group; -}; -assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(replaceveh_d)); - struct depot_d { VehicleID sel; VehicleType type; @@ -443,20 +430,6 @@ struct vehiclelist_d { }; assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vehiclelist_d)); -struct grouplist_d { - const Group **sort_list; - list_d l; // General list struct -}; -assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(grouplist_d)); - -struct groupveh_d : vehiclelist_d { - GroupID group_sel; - VehicleID vehicle_sel; - - grouplist_d gl; -}; -assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(groupveh_d)); - /****************** THESE ARE NOT WIDGET TYPES!!!!! *******************/ enum WindowWidgetBehaviours { WWB_PUSHBUTTON = 1 << 5,