# newgrf_spritegroup.h File Reference

Action 2 handling. More...

`#include "town_type.h"`
`#include "industry_type.h"`
`#include "core/bitmath_func.hpp"`
`#include "gfx_type.h"`
`#include "engine_type.h"`
`#include "tile_type.h"`
`#include "newgrf_cargo.h"`
`#include "newgrf_callbacks.h"`
`#include "newgrf_generic.h"`
`#include "newgrf_storage.h"`

Go to the source code of this file.

## Data Structures
struct | RealSpriteGroup
struct | DeterministicSpriteGroupAdjust
struct | DeterministicSpriteGroupRange
struct | DeterministicSpriteGroup
struct | RandomizedSpriteGroup
struct | CallbackResultSpriteGroup
struct | ResultSpriteGroup
struct | TileLayoutSpriteGroup
struct | IndustryProductionSpriteGroup
struct | SpriteGroup
struct | ResolverObject
## Enumerations
enum | VarSpriteGroupScope { VSG_SCOPE_SELF, VSG_SCOPE_PARENT, VSG_SCOPE_RELATIVE }
enum | DeterministicSpriteGroupSize { DSG_SIZE_BYTE, DSG_SIZE_WORD, DSG_SIZE_DWORD }
enum | DeterministicSpriteGroupAdjustType { DSGA_TYPE_NONE, DSGA_TYPE_DIV, DSGA_TYPE_MOD }
enum | DeterministicSpriteGroupAdjustOperation { DSGA_OP_ADD, DSGA_OP_SUB, DSGA_OP_SMIN, DSGA_OP_SMAX, DSGA_OP_UMIN, DSGA_OP_UMAX, DSGA_OP_SDIV, DSGA_OP_SMOD, DSGA_OP_UDIV, DSGA_OP_UMOD, DSGA_OP_MUL, DSGA_OP_AND, DSGA_OP_OR, DSGA_OP_XOR, DSGA_OP_STO, DSGA_OP_RST, DSGA_OP_STOP, DSGA_OP_ROR, DSGA_OP_SCMP, DSGA_OP_UCMP }
enum | RandomizedSpriteGroupCompareMode { RSG_CMP_ANY, RSG_CMP_ALL }
enum | SpriteGroupType { SGT_INVALID, SGT_REAL, SGT_DETERMINISTIC, SGT_RANDOMIZED, SGT_CALLBACK, SGT_RESULT, SGT_TILELAYOUT, SGT_INDUSTRY_PRODUCTION }
## Functions
static uint32 | GetRegister (uint i)
| Gets the value of a so-called newgrf "register".
SpriteGroup * | AllocateSpriteGroup ()
void | InitializeSpriteGroupPool ()
const SpriteGroup * | Resolve (const SpriteGroup *group, ResolverObject *object)

## Detailed Description

Action 2 handling.

Definition in file newgrf_spritegroup.h.

## Enumeration Type Documentation

enum DeterministicSpriteGroupAdjustOperation

Enumerator:

  DSGA_OP_ADD | a + b
  DSGA_OP_SUB | a - b
  DSGA_OP_SMIN | (signed) min(a, b)
  DSGA_OP_SMAX | (signed) max(a, b)
  DSGA_OP_UMIN | (unsigned) min(a, b)
  DSGA_OP_UMAX | (unsigned) max(a, b)
  DSGA_OP_SDIV | (signed) a / b
  DSGA_OP_SMOD | (signed) a % b
  DSGA_OP_UDIV | (unsigned) a / b
  DSGA_OP_UMOD | (unsigned) a & b
  DSGA_OP_MUL | a * b
  DSGA_OP_AND | a & b
  DSGA_OP_OR | a | b
  DSGA_OP_XOR | a ^ b
  DSGA_OP_STO | store a into temporary storage, indexed by b. return a
  DSGA_OP_RST | return b
  DSGA_OP_STOP | store a into persistent storage, indexed by b, return a
  DSGA_OP_ROR | rotate a b positions to the right
  DSGA_OP_SCMP | (signed) comparision (a < b -> 0, a == b = 1, a > b = 2)
  DSGA_OP_UCMP | (unsigned) comparision (a < b -> 0, a == b = 1, a > b = 2)

Definition at line 72 of file newgrf_spritegroup.h.

## Function Documentation

static uint32 GetRegister | ( | uint | i | ) | `[inline, static]`

Gets the value of a so-called newgrf "register".

Parameters:

  | i | index of the register

Precondition:
  i < 0x110

Returns:
  the value of the register

Definition at line 26 of file newgrf_spritegroup.h.

References TemporaryStorageArray< TYPE, SIZE >::Get().

Referenced by ChangeIndustryProduction(), GetCountAndDistanceOfClosestInstance(), and IndustryGetVariable().