src/newgrf_station.cpp
changeset 6247 7d81e3a5d803
parent 6148 5247b66aad19
child 6343 76d17f784c13
equal deleted inserted replaced
6246:75451000349d 6247:7d81e3a5d803
    29 /**
    29 /**
    30  * Reset station classes to their default state.
    30  * Reset station classes to their default state.
    31  * This includes initialising the Default and Waypoint classes with an empty
    31  * This includes initialising the Default and Waypoint classes with an empty
    32  * entry, for standard stations and waypoints.
    32  * entry, for standard stations and waypoints.
    33  */
    33  */
    34 void ResetStationClasses(void)
    34 void ResetStationClasses()
    35 {
    35 {
    36 	for (StationClassID i = STAT_CLASS_BEGIN; i < STAT_CLASS_MAX; i++) {
    36 	for (StationClassID i = STAT_CLASS_BEGIN; i < STAT_CLASS_MAX; i++) {
    37 		station_classes[i].id = 0;
    37 		station_classes[i].id = 0;
    38 		station_classes[i].name = STR_EMPTY;
    38 		station_classes[i].name = STR_EMPTY;
    39 		station_classes[i].stations = 0;
    39 		station_classes[i].stations = 0;
    93 }
    93 }
    94 
    94 
    95 /** Build a list of station class name StringIDs to use in a dropdown list
    95 /** Build a list of station class name StringIDs to use in a dropdown list
    96  * @return Pointer to a (static) array of StringIDs
    96  * @return Pointer to a (static) array of StringIDs
    97  */
    97  */
    98 StringID *BuildStationClassDropdown(void)
    98 StringID *BuildStationClassDropdown()
    99 {
    99 {
   100 	/* Allow room for all station classes, plus a terminator entry */
   100 	/* Allow room for all station classes, plus a terminator entry */
   101 	static StringID names[STAT_CLASS_MAX + 1];
   101 	static StringID names[STAT_CLASS_MAX + 1];
   102 	uint i;
   102 	uint i;
   103 
   103 
   113 
   113 
   114 /**
   114 /**
   115  * Get the number of station classes in use.
   115  * Get the number of station classes in use.
   116  * @return Number of station classes.
   116  * @return Number of station classes.
   117  */
   117  */
   118 uint GetNumStationClasses(void)
   118 uint GetNumStationClasses()
   119 {
   119 {
   120 	uint i;
   120 	uint i;
   121 	for (i = 0; i < STAT_CLASS_MAX && station_classes[i].id != 0; i++);
   121 	for (i = 0; i < STAT_CLASS_MAX && station_classes[i].id != 0; i++);
   122 	return i;
   122 	return i;
   123 }
   123 }