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