@ -56,6 +56,7 @@ typedef enum DepotWindowWidgets {
DEPOT_WIDGET_CLONE ,
DEPOT_WIDGET_CLONE ,
DEPOT_WIDGET_LOCATION ,
DEPOT_WIDGET_LOCATION ,
DEPOT_WIDGET_RESIZE ,
DEPOT_WIDGET_RESIZE ,
DEPOT_WIDGET_LAST , // used to assert if DepotWindowWidgets and widget_moves got different lengths. Due to this usage, it needs to be last
} DepotWindowWidget ;
} DepotWindowWidget ;
/* Define how to move each widget. The order is important */
/* Define how to move each widget. The order is important */
@ -738,6 +739,10 @@ void ShowDepotWindow(TileIndex tile, byte type)
{
{
Window * w ;
Window * w ;
/* First we ensure that the widget counts are equal in all 3 lists to prevent bad stuff from happening */
assert ( lengthof ( widget_moves ) = = lengthof ( _depot_widgets ) ) ;
assert ( lengthof ( widget_moves ) = = DEPOT_WIDGET_LAST ) ;
switch ( type ) {
switch ( type ) {
case VEH_Train : w = AllocateWindowDescFront ( & _train_depot_desc , tile ) ; break ;
case VEH_Train : w = AllocateWindowDescFront ( & _train_depot_desc , tile ) ; break ;
case VEH_Road : w = AllocateWindowDescFront ( & _road_depot_desc , tile ) ; break ;
case VEH_Road : w = AllocateWindowDescFront ( & _road_depot_desc , tile ) ; break ;