src/station_gui.cpp
changeset 10255 5600b575e6e7
parent 10224 4f7e3408936b
child 10411 efe3b7a2746f
equal deleted inserted replaced
10254:14e7c7ada607 10255:5600b575e6e7
   182 	byte flags;                ///< Flags - SL_ORDER, SL_RESORT, SL_REBUILD
   182 	byte flags;                ///< Flags - SL_ORDER, SL_RESORT, SL_REBUILD
   183 };
   183 };
   184 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(plstations_d));
   184 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(plstations_d));
   185 
   185 
   186 /**
   186 /**
   187  * Set the 'SL_REBUILD' flag for all station lists
   187  * Set the station sort flag for all station-list windows.
   188  */
   188  * @param sl_flag Sort list flag to set for all station-list windows
   189 void RebuildStationLists()
   189  */
       
   190 static void SetStationListsFlag(StationListFlags sl_flag)
   190 {
   191 {
   191 	Window *const *wz;
   192 	Window *const *wz;
   192 
   193 
   193 	FOR_ALL_WINDOWS(wz) {
   194 	FOR_ALL_WINDOWS(wz) {
   194 		Window *w = *wz;
   195 		Window *w = *wz;
   195 		if (w->window_class == WC_STATION_LIST) {
   196 		if (w->window_class == WC_STATION_LIST) {
   196 			WP(w, plstations_d).flags |= SL_REBUILD;
   197 			WP(w, plstations_d).flags |= sl_flag;
   197 			SetWindowDirty(w);
   198 			SetWindowDirty(w);
   198 		}
   199 		}
   199 	}
   200 	}
   200 }
   201 }
   201 
   202 
   202 /**
   203 /**
       
   204  * Set the 'SL_REBUILD' flag for all station lists
       
   205  */
       
   206 void RebuildStationLists()
       
   207 {
       
   208 	SetStationListsFlag(SL_REBUILD);
       
   209 }
       
   210 
       
   211 /**
   203  * Set the 'SL_RESORT' flag for all station lists
   212  * Set the 'SL_RESORT' flag for all station lists
   204  */
   213  */
   205 void ResortStationLists()
   214 void ResortStationLists()
   206 {
   215 {
   207 	Window *const *wz;
   216 	SetStationListsFlag(SL_RESORT);
   208 
       
   209 	FOR_ALL_WINDOWS(wz) {
       
   210 		Window *w = *wz;
       
   211 		if (w->window_class == WC_STATION_LIST) {
       
   212 			WP(w, plstations_d).flags |= SL_RESORT;
       
   213 			SetWindowDirty(w);
       
   214 		}
       
   215 	}
       
   216 }
   217 }
   217 
   218 
   218 /**
   219 /**
   219  * Rebuild station list if the SL_REBUILD flag is set
   220  * Rebuild station list if the SL_REBUILD flag is set
   220  *
   221  *