Merge branches 'tracerestrict-sx' and 'template_train_replacement-sx' into jgrpp
This commit is contained in:
@@ -658,8 +658,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()) {
|
||||
@@ -689,6 +690,9 @@ void TraceRestrictRemoveProgramMapping(TraceRestrictRefId ref)
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -728,8 +732,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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1014,6 +1019,10 @@ CommandCost CmdProgramSignalTraceRestrictProgMgmt(TileIndex tile, DoCommandFlag
|
||||
}
|
||||
}
|
||||
|
||||
if (type != TRDCT_PROG_RESET && !TraceRestrictProgram::CanAllocateItem()) {
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
if (!(flags & DC_EXEC)) {
|
||||
return CommandCost();
|
||||
}
|
||||
|
Reference in New Issue
Block a user