maedhros@6332: /* $Id$ */ maedhros@6332: rubidium@9111: /** @file newgrf_house.h Functions related to NewGRF houses. */ maedhros@6332: maedhros@6332: #ifndef NEWGRF_HOUSE_H maedhros@6332: #define NEWGRF_HOUSE_H maedhros@6332: rubidium@8213: #include "town_type.h" rubidium@7327: #include "newgrf_callbacks.h" maedhros@6332: maedhros@6332: /** maedhros@6332: * Makes class IDs unique to each GRF file. maedhros@6332: * Houses can be assigned class IDs which are only comparable within the GRF maedhros@6332: * file they were defined in. This mapping ensures that if two houses have the maedhros@6332: * same class as defined by the GRF file, the classes are different within the maedhros@6332: * game. An array of HouseClassMapping structs is created, and the array index maedhros@6332: * of the struct that matches both the GRF ID and the class ID is the class ID maedhros@6332: * used in the game. maedhros@6332: * maedhros@6332: * Although similar to the HouseIDMapping struct above, this serves a different maedhros@6332: * purpose. Since the class ID is not saved anywhere, this mapping does not maedhros@6332: * need to be persistent; it just needs to keep class ids unique. maedhros@6332: */ maedhros@6332: struct HouseClassMapping { maedhros@6332: uint32 grfid; ////< The GRF ID of the file this class belongs to maedhros@6332: uint8 class_id; ////< The class id within the grf file maedhros@6332: }; maedhros@6332: skidd13@8707: void UpdateHousesAndTowns(); maedhros@6332: maedhros@6332: HouseClassID AllocateHouseClassID(byte grf_class_id, uint32 grfid); maedhros@6332: maedhros@6332: void InitializeBuildingCounts(); maedhros@6332: void IncreaseBuildingCount(Town *t, HouseID house_id); maedhros@6332: void DecreaseBuildingCount(Town *t, HouseID house_id); maedhros@6332: maedhros@6332: void DrawNewHouseTile(TileInfo *ti, HouseID house_id); maedhros@6332: void AnimateNewHouseTile(TileIndex tile); rubidium@9018: void ChangeHouseAnimationFrame(const struct GRFFile *file, TileIndex tile, uint16 callback_result); maedhros@6332: rubidium@7327: uint16 GetHouseCallback(CallbackID callback, uint32 param1, uint32 param2, HouseID house_id, Town *town, TileIndex tile); maedhros@6332: maedhros@6332: bool CanDeleteHouse(TileIndex tile); maedhros@6332: maedhros@6332: bool NewHouseTileLoop(TileIndex tile); maedhros@6332: rubidium@7861: enum HouseTrigger { rubidium@7861: /* The tile of the house has been triggered during the tileloop. */ rubidium@7861: HOUSE_TRIGGER_TILE_LOOP = 0x01, rubidium@7861: /* rubidium@7861: * The top tile of a (multitile) building has been triggered during and all rubidium@7861: * the tileloop other tiles of the same building get the same random value. rubidium@7861: */ rubidium@7861: HOUSE_TRIGGER_TILE_LOOP_TOP = 0x02, rubidium@7861: }; rubidium@7861: void TriggerHouse(TileIndex t, HouseTrigger trigger); rubidium@7861: maedhros@6332: #endif /* NEWGRF_HOUSE_H */