| author | truebrain |
| Mon, 31 Mar 2008 09:25:03 +0000 | |
| branch | noai |
| changeset 9841 | f931a10242c9 |
| parent 9826 | 9707ad4c9b60 |
| child 10294 | 7798ae816af8 |
| permissions | -rw-r--r-- |
| 9476 | 1 |
/* $Id$ */ |
2 |
||
3 |
/** @file newgrf_house.h */ |
|
4 |
||
5 |
#ifndef NEWGRF_HOUSE_H |
|
6 |
#define NEWGRF_HOUSE_H |
|
7 |
||
|
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
8 |
#include "town_type.h" |
|
9694
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9626
diff
changeset
|
9 |
#include "newgrf_callbacks.h" |
| 9476 | 10 |
|
11 |
/** |
|
12 |
* Makes class IDs unique to each GRF file. |
|
13 |
* Houses can be assigned class IDs which are only comparable within the GRF |
|
14 |
* file they were defined in. This mapping ensures that if two houses have the |
|
15 |
* same class as defined by the GRF file, the classes are different within the |
|
16 |
* game. An array of HouseClassMapping structs is created, and the array index |
|
17 |
* of the struct that matches both the GRF ID and the class ID is the class ID |
|
18 |
* used in the game. |
|
19 |
* |
|
20 |
* Although similar to the HouseIDMapping struct above, this serves a different |
|
21 |
* purpose. Since the class ID is not saved anywhere, this mapping does not |
|
22 |
* need to be persistent; it just needs to keep class ids unique. |
|
23 |
*/ |
|
24 |
struct HouseClassMapping {
|
|
25 |
uint32 grfid; ////< The GRF ID of the file this class belongs to |
|
26 |
uint8 class_id; ////< The class id within the grf file |
|
27 |
}; |
|
28 |
||
|
9826
9707ad4c9b60
(svn r12462) [NoAI] -Sync: with trunk r12304:12461.
rubidium
parents:
9724
diff
changeset
|
29 |
void UpdateHousesAndTowns(); |
| 9476 | 30 |
|
31 |
HouseClassID AllocateHouseClassID(byte grf_class_id, uint32 grfid); |
|
32 |
||
33 |
void InitializeBuildingCounts(); |
|
34 |
void IncreaseBuildingCount(Town *t, HouseID house_id); |
|
35 |
void DecreaseBuildingCount(Town *t, HouseID house_id); |
|
36 |
||
37 |
void DrawNewHouseTile(TileInfo *ti, HouseID house_id); |
|
38 |
void AnimateNewHouseTile(TileIndex tile); |
|
39 |
void ChangeHouseAnimationFrame(TileIndex tile, uint16 callback_result); |
|
40 |
||
|
9694
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9626
diff
changeset
|
41 |
uint16 GetHouseCallback(CallbackID callback, uint32 param1, uint32 param2, HouseID house_id, Town *town, TileIndex tile); |
| 9476 | 42 |
|
43 |
bool CanDeleteHouse(TileIndex tile); |
|
44 |
||
45 |
bool NewHouseTileLoop(TileIndex tile); |
|
46 |
||
|
9722
ebf0ece7d8f6
(svn r11503) [NoAI] -Sync: with trunk r11308:11502.
rubidium
parents:
9694
diff
changeset
|
47 |
enum HouseTrigger {
|
|
ebf0ece7d8f6
(svn r11503) [NoAI] -Sync: with trunk r11308:11502.
rubidium
parents:
9694
diff
changeset
|
48 |
/* The tile of the house has been triggered during the tileloop. */ |
|
ebf0ece7d8f6
(svn r11503) [NoAI] -Sync: with trunk r11308:11502.
rubidium
parents:
9694
diff
changeset
|
49 |
HOUSE_TRIGGER_TILE_LOOP = 0x01, |
|
ebf0ece7d8f6
(svn r11503) [NoAI] -Sync: with trunk r11308:11502.
rubidium
parents:
9694
diff
changeset
|
50 |
/* |
|
ebf0ece7d8f6
(svn r11503) [NoAI] -Sync: with trunk r11308:11502.
rubidium
parents:
9694
diff
changeset
|
51 |
* The top tile of a (multitile) building has been triggered during and all |
|
ebf0ece7d8f6
(svn r11503) [NoAI] -Sync: with trunk r11308:11502.
rubidium
parents:
9694
diff
changeset
|
52 |
* the tileloop other tiles of the same building get the same random value. |
|
ebf0ece7d8f6
(svn r11503) [NoAI] -Sync: with trunk r11308:11502.
rubidium
parents:
9694
diff
changeset
|
53 |
*/ |
|
ebf0ece7d8f6
(svn r11503) [NoAI] -Sync: with trunk r11308:11502.
rubidium
parents:
9694
diff
changeset
|
54 |
HOUSE_TRIGGER_TILE_LOOP_TOP = 0x02, |
|
ebf0ece7d8f6
(svn r11503) [NoAI] -Sync: with trunk r11308:11502.
rubidium
parents:
9694
diff
changeset
|
55 |
}; |
|
ebf0ece7d8f6
(svn r11503) [NoAI] -Sync: with trunk r11308:11502.
rubidium
parents:
9694
diff
changeset
|
56 |
void TriggerHouse(TileIndex t, HouseTrigger trigger); |
|
ebf0ece7d8f6
(svn r11503) [NoAI] -Sync: with trunk r11308:11502.
rubidium
parents:
9694
diff
changeset
|
57 |
|
| 9476 | 58 |
#endif /* NEWGRF_HOUSE_H */ |