#include "group_type.h"
#include "core/pool_type.hpp"
#include "company_type.h"
#include "vehicle_type.h"
#include "engine_type.h"
Go to the source code of this file.
Data Structures | |
struct | Group |
Defines | |
#define | FOR_ALL_GROUPS_FROM(var, start) FOR_ALL_ITEMS_FROM(Group, group_index, var, start) |
#define | FOR_ALL_GROUPS(var) FOR_ALL_GROUPS_FROM(var, 0) |
Typedefs | |
typedef Pool< Group, GroupID, 16, 64000 > | GroupPool |
Functions | |
static bool | IsDefaultGroupID (GroupID index) |
static bool | IsAllGroupID (GroupID id_g) |
Checks if a GroupID stands for all vehicles of a company. | |
static uint | GetGroupArraySize () |
Get the current size of the GroupPool. | |
uint | GetGroupNumEngines (CompanyID company, GroupID id_g, EngineID id_e) |
Get the number of engines with EngineID id_e in the group with GroupID id_g. | |
static void | IncreaseGroupNumVehicle (GroupID id_g) |
static void | DecreaseGroupNumVehicle (GroupID id_g) |
void | InitializeGroup () |
void | SetTrainGroupID (Train *v, GroupID grp) |
Affect the groupID of a train to new_g. | |
void | UpdateTrainGroupID (Train *v) |
Recalculates the groupID of a train. | |
void | RemoveVehicleFromGroup (const Vehicle *v) |
Decrease the num_vehicle variable before delete an front engine from a group. | |
void | RemoveAllGroupsForCompany (const CompanyID company) |
Variables | |
GroupPool | _group_pool |
GroupID | _new_group_id |
Definition in file group.h.
Get the number of engines with EngineID id_e in the group with GroupID id_g.
company | The company the group belongs to | |
id_g | The GroupID of the group used | |
id_e | The EngineID of the engine to count |
Definition at line 411 of file group_cmd.cpp.
Referenced by DrawEngineList(), ReplaceVehicleWindow::GenerateReplaceVehList(), AIGroup::GetNumEngines(), and InvalidateAutoreplaceWindow().
static bool IsAllGroupID | ( | GroupID | id_g | ) | [inline, static] |
Checks if a GroupID stands for all vehicles of a company.
id_g | The GroupID to check |
Definition at line 49 of file group.h.
Referenced by CmdSetAutoReplace().
void RemoveVehicleFromGroup | ( | const Vehicle * | v | ) |
Decrease the num_vehicle variable before delete an front engine from a group.
v | FrontEngine of the train we want to remove. |
Definition at line 358 of file group_cmd.cpp.
Referenced by CmdMoveRailVehicle().
Affect the groupID of a train to new_g.
v | First vehicle of the chain. | |
new_g | index of array group |
Definition at line 372 of file group_cmd.cpp.
References Train::IsFrontEngine(), SpecializedVehicle< T, Type >::Next(), SetWindowDirty(), UpdateNumEngineGroup(), and VEH_TRAIN.
Referenced by CmdAddVehicleGroup(), and CmdMoveRailVehicle().
void UpdateTrainGroupID | ( | Train * | v | ) |
Recalculates the groupID of a train.
Should be called each time a vehicle is added to/removed from the chain,.
Called in CmdBuildRailVehicle, CmdBuildRailWagon, CmdMoveRailVehicle, CmdSellRailWagon
v | First vehicle of the chain. |
Definition at line 396 of file group_cmd.cpp.
References DEFAULT_GROUP, Train::IsFreeWagon(), Train::IsFrontEngine(), SpecializedVehicle< T, Type >::Next(), SetWindowDirty(), UpdateNumEngineGroup(), and VEH_TRAIN.
Referenced by CmdBuildRailVehicle(), CmdBuildRailWagon(), and NormaliseTrainHead().