newgrf.c
changeset 542 de27e74b11bd
parent 536 03d80fecb999
child 922 10035216cbaf
equal deleted inserted replaced
541:625227bb2a3d 542:de27e74b11bd
   853 						       (number - stat->platforms[l]) * sizeof(**stat->layouts));
   853 						       (number - stat->platforms[l]) * sizeof(**stat->layouts));
   854 
   854 
   855 						stat->platforms[l] = number;
   855 						stat->platforms[l] = number;
   856 					}
   856 					}
   857 
   857 
       
   858 					p = 0;
   858 					layout = malloc(length * number);
   859 					layout = malloc(length * number);
   859 					for (l = 0; l < length; l++)
   860 					for (l = 0; l < length; l++)
   860 						for (p = 0; p < number; p++)
   861 						for (p = 0; p < number; p++)
   861 							layout[l * number + p] = grf_load_byte(&buf);
   862 							layout[l * number + p] = grf_load_byte(&buf);
   862 
   863 
   863 					l--;
   864 					l--;
   864 					p--;
   865 					p--;
       
   866 					assert(p >= 0);
   865 					free(stat->layouts[l][p]);
   867 					free(stat->layouts[l][p]);
   866 					stat->layouts[l][p] = layout;
   868 					stat->layouts[l][p] = layout;
   867 				}
   869 				}
   868 			}
   870 			}
   869 			break;
   871 			break;
   947 
   949 
   948 	uint8 feature;
   950 	uint8 feature;
   949 	uint8 numprops;
   951 	uint8 numprops;
   950 	uint8 numinfo;
   952 	uint8 numinfo;
   951 	byte engine;
   953 	byte engine;
   952 	EngineInfo *ei;
   954 	EngineInfo *ei = NULL;
   953 
   955 
   954 	if (len == 1) {
   956 	if (len == 1) {
   955 		DEBUG(grf, 8) ("Silently ignoring one-byte special sprite 0x00.");
   957 		DEBUG(grf, 8) ("Silently ignoring one-byte special sprite 0x00.");
   956 		return;
   958 		return;
   957 	}
   959 	}
   970 		return;
   972 		return;
   971 	}
   973 	}
   972 
   974 
   973 	if (feature != GSF_STATION)
   975 	if (feature != GSF_STATION)
   974 		ei = &_engine_info[engine + _vehshifts[feature]];
   976 		ei = &_engine_info[engine + _vehshifts[feature]];
       
   977 	/* XXX - Should there not be a check to see if 'ei' is NULL
       
   978 	    when it is used in the switch below?? -- TrueLight */
   975 
   979 
   976 	buf += 5;
   980 	buf += 5;
   977 
   981 
   978 	while (numprops-- && buf < bufend) {
   982 	while (numprops-- && buf < bufend) {
   979 		uint8 prop = grf_load_byte(&buf);
   983 		uint8 prop = grf_load_byte(&buf);