mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Replace roadstop spec limit magic number with constant.
This commit is contained in:
parent
9246789fd3
commit
04215afe3f
|
@ -4793,12 +4793,12 @@ static ChangeInfoResult RoadStopChangeInfo(uint id, int numinfo, int prop, ByteR
|
||||||
{
|
{
|
||||||
ChangeInfoResult ret = CIR_SUCCESS;
|
ChangeInfoResult ret = CIR_SUCCESS;
|
||||||
|
|
||||||
if (id + numinfo > 255) {
|
if (id + numinfo > NUM_ROADSTOPS_PER_GRF) {
|
||||||
grfmsg(1, "RoadStopChangeInfo: RoadStop %u is invalid, max %u, ignoring", id + numinfo, 255);
|
grfmsg(1, "RoadStopChangeInfo: RoadStop %u is invalid, max %u, ignoring", id + numinfo, NUM_ROADSTOPS_PER_GRF);
|
||||||
return CIR_INVALID_ID;
|
return CIR_INVALID_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_cur.grffile->roadstops == nullptr) _cur.grffile->roadstops = CallocT<RoadStopSpec*>(255);
|
if (_cur.grffile->roadstops == nullptr) _cur.grffile->roadstops = CallocT<RoadStopSpec*>(NUM_ROADSTOPS_PER_GRF);
|
||||||
|
|
||||||
for (int i = 0; i < numinfo; i++) {
|
for (int i = 0; i < numinfo; i++) {
|
||||||
RoadStopSpec *rs = _cur.grffile->roadstops[id + i];
|
RoadStopSpec *rs = _cur.grffile->roadstops[id + i];
|
||||||
|
|
Loading…
Reference in New Issue