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