Merge branch 'tracerestrict' into tracerestrict-sx

pull/6/merge
Jonathan G Rennison 9 years ago
commit ec65659baf

@ -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);
}
/**
@ -1003,6 +1008,10 @@ CommandCost CmdProgramSignalTraceRestrictProgMgmt(TileIndex tile, DoCommandFlag
}
}
if (type != TRDCT_PROG_RESET && !TraceRestrictProgram::CanAllocateItem()) {
return CMD_ERROR;
}
if (!(flags & DC_EXEC)) {
return CommandCost();
}

@ -513,7 +513,7 @@ static inline Track GetTraceRestrictRefIdTrack(TraceRestrictRefId ref)
}
void TraceRestrictCreateProgramMapping(TraceRestrictRefId ref, TraceRestrictProgram *prog);
void TraceRestrictRemoveProgramMapping(TraceRestrictRefId ref);
bool TraceRestrictRemoveProgramMapping(TraceRestrictRefId ref);
TraceRestrictProgram *GetTraceRestrictProgram(TraceRestrictRefId ref, bool create_new);

Loading…
Cancel
Save