author | rubidium |
Wed, 07 May 2008 21:45:27 +0000 | |
changeset 10457 | ea18877d8eba |
parent 10429 | 1b99254f9607 |
permissions | -rw-r--r-- |
6658
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
1 |
/* $Id$ */ |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
2 |
|
10429
1b99254f9607
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
10285
diff
changeset
|
3 |
/** @file newgrf_house.h Functions related to NewGRF houses. */ |
6658
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
4 |
|
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
5 |
#ifndef NEWGRF_HOUSE_H |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
6 |
#define NEWGRF_HOUSE_H |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
7 |
|
8709
4187ad809fe7
(svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium
parents:
8357
diff
changeset
|
8 |
#include "town_type.h" |
7823
cad4dec2b899
(svn r10690) -Codechange: use the enum that describes all callback IDs in favor of "just" using an untyped integer.
rubidium
parents:
7322
diff
changeset
|
9 |
#include "newgrf_callbacks.h" |
6658
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
10 |
|
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
11 |
/** |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
12 |
* Makes class IDs unique to each GRF file. |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
13 |
* Houses can be assigned class IDs which are only comparable within the GRF |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
14 |
* file they were defined in. This mapping ensures that if two houses have the |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
15 |
* same class as defined by the GRF file, the classes are different within the |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
16 |
* game. An array of HouseClassMapping structs is created, and the array index |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
17 |
* of the struct that matches both the GRF ID and the class ID is the class ID |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
18 |
* used in the game. |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
19 |
* |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
20 |
* Although similar to the HouseIDMapping struct above, this serves a different |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
21 |
* purpose. Since the class ID is not saved anywhere, this mapping does not |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
22 |
* need to be persistent; it just needs to keep class ids unique. |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
23 |
*/ |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
24 |
struct HouseClassMapping { |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
25 |
uint32 grfid; ////< The GRF ID of the file this class belongs to |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
26 |
uint8 class_id; ////< The class id within the grf file |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
27 |
}; |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
28 |
|
9203
55b0289562a8
(svn r12381) -Fix [FS1835] [FS1535] (r11855): The number of houses wasn't computed right. A few other things regaring the updating had to be changed. Big thanks for support to frosch123 and SmatZ, to name just a few. (Inspired by a patch of bilbo)
skidd13
parents:
8787
diff
changeset
|
29 |
void UpdateHousesAndTowns(); |
6658
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
30 |
|
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
31 |
HouseClassID AllocateHouseClassID(byte grf_class_id, uint32 grfid); |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
32 |
|
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
33 |
void InitializeBuildingCounts(); |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
34 |
void IncreaseBuildingCount(Town *t, HouseID house_id); |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
35 |
void DecreaseBuildingCount(Town *t, HouseID house_id); |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
36 |
|
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
37 |
void DrawNewHouseTile(TileInfo *ti, HouseID house_id); |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
38 |
void AnimateNewHouseTile(TileIndex tile); |
10285
ba2d207f4a26
(svn r12817) -Feature: the ability to play NewGRF sounds for industries and stations.
rubidium
parents:
9203
diff
changeset
|
39 |
void ChangeHouseAnimationFrame(const struct GRFFile *file, TileIndex tile, uint16 callback_result); |
6658
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
40 |
|
7823
cad4dec2b899
(svn r10690) -Codechange: use the enum that describes all callback IDs in favor of "just" using an untyped integer.
rubidium
parents:
7322
diff
changeset
|
41 |
uint16 GetHouseCallback(CallbackID callback, uint32 param1, uint32 param2, HouseID house_id, Town *town, TileIndex tile); |
6658
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
42 |
|
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
43 |
bool CanDeleteHouse(TileIndex tile); |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
44 |
|
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
45 |
bool NewHouseTileLoop(TileIndex tile); |
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
46 |
|
8357
279c5953ec04
(svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents:
7823
diff
changeset
|
47 |
enum HouseTrigger { |
279c5953ec04
(svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents:
7823
diff
changeset
|
48 |
/* The tile of the house has been triggered during the tileloop. */ |
279c5953ec04
(svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents:
7823
diff
changeset
|
49 |
HOUSE_TRIGGER_TILE_LOOP = 0x01, |
279c5953ec04
(svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents:
7823
diff
changeset
|
50 |
/* |
279c5953ec04
(svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents:
7823
diff
changeset
|
51 |
* The top tile of a (multitile) building has been triggered during and all |
279c5953ec04
(svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents:
7823
diff
changeset
|
52 |
* the tileloop other tiles of the same building get the same random value. |
279c5953ec04
(svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents:
7823
diff
changeset
|
53 |
*/ |
279c5953ec04
(svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents:
7823
diff
changeset
|
54 |
HOUSE_TRIGGER_TILE_LOOP_TOP = 0x02, |
279c5953ec04
(svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents:
7823
diff
changeset
|
55 |
}; |
279c5953ec04
(svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents:
7823
diff
changeset
|
56 |
void TriggerHouse(TileIndex t, HouseTrigger trigger); |
279c5953ec04
(svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents:
7823
diff
changeset
|
57 |
|
6658
59048224be55
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
58 |
#endif /* NEWGRF_HOUSE_H */ |