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 classes, i.e. | |
DEFINE_NEWGRF_CLASS_METHOD (Tid) | |
Allocate a class with a given global class ID. | |
DEFINE_NEWGRF_CLASS_METHOD (StringID) | |
Get the name of a particular class. | |
DEFINE_NEWGRF_CLASS_METHOD (uint) | |
Get the number of allocated classes. | |
DEFINE_NEWGRF_CLASS_METHOD (const Tspec *) | |
Get a spec from a particular class at a given 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::Reset(); \ template Tid name::Allocate(uint32 global_id); \ template void name::SetName(Tid cls_id, StringID name); \ template void name::Assign(Tspec *spec); \ template StringID name::GetName(Tid cls_id); \ template uint name::GetCount(); \ template uint name::GetCount(Tid cls_id); \ template const Tspec *name::Get(Tid cls_id, uint index); \ 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 174 of file newgrf_class_func.h.
DEFINE_NEWGRF_CLASS_METHOD | ( | const Tspec * | ) |
Get a spec from a particular class at a given index.
Retrieve a spec by GRF location.
cls_id | The class to get the spec from. | |
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 153 of file newgrf_class_func.h.
DEFINE_NEWGRF_CLASS_METHOD | ( | uint | ) |
Get the number of allocated classes.
Get the number of allocated specs within a particular class.
cls_id | The class to get the size of. |
Definition at line 124 of file newgrf_class_func.h.
DEFINE_NEWGRF_CLASS_METHOD | ( | StringID | ) |
Get the name of a particular class.
cls_id | The class to get the name of. |
Definition at line 101 of file newgrf_class_func.h.
DEFINE_NEWGRF_CLASS_METHOD | ( | Tid | ) |
Allocate a class with a given global class ID.
cls_id | The global class id, such as 'DFLT'. |
Definition at line 50 of file newgrf_class_func.h.
References grfmsg().
DEFINE_NEWGRF_CLASS_METHOD | ( | void | ) |
Reset the classes, i.e.
Assign a spec to one of the classes.
Set the name of a particular class.
clear everything.
cls_id | The id for the class. |
name | The new name for the class. | |
spec | The spec to assign. |
Definition at line 84 of file newgrf_class_func.h.
References NewGRFClass< Tspec, Tid, Tmax >::count, ReallocT(), and NewGRFClass< Tspec, Tid, Tmax >::spec.