Changeset - r27040:7b17c4de9339
[Not reviewed]
master
0 1 0
Peter Nelson - 14 months ago 2023-04-06 19:29:52
peter1138@openttd.org
Codechange: Replace roadstop spec limit magic number with constant.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/newgrf.cpp
Show inline comments
 
@@ -4793,12 +4793,12 @@ static ChangeInfoResult RoadStopChangeIn
 
{
 
	ChangeInfoResult ret = CIR_SUCCESS;
 

	
 
	if (id + numinfo > 255) {
 
		grfmsg(1, "RoadStopChangeInfo: RoadStop %u is invalid, max %u, ignoring", id + numinfo, 255);
 
	if (id + numinfo > NUM_ROADSTOPS_PER_GRF) {
 
		grfmsg(1, "RoadStopChangeInfo: RoadStop %u is invalid, max %u, ignoring", id + numinfo, NUM_ROADSTOPS_PER_GRF);
 
		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++) {
 
		RoadStopSpec *rs = _cur.grffile->roadstops[id + i];
0 comments (0 inline, 0 general)