|
|
@ -38,8 +38,8 @@ void IndustryPoolNewBlock(uint start_item)
|
|
|
|
/* Initialize the industry-pool */
|
|
|
|
/* Initialize the industry-pool */
|
|
|
|
MemoryPool _industry_pool = { "Industry", INDUSTRY_POOL_MAX_BLOCKS, INDUSTRY_POOL_BLOCK_SIZE_BITS, sizeof(Industry), &IndustryPoolNewBlock, 0, 0, NULL };
|
|
|
|
MemoryPool _industry_pool = { "Industry", INDUSTRY_POOL_MAX_BLOCKS, INDUSTRY_POOL_BLOCK_SIZE_BITS, sizeof(Industry), &IndustryPoolNewBlock, 0, 0, NULL };
|
|
|
|
|
|
|
|
|
|
|
|
byte _industry_sound_ctr;
|
|
|
|
static byte _industry_sound_ctr;
|
|
|
|
TileIndex _industry_sound_tile;
|
|
|
|
static TileIndex _industry_sound_tile;
|
|
|
|
|
|
|
|
|
|
|
|
void ShowIndustryViewWindow(int industry);
|
|
|
|
void ShowIndustryViewWindow(int industry);
|
|
|
|
void BuildOilRig(TileIndex tile);
|
|
|
|
void BuildOilRig(TileIndex tile);
|
|
|
@ -341,7 +341,7 @@ static IndustryDrawTileProc * const _industry_draw_tile_procs[5] = {
|
|
|
|
|
|
|
|
|
|
|
|
static void DrawTile_Industry(TileInfo *ti)
|
|
|
|
static void DrawTile_Industry(TileInfo *ti)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Industry *ind;
|
|
|
|
const Industry* ind;
|
|
|
|
const DrawIndustryTileStruct *dits;
|
|
|
|
const DrawIndustryTileStruct *dits;
|
|
|
|
byte z;
|
|
|
|
byte z;
|
|
|
|
uint32 image, ormod;
|
|
|
|
uint32 image, ormod;
|
|
|
@ -425,7 +425,7 @@ static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac)
|
|
|
|
|
|
|
|
|
|
|
|
static void GetTileDesc_Industry(TileIndex tile, TileDesc *td)
|
|
|
|
static void GetTileDesc_Industry(TileIndex tile, TileDesc *td)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Industry *i = GetIndustry(_m[tile].m2);
|
|
|
|
const Industry* i = GetIndustry(_m[tile].m2);
|
|
|
|
|
|
|
|
|
|
|
|
td->owner = i->owner;
|
|
|
|
td->owner = i->owner;
|
|
|
|
td->str = STR_4802_COAL_MINE + i->type;
|
|
|
|
td->str = STR_4802_COAL_MINE + i->type;
|
|
|
@ -863,7 +863,8 @@ static uint32 GetTileTrackStatus_Industry(TileIndex tile, TransportType mode)
|
|
|
|
|
|
|
|
|
|
|
|
static void GetProducedCargo_Industry(TileIndex tile, byte *b)
|
|
|
|
static void GetProducedCargo_Industry(TileIndex tile, byte *b)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Industry *i = GetIndustry(_m[tile].m2);
|
|
|
|
const Industry* i = GetIndustry(_m[tile].m2);
|
|
|
|
|
|
|
|
|
|
|
|
b[0] = i->produced_cargo[0];
|
|
|
|
b[0] = i->produced_cargo[0];
|
|
|
|
b[1] = i->produced_cargo[1];
|
|
|
|
b[1] = i->produced_cargo[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1262,10 +1263,10 @@ static bool CheckSuitableIndustryPos(TileIndex tile)
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static Town *CheckMultipleIndustryInTown(TileIndex tile, int type)
|
|
|
|
static const Town* CheckMultipleIndustryInTown(TileIndex tile, int type)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Town *t;
|
|
|
|
const Town* t;
|
|
|
|
Industry *i;
|
|
|
|
const Industry* i;
|
|
|
|
|
|
|
|
|
|
|
|
t = ClosestTownFromTile(tile, (uint)-1);
|
|
|
|
t = ClosestTownFromTile(tile, (uint)-1);
|
|
|
|
|
|
|
|
|
|
|
@ -1309,7 +1310,7 @@ static const byte _industry_map5_bits[] = {
|
|
|
|
16, 16, 16, 16, 16, 16, 16,
|
|
|
|
16, 16, 16, 16, 16, 16, 16,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable *it, int type, Town *t)
|
|
|
|
static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable* it, int type, const Town* t)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TileInfo ti;
|
|
|
|
TileInfo ti;
|
|
|
|
|
|
|
|
|
|
|
@ -1451,7 +1452,7 @@ static Industry *AllocateIndustry(void)
|
|
|
|
return AddBlockToPool(&_industry_pool) ? AllocateIndustry() : NULL;
|
|
|
|
return AddBlockToPool(&_industry_pool) ? AllocateIndustry() : NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const IndustryTileTable *it, Town *t, byte owner)
|
|
|
|
static void DoCreateNewIndustry(Industry* i, TileIndex tile, int type, const IndustryTileTable* it, const Town* t, byte owner)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const IndustrySpec *spec;
|
|
|
|
const IndustrySpec *spec;
|
|
|
|
uint32 r;
|
|
|
|
uint32 r;
|
|
|
@ -1547,7 +1548,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int32 CmdBuildIndustry(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|
|
|
int32 CmdBuildIndustry(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Town *t;
|
|
|
|
const Town* t;
|
|
|
|
Industry *i;
|
|
|
|
Industry *i;
|
|
|
|
TileIndex tile = TileVirtXY(x, y);
|
|
|
|
TileIndex tile = TileVirtXY(x, y);
|
|
|
|
int num;
|
|
|
|
int num;
|
|
|
@ -1601,7 +1602,7 @@ int32 CmdBuildIndustry(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|
|
|
|
|
|
|
|
|
|
|
Industry *CreateNewIndustry(TileIndex tile, int type)
|
|
|
|
Industry *CreateNewIndustry(TileIndex tile, int type)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Town *t;
|
|
|
|
const Town* t;
|
|
|
|
const IndustryTileTable *it;
|
|
|
|
const IndustryTileTable *it;
|
|
|
|
Industry *i;
|
|
|
|
Industry *i;
|
|
|
|
|
|
|
|
|
|
|
|