9476
|
1 |
/* $Id$ */
|
|
2 |
|
|
3 |
/** @file newgrf_house.h */
|
|
4 |
|
|
5 |
#ifndef NEWGRF_HOUSE_H
|
|
6 |
#define NEWGRF_HOUSE_H
|
|
7 |
|
|
8 |
#include "town.h"
|
|
9 |
|
|
10 |
/**
|
|
11 |
* Maps a house id stored on the map to a GRF file.
|
|
12 |
* House IDs are stored on the map, so there needs to be a way to tie them to
|
|
13 |
* GRF files. An array of HouseIDMapping structs is saved with the savegame so
|
|
14 |
* that house GRFs can be loaded in a different order, or removed safely. The
|
|
15 |
* index in the array is the house ID stored on the map.
|
|
16 |
*
|
|
17 |
* The substitute ID is the ID of an original house that should be used instead
|
|
18 |
* if the GRF containing the new house is not available.
|
|
19 |
*/
|
|
20 |
struct HouseIDMapping {
|
|
21 |
uint32 grfid; ///< The GRF ID of the file this house belongs to
|
|
22 |
uint8 house_id; ///< The house ID within the GRF file
|
|
23 |
uint8 substitute_id; ///< The (original) house ID to use if this GRF is not available
|
|
24 |
};
|
|
25 |
|
|
26 |
/**
|
|
27 |
* Makes class IDs unique to each GRF file.
|
|
28 |
* Houses can be assigned class IDs which are only comparable within the GRF
|
|
29 |
* file they were defined in. This mapping ensures that if two houses have the
|
|
30 |
* same class as defined by the GRF file, the classes are different within the
|
|
31 |
* game. An array of HouseClassMapping structs is created, and the array index
|
|
32 |
* of the struct that matches both the GRF ID and the class ID is the class ID
|
|
33 |
* used in the game.
|
|
34 |
*
|
|
35 |
* Although similar to the HouseIDMapping struct above, this serves a different
|
|
36 |
* purpose. Since the class ID is not saved anywhere, this mapping does not
|
|
37 |
* need to be persistent; it just needs to keep class ids unique.
|
|
38 |
*/
|
|
39 |
struct HouseClassMapping {
|
|
40 |
uint32 grfid; ////< The GRF ID of the file this class belongs to
|
|
41 |
uint8 class_id; ////< The class id within the grf file
|
|
42 |
};
|
|
43 |
|
|
44 |
extern HouseIDMapping _house_id_mapping[HOUSE_MAX]; ///< Declared in newgrf_house.cpp
|
|
45 |
|
|
46 |
void AddHouseOverride(uint8 local_id, uint house_type);
|
|
47 |
void ResetHouseOverrides();
|
|
48 |
|
|
49 |
void SetHouseSpec(const HouseSpec *hs);
|
|
50 |
|
|
51 |
void CheckHouseIDs();
|
|
52 |
void ResetHouseIDMapping();
|
|
53 |
|
|
54 |
HouseClassID AllocateHouseClassID(byte grf_class_id, uint32 grfid);
|
|
55 |
|
|
56 |
void InitializeBuildingCounts();
|
|
57 |
void IncreaseBuildingCount(Town *t, HouseID house_id);
|
|
58 |
void DecreaseBuildingCount(Town *t, HouseID house_id);
|
|
59 |
void AfterLoadCountBuildings();
|
|
60 |
|
|
61 |
void DrawNewHouseTile(TileInfo *ti, HouseID house_id);
|
|
62 |
void AnimateNewHouseTile(TileIndex tile);
|
|
63 |
void ChangeHouseAnimationFrame(TileIndex tile, uint16 callback_result);
|
|
64 |
|
|
65 |
uint16 GetHouseCallback(uint16 callback, uint32 param1, HouseID house_id, Town *town, TileIndex tile);
|
|
66 |
|
|
67 |
bool CanDeleteHouse(TileIndex tile);
|
|
68 |
|
|
69 |
bool NewHouseTileLoop(TileIndex tile);
|
|
70 |
|
|
71 |
#endif /* NEWGRF_HOUSE_H */
|