Handling of generic feature callbacks. More...
#include "stdafx.h"#include "debug.h"#include "newgrf.h"#include "newgrf_spritegroup.h"#include "industrytype.h"#include "core/bitmath_func.hpp"#include <list>Go to the source code of this file.
Data Structures | |
| struct | GenericCallback |
Typedefs | |
|
typedef std::list < GenericCallback > | GenericCallbackList |
Functions | |
| void | ResetGenericCallbacks () |
| Reset all generic feature callback sprite groups. | |
| void | AddGenericCallback (uint8 feature, const GRFFile *file, const SpriteGroup *group) |
| Add a generic feature callback sprite group to the appropriate feature list. | |
| static uint32 | GenericCallbackGetRandomBits (const ResolverObject *object) |
| static uint32 | GenericCallbackGetTriggers (const ResolverObject *object) |
| static void | GenericCallbackSetTriggers (const ResolverObject *object, int triggers) |
| static uint32 | GenericCallbackGetVariable (const ResolverObject *object, byte variable, byte parameter, bool *available) |
| static const SpriteGroup * | GenericCallbackResolveReal (const ResolverObject *object, const RealSpriteGroup *group) |
| static void | NewGenericResolver (ResolverObject *res) |
| static uint16 | GetGenericCallbackResult (uint8 feature, ResolverObject *object, const GRFFile **file) |
| Follow a generic feature callback list and return the first successful answer. | |
| uint16 | GetAiPurchaseCallbackResult (uint8 feature, CargoID cargo_type, uint8 default_selection, IndustryType src_industry, IndustryType dst_industry, uint8 distance, AIConstructionEvent event, uint8 count, uint8 station_size, const GRFFile **file) |
| 'Execute' an AI purchase selection callback | |
Variables | |
| static GenericCallbackList | _gcl [GSF_END] |
Handling of generic feature callbacks.
Definition in file newgrf_generic.cpp.
| void AddGenericCallback | ( | uint8 | feature, | |
| const GRFFile * | file, | |||
| const SpriteGroup * | group | |||
| ) |
Add a generic feature callback sprite group to the appropriate feature list.
| feature | ||
| file | ||
| group |
Definition at line 53 of file newgrf_generic.cpp.
| uint16 GetAiPurchaseCallbackResult | ( | uint8 | feature, | |
| CargoID | cargo_type, | |||
| uint8 | default_selection, | |||
| IndustryType | src_industry, | |||
| IndustryType | dst_industry, | |||
| uint8 | distance, | |||
| AIConstructionEvent | event, | |||
| uint8 | count, | |||
| uint8 | station_size, | |||
| const GRFFile ** | file | |||
| ) |
'Execute' an AI purchase selection callback
| feature | GRF Feature to call callback for. | |
| cargo_type | Cargotype to pass to callback. (Variable 80) | |
| default_selection | 'Default selection' to pass to callback. (Variable 82) | |
| src_industry | 'Source industry type' to pass to callback. (Variable 83) | |
| dst_industry | 'Destination industry type' to pass to callback. (Variable 84) | |
| distance | 'Distance between source and destination' to pass to callback. (Variable 85) | |
| event | 'AI construction event' to pass to callback. (Variable 86) | |
| count | 'Construction number' to pass to callback. (Variable 87) | |
| station_size | 'Station size' to pass to callback. (Variable 88) | |
| [out] | file | Optionally returns the GRFFile which made the final decision for the callback result. May be NULL if not required. |
Definition at line 180 of file newgrf_generic.cpp.
References CALLBACK_FAILED, GB(), GetGenericCallbackResult(), GetIndustrySpec(), IndustrySpec::grf_prop, INVALID_INDUSTRYTYPE, IT_AI_TOWN, and IT_AI_UNKNOWN.
Referenced by AIRail::BuildNewGRFRailStation().
| static uint16 GetGenericCallbackResult | ( | uint8 | feature, | |
| ResolverObject * | object, | |||
| const GRFFile ** | file | |||
| ) | [static] |
Follow a generic feature callback list and return the first successful answer.
| feature | GRF Feature of callback | |
| object | pre-populated resolver object | |
| [out] | file | Optionally returns the GRFFile which made the final decision for the callback result. May be NULL if not required. |
Definition at line 142 of file newgrf_generic.cpp.
References CALLBACK_FAILED, lengthof, and SpriteGroup::Resolve().
Referenced by GetAiPurchaseCallbackResult().
1.7.1