src/newgrf_station.cpp
changeset 9191 ae14770c829a
parent 9112 ec6800eaa340
child 9252 92e05c28a994
child 10323 57d8fd25473e
equal deleted inserted replaced
9190:6aacd72e0d05 9191:ae14770c829a
   103  * @return Number of station classes.
   103  * @return Number of station classes.
   104  */
   104  */
   105 uint GetNumStationClasses()
   105 uint GetNumStationClasses()
   106 {
   106 {
   107 	uint i;
   107 	uint i;
   108 	for (i = 0; i < STAT_CLASS_MAX && _station_classes[i].id != 0; i++);
   108 	for (i = 0; i < STAT_CLASS_MAX && _station_classes[i].id != 0; i++) {}
   109 	return i;
   109 	return i;
   110 }
   110 }
   111 
   111 
   112 /**
   112 /**
   113  * Return the number of stations for the given station class.
   113  * Return the number of stations for the given station class.
   722 	st->speclist[specindex].grfid    = 0;
   722 	st->speclist[specindex].grfid    = 0;
   723 	st->speclist[specindex].localidx = 0;
   723 	st->speclist[specindex].localidx = 0;
   724 
   724 
   725 	/* If this was the highest spec index, reallocate */
   725 	/* If this was the highest spec index, reallocate */
   726 	if (specindex == st->num_specs - 1) {
   726 	if (specindex == st->num_specs - 1) {
   727 		for (; st->speclist[st->num_specs - 1].grfid == 0 && st->num_specs > 1; st->num_specs--);
   727 		for (; st->speclist[st->num_specs - 1].grfid == 0 && st->num_specs > 1; st->num_specs--) {}
   728 
   728 
   729 		if (st->num_specs > 1) {
   729 		if (st->num_specs > 1) {
   730 			st->speclist = ReallocT(st->speclist, st->num_specs);
   730 			st->speclist = ReallocT(st->speclist, st->num_specs);
   731 		} else {
   731 		} else {
   732 			free(st->speclist);
   732 			free(st->speclist);