Slightly improve funding highlight update

This commit is contained in:
dP
2020-08-10 00:28:45 +03:00
parent 808fb507e1
commit 1d1d7e252a
2 changed files with 12 additions and 3 deletions

View File

@@ -94,6 +94,10 @@ This is usable for any OpenTTD servers
- Fix town HR couter.
- Allow spectators to open industry funding window from the menu.
- Fix graphical glitches after switching to location with hotkey.
- Make new tint highlights work with 32bpp sprites.
- Show preview when building a rail depot.
- Fix: sprite preview in sprite aligner is too small with scaled UI.
- Slightly improve funding highlight update.
*** 1.10.2 (5 Jun 2020) ***
- Add new minimap mode showing industries, height and farms at the same time.

View File

@@ -35,6 +35,7 @@ extern bool IsInsideSelectedRectangle(int x, int y);
extern RailType _cur_railtype;
RoadBits FindRailsToConnect(TileIndex tile);
extern DiagDirection _build_depot_direction; ///< Currently selected depot direction
extern uint32 _realtime_tick;
namespace citymania {
@@ -46,7 +47,8 @@ struct TileZoning {
uint8 town_zone : 3;
uint8 industry_fund_result : 2;
uint8 advertisement_zone : 2;
IndustryType industry_fund_type;
// IndustryType industry_fund_type;
uint8 industry_fund_update;
};
static TileZoning *_mz = nullptr;
@@ -243,9 +245,12 @@ std::pair<ZoningBorder, uint8> CalcTileBorders(TileIndex tile, F getter) {
bool CanBuildIndustryOnTileCached(IndustryType type, TileIndex tile) {
if (_mz[tile].industry_fund_type != type || !_mz[tile].industry_fund_result) {
// if (_mz[tile].industry_fund_type != type || !_mz[tile].industry_fund_result) {
uint8 tick_hash = (_realtime_tick & 255);
if (_mz[tile].industry_fund_update != tick_hash || !_mz[tile].industry_fund_result) {
bool res = CanBuildIndustryOnTile(type, tile);
_mz[tile].industry_fund_type = type;
// _mz[tile].industry_fund_type = type;
_mz[tile].industry_fund_update = tick_hash;
_mz[tile].industry_fund_result = res ? 2 : 1;
return res;
}