src/newgrf_house.h
author rubidium
Mon, 21 Apr 2008 11:29:01 +0000
changeset 9018 403898e0b54e
parent 8707 e57a09994e12
child 9111 48ce04029fe4
permissions -rw-r--r--
(svn r12817) -Feature: the ability to play NewGRF sounds for industries and stations.
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
8213
7bdd7593eb9b (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium
parents: 7861
diff changeset
     8
#include "town_type.h"
7327
d810677fb909 (svn r10690) -Codechange: use the enum that describes all callback IDs in favor of "just" using an untyped integer.
rubidium
parents: 6826
diff changeset
     9
#include "newgrf_callbacks.h"
6332
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
/**
f3f436dcd7d0 (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.
f3f436dcd7d0 (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
f3f436dcd7d0 (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
f3f436dcd7d0 (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
f3f436dcd7d0 (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
f3f436dcd7d0 (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
f3f436dcd7d0 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff changeset
    18
 * used in the game.
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
 * 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
    21
 * 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
    22
 * 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
    23
 */
f3f436dcd7d0 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff changeset
    24
struct HouseClassMapping {
f3f436dcd7d0 (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
f3f436dcd7d0 (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
f3f436dcd7d0 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff changeset
    27
};
f3f436dcd7d0 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff changeset
    28
8707
e57a09994e12 (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: 8291
diff changeset
    29
void UpdateHousesAndTowns();
6332
f3f436dcd7d0 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff changeset
    30
f3f436dcd7d0 (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);
f3f436dcd7d0 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff changeset
    32
f3f436dcd7d0 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff changeset
    33
void InitializeBuildingCounts();
f3f436dcd7d0 (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);
f3f436dcd7d0 (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);
f3f436dcd7d0 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff changeset
    36
f3f436dcd7d0 (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);
f3f436dcd7d0 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff changeset
    38
void AnimateNewHouseTile(TileIndex tile);
9018
403898e0b54e (svn r12817) -Feature: the ability to play NewGRF sounds for industries and stations.
rubidium
parents: 8707
diff changeset
    39
void ChangeHouseAnimationFrame(const struct GRFFile *file, TileIndex tile, uint16 callback_result);
6332
f3f436dcd7d0 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff changeset
    40
7327
d810677fb909 (svn r10690) -Codechange: use the enum that describes all callback IDs in favor of "just" using an untyped integer.
rubidium
parents: 6826
diff changeset
    41
uint16 GetHouseCallback(CallbackID callback, uint32 param1, uint32 param2, HouseID house_id, Town *town, TileIndex tile);
6332
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
bool CanDeleteHouse(TileIndex tile);
f3f436dcd7d0 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff changeset
    44
f3f436dcd7d0 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff changeset
    45
bool NewHouseTileLoop(TileIndex tile);
f3f436dcd7d0 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff changeset
    46
7861
77e12b5259fe (svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents: 7327
diff changeset
    47
enum HouseTrigger {
77e12b5259fe (svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents: 7327
diff changeset
    48
	/* The tile of the house has been triggered during the tileloop. */
77e12b5259fe (svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents: 7327
diff changeset
    49
	HOUSE_TRIGGER_TILE_LOOP     = 0x01,
77e12b5259fe (svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents: 7327
diff changeset
    50
	/*
77e12b5259fe (svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents: 7327
diff changeset
    51
	 * The top tile of a (multitile) building has been triggered during and all
77e12b5259fe (svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents: 7327
diff changeset
    52
	 * the tileloop other tiles of the same building get the same random value.
77e12b5259fe (svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents: 7327
diff changeset
    53
	 */
77e12b5259fe (svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents: 7327
diff changeset
    54
	HOUSE_TRIGGER_TILE_LOOP_TOP = 0x02,
77e12b5259fe (svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents: 7327
diff changeset
    55
};
77e12b5259fe (svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents: 7327
diff changeset
    56
void TriggerHouse(TileIndex t, HouseTrigger trigger);
77e12b5259fe (svn r11411) -Codechange: implement random triggers for houses.
rubidium
parents: 7327
diff changeset
    57
6332
f3f436dcd7d0 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff changeset
    58
#endif /* NEWGRF_HOUSE_H */