360 Industry *i = DEREF_INDUSTRY(_map2[tile]); |
360 Industry *i = DEREF_INDUSTRY(_map2[tile]); |
361 |
361 |
362 td->owner = i->owner; |
362 td->owner = i->owner; |
363 td->str = STR_4802_COAL_MINE + i->type; |
363 td->str = STR_4802_COAL_MINE + i->type; |
364 if ((_map_owner[tile] & 0x80) == 0) { |
364 if ((_map_owner[tile] & 0x80) == 0) { |
365 SET_DPARAMX16(td->dparam, 0, td->str); |
365 SetDParamX(td->dparam, 0, td->str); |
366 td->str = STR_2058_UNDER_CONSTRUCTION; |
366 td->str = STR_2058_UNDER_CONSTRUCTION; |
367 } |
367 } |
368 } |
368 } |
369 |
369 |
370 static int32 ClearTile_Industry(uint tile, byte flags) |
370 static int32 ClearTile_Industry(uint tile, byte flags) |
377 * (area around OILRIG is water, so water shouldn't flood it |
377 * (area around OILRIG is water, so water shouldn't flood it |
378 */ |
378 */ |
379 if ((_current_player != OWNER_WATER && _game_mode != GM_EDITOR && |
379 if ((_current_player != OWNER_WATER && _game_mode != GM_EDITOR && |
380 !_cheats.magic_bulldozer.value) || |
380 !_cheats.magic_bulldozer.value) || |
381 (_current_player == OWNER_WATER && i->type == IT_OIL_RIG) ) { |
381 (_current_player == OWNER_WATER && i->type == IT_OIL_RIG) ) { |
382 SET_DPARAM16(0, STR_4802_COAL_MINE + i->type); |
382 SetDParam(0, STR_4802_COAL_MINE + i->type); |
383 return_cmd_error(STR_4800_IN_THE_WAY); |
383 return_cmd_error(STR_4800_IN_THE_WAY); |
384 } |
384 } |
385 |
385 |
386 if (flags & DC_EXEC) { |
386 if (flags & DC_EXEC) { |
387 DeleteIndustry(i); |
387 DeleteIndustry(i); |
1641 if (change >= _industry_spec[i->type].production_rate[j]/4) |
1641 if (change >= _industry_spec[i->type].production_rate[j]/4) |
1642 closeit = false; |
1642 closeit = false; |
1643 |
1643 |
1644 mag = abs(percent); |
1644 mag = abs(percent); |
1645 if (mag >= 10) { |
1645 if (mag >= 10) { |
1646 SET_DPARAM16(3, mag); |
1646 SetDParam(3, mag); |
1647 SET_DPARAM16(0,_cargoc.names_s[i->produced_cargo[j]]); |
1647 SetDParam(0,_cargoc.names_s[i->produced_cargo[j]]); |
1648 SET_DPARAM16(1, i->town->index); |
1648 SetDParam(1, i->town->index); |
1649 SET_DPARAM16(2, i->type + STR_4802_COAL_MINE); |
1649 SetDParam(2, i->type + STR_4802_COAL_MINE); |
1650 AddNewsItem(percent>=0 ? STR_INDUSTRY_PROD_GOUP : STR_INDUSTRY_PROD_GODOWN, |
1650 AddNewsItem(percent>=0 ? STR_INDUSTRY_PROD_GOUP : STR_INDUSTRY_PROD_GODOWN, |
1651 NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0), |
1651 NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0), |
1652 i->xy + TILE_XY(1,1), 0); |
1652 i->xy + TILE_XY(1,1), 0); |
1653 } |
1653 } |
1654 } |
1654 } |
1655 } |
1655 } |
1656 |
1656 |
1657 if (closeit) { |
1657 if (closeit) { |
1658 i->prod_level = 0; |
1658 i->prod_level = 0; |
1659 SET_DPARAM16(1, i->type + STR_4802_COAL_MINE); |
1659 SetDParam(1, i->type + STR_4802_COAL_MINE); |
1660 SET_DPARAM16(0, i->town->index); |
1660 SetDParam(0, i->town->index); |
1661 AddNewsItem(_industry_close_strings[i->type], NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0), i->xy + TILE_XY(1,1), 0); |
1661 AddNewsItem(_industry_close_strings[i->type], NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0), i->xy + TILE_XY(1,1), 0); |
1662 } |
1662 } |
1663 } |
1663 } |
1664 |
1664 |
1665 |
1665 |
1734 break; |
1734 break; |
1735 if (--j == 0) |
1735 if (--j == 0) |
1736 return; |
1736 return; |
1737 } |
1737 } |
1738 |
1738 |
1739 SET_DPARAM16(0, type + STR_4802_COAL_MINE); |
1739 SetDParam(0, type + STR_4802_COAL_MINE); |
1740 SET_DPARAM16(1, i->town->index); |
1740 SetDParam(1, i->town->index); |
1741 AddNewsItem( STR_482D_NEW_UNDER_CONSTRUCTION + (type == IT_FOREST), NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ECONOMY,0), i->xy, 0); |
1741 AddNewsItem( STR_482D_NEW_UNDER_CONSTRUCTION + (type == IT_FOREST), NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ECONOMY,0), i->xy, 0); |
1742 } |
1742 } |
1743 |
1743 |
1744 static void MaybeCloseIndustry(Industry *i) |
1744 static void MaybeCloseIndustry(Industry *i) |
1745 { |
1745 { |
1787 if ( (byte)(_cur_year - i->last_prod_year) >= 5 && CHANCE16(1,2)) { |
1787 if ( (byte)(_cur_year - i->last_prod_year) >= 5 && CHANCE16(1,2)) { |
1788 close_industry: |
1788 close_industry: |
1789 i->prod_level = 0; |
1789 i->prod_level = 0; |
1790 str = _industry_close_strings[type]; |
1790 str = _industry_close_strings[type]; |
1791 add_news: |
1791 add_news: |
1792 SET_DPARAM16(1, type + STR_4802_COAL_MINE); |
1792 SetDParam(1, type + STR_4802_COAL_MINE); |
1793 SET_DPARAM16(0, i->town->index); |
1793 SetDParam(0, i->town->index); |
1794 AddNewsItem(str, NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0), i->xy + TILE_XY(1,1), 0); |
1794 AddNewsItem(str, NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0), i->xy + TILE_XY(1,1), 0); |
1795 } |
1795 } |
1796 } |
1796 } |
1797 } |
1797 } |
1798 |
1798 |