Update all tracerestrict windows when a restricted signal is removed.

This fixes share counts in any open windows sharing the same program
not being updated.
This commit is contained in:
Jonathan G Rennison
2016-03-08 19:20:55 +00:00
parent 8dc76b0044
commit 4d94470d08
2 changed files with 8 additions and 3 deletions

View File

@@ -647,8 +647,9 @@ void TraceRestrictCreateProgramMapping(TraceRestrictRefId ref, TraceRestrictProg
/**
* Remove a program mapping
* @return true if a mapping was actually removed
*/
void TraceRestrictRemoveProgramMapping(TraceRestrictRefId ref)
bool TraceRestrictRemoveProgramMapping(TraceRestrictRefId ref)
{
TraceRestrictMapping::iterator iter = _tracerestrictprogram_mapping.find(ref);
if (iter != _tracerestrictprogram_mapping.end()) {
@@ -678,6 +679,9 @@ void TraceRestrictRemoveProgramMapping(TraceRestrictRefId ref)
}
}
}
return true;
} else {
return false;
}
}
@@ -717,8 +721,9 @@ TraceRestrictProgram *GetTraceRestrictProgram(TraceRestrictRefId ref, bool creat
void TraceRestrictNotifySignalRemoval(TileIndex tile, Track track)
{
TraceRestrictRefId ref = MakeTraceRestrictRefId(tile, track);
TraceRestrictRemoveProgramMapping(ref);
bool removed = TraceRestrictRemoveProgramMapping(ref);
DeleteWindowById(WC_TRACE_RESTRICT, ref);
if (removed) InvalidateWindowClassesData(WC_TRACE_RESTRICT);
}
/**