Initial implementation of tracerestrict speed restriction feature

This commit is contained in:
Jonathan G Rennison
2019-12-05 18:34:05 +00:00
parent 030e8bf762
commit aa8aae9a62
14 changed files with 182 additions and 6 deletions

View File

@@ -635,6 +635,12 @@ void TraceRestrictProgram::Execute(const Train* v, const TraceRestrictProgramInp
}
break;
case TRIT_SPEED_RESTRICTION: {
out.speed_restriction = GetTraceRestrictValue(item);
out.flags |= TRPRF_SPEED_RETRICTION_SET;
break;
}
default:
NOT_REACHED();
}
@@ -804,6 +810,10 @@ CommandCost TraceRestrictProgram::Validate(const std::vector<TraceRestrictItem>
actions_used_flags |= TRPAUF_REVERSE;
break;
case TRIT_SPEED_RESTRICTION:
actions_used_flags |= TRPAUF_SPEED_RESTRICTION;
break;
default:
return_cmd_error(STR_TRACE_RESTRICT_ERROR_VALIDATE_UNKNOWN_INSTRUCTION);
}