depot_gui.c
changeset 4740 e562a2cde601
parent 4739 bd535b408617
child 4745 21632cc267bb
equal deleted inserted replaced
4739:bd535b408617 4740:e562a2cde601
   612 		w->widget[DEPOT_WIDGET_SELL_CHAIN].top    = ((w->widget[DEPOT_WIDGET_SELL_CHAIN].bottom - w->widget[DEPOT_WIDGET_SELL].top) / 2) + w->widget[DEPOT_WIDGET_SELL].top;
   612 		w->widget[DEPOT_WIDGET_SELL_CHAIN].top    = ((w->widget[DEPOT_WIDGET_SELL_CHAIN].bottom - w->widget[DEPOT_WIDGET_SELL].top) / 2) + w->widget[DEPOT_WIDGET_SELL].top;
   613 		w->widget[DEPOT_WIDGET_SELL].bottom     = w->widget[DEPOT_WIDGET_SELL_CHAIN].top - 1;
   613 		w->widget[DEPOT_WIDGET_SELL].bottom     = w->widget[DEPOT_WIDGET_SELL_CHAIN].top - 1;
   614 	}
   614 	}
   615 }
   615 }
   616 
   616 
       
   617 void DepotSortList(Vehicle **v, uint16 length);
       
   618 
   617 static void DepotWndProc(Window *w, WindowEvent *e)
   619 static void DepotWndProc(Window *w, WindowEvent *e)
   618 {
   620 {
   619 	switch (e->event) {
   621 	switch (e->event) {
   620 		case WE_CREATE:
   622 		case WE_CREATE:
   621 			WP(w, depot_d).vehicle_list  = NULL;
   623 			WP(w, depot_d).vehicle_list  = NULL;
   635 				 * It's ok to use the wagon pointers for non-trains as they will be ignored */
   637 				 * It's ok to use the wagon pointers for non-trains as they will be ignored */
   636 				BuildDepotVehicleList(WP(w, depot_d).type, w->window_number,
   638 				BuildDepotVehicleList(WP(w, depot_d).type, w->window_number,
   637 					&WP(w, depot_d).vehicle_list, &WP(w, depot_d).engine_list_length, &WP(w, depot_d).engine_count,
   639 					&WP(w, depot_d).vehicle_list, &WP(w, depot_d).engine_list_length, &WP(w, depot_d).engine_count,
   638 					&WP(w, depot_d).wagon_list,   &WP(w, depot_d).wagon_list_length,  &WP(w, depot_d).wagon_count);
   640 					&WP(w, depot_d).wagon_list,   &WP(w, depot_d).wagon_list_length,  &WP(w, depot_d).wagon_count);
   639 				WP(w, depot_d).generate_list = false;
   641 				WP(w, depot_d).generate_list = false;
       
   642 				DepotSortList(WP(w, depot_d).vehicle_list, WP(w, depot_d).engine_count);
   640 #ifndef NDEBUG
   643 #ifndef NDEBUG
   641 			} else {
   644 			} else {
   642 				/* Here we got a piece of code, that only checks if we got a different number of vehicles in the depot list and the number of vehicles actually being in the depot.
   645 				/* Here we got a piece of code, that only checks if we got a different number of vehicles in the depot list and the number of vehicles actually being in the depot.
   643 				 * IF they aren't the same, then WE_INVALIDATE_DATA should have been called somewhere, but it wasn't and we got a bug
   646 				 * IF they aren't the same, then WE_INVALIDATE_DATA should have been called somewhere, but it wasn't and we got a bug
   644 				 * Since this is a time consuming check and not nice to memory fragmentation, it may not stay for long, but it's a good way to check this
   647 				 * Since this is a time consuming check and not nice to memory fragmentation, it may not stay for long, but it's a good way to check this