Implementation of the NewGRF class' functions. More...
#include "newgrf_class.h"
#include "table/strings.h"
Go to the source code of this file.
Defines | |
#define | DEFINE_NEWGRF_CLASS_METHOD(type) |
Helper for defining the class method's signatures. | |
#define | INSTANTIATE_NEWGRF_CLASS_METHODS(name, Tspec, Tid, Tmax) |
Force instantiation of the methods so we don't get linker errors. | |
Functions | |
DEFINE_NEWGRF_CLASS_METHOD (void) | |
Reset the class, i.e. | |
DEFINE_NEWGRF_CLASS_METHOD (Tid) | |
Allocate a class with a given global class ID. | |
DEFINE_NEWGRF_CLASS_METHOD (uint) | |
Get the number of allocated classes. | |
DEFINE_NEWGRF_CLASS_METHOD (const Tspec *) | |
Get a spec from the class at a given index. | |
DEFINE_NEWGRF_CLASS_METHOD (int) | |
Translate a UI spec index into a spec index. |
Implementation of the NewGRF class' functions.
Definition in file newgrf_class_func.h.
#define DEFINE_NEWGRF_CLASS_METHOD | ( | type | ) |
template <typename Tspec, typename Tid, Tid Tmax> \ type NewGRFClass<Tspec, Tid, Tmax>
Helper for defining the class method's signatures.
type | The type of the class. |
Definition at line 20 of file newgrf_class_func.h.
#define INSTANTIATE_NEWGRF_CLASS_METHODS | ( | name, | ||
Tspec, | ||||
Tid, | ||||
Tmax | ||||
) |
template void name::ResetClass(); \ template void name::Reset(); \ template Tid name::Allocate(uint32 global_id); \ template void name::Insert(Tspec *spec); \ template void name::Assign(Tspec *spec); \ template NewGRFClass<Tspec, Tid, Tmax> *name::Get(Tid cls_id); \ template uint name::GetClassCount(); \ template uint name::GetUIClassCount(); \ template Tid name::GetUIClass(uint index); \ template const Tspec *name::GetSpec(uint index) const; \ template int name::GetUIFromIndex(int index) const; \ template int name::GetIndexFromUI(int ui_index) const; \ template const Tspec *name::GetByGrf(uint32 grfid, byte localidx, int *index);
Force instantiation of the methods so we don't get linker errors.
Definition at line 218 of file newgrf_class_func.h.
DEFINE_NEWGRF_CLASS_METHOD | ( | void | ) |
Reset the class, i.e.
Assign a spec to one of the classes.
Insert a spec into the class.
Reset the classes, i.e.
clear everything.
spec | The spec to insert. | |
spec | The spec to assign. |
Definition at line 93 of file newgrf_class_func.h.
DEFINE_NEWGRF_CLASS_METHOD | ( | int | ) |
Translate a UI spec index into a spec index.
Translate a spec index into a UI spec index.
ui_index | UI index of the spec. |
index | index of the spec. |
Definition at line 180 of file newgrf_class_func.h.
DEFINE_NEWGRF_CLASS_METHOD | ( | const Tspec * | ) |
Get a spec from the class at a given index.
Retrieve a spec by GRF location.
index | The index where to find the spec. |
grfid | GRF ID of spec. | |
local_id | Index within GRF file of spec. | |
index | Pointer to return the index of the spec in its class. If NULL then not used. |
Definition at line 197 of file newgrf_class_func.h.
DEFINE_NEWGRF_CLASS_METHOD | ( | uint | ) |
Get the number of allocated classes.
Get the number of classes available to the user.
Definition at line 126 of file newgrf_class_func.h.
DEFINE_NEWGRF_CLASS_METHOD | ( | Tid | ) |
Allocate a class with a given global class ID.
Get the nth-class with user available specs.
cls_id | The global class id, such as 'DFLT'. |
index | UI index of a class. |
Definition at line 140 of file newgrf_class_func.h.