|
@@ -18,25 +18,25 @@
|
|
|
#include "autoreplace_func.h"
|
|
|
#include "gfx_func.h"
|
|
|
#include "player_func.h"
|
|
|
#include "widgets/dropdown_func.h"
|
|
|
#include "engine_func.h"
|
|
|
#include "engine_base.h"
|
|
|
#include "window_gui.h"
|
|
|
#include "engine_gui.h"
|
|
|
|
|
|
#include "table/sprites.h"
|
|
|
#include "table/strings.h"
|
|
|
|
|
|
void DrawEngineList(VehicleType type, int x, int y, const GUIEngineList *eng_list, uint16 min, uint16 max, EngineID selected_id, int count_location, GroupID selected_group);
|
|
|
void DrawEngineList(VehicleType type, int x, int r, int y, const GUIEngineList *eng_list, uint16 min, uint16 max, EngineID selected_id, int count_location, GroupID selected_group);
|
|
|
|
|
|
static const StringID _rail_types_list[] = {
|
|
|
STR_RAIL_VEHICLES,
|
|
|
STR_ELRAIL_VEHICLES,
|
|
|
STR_MONORAIL_VEHICLES,
|
|
|
STR_MAGLEV_VEHICLES,
|
|
|
INVALID_STRING_ID
|
|
|
};
|
|
|
|
|
|
enum ReplaceVehicleWindowWidgets {
|
|
|
RVW_WIDGET_LEFT_MATRIX = 3,
|
|
|
RVW_WIDGET_LEFT_SCROLLBAR,
|
|
@@ -375,25 +375,25 @@ public:
|
|
|
}
|
|
|
|
|
|
DrawString(145, this->widget[RVW_WIDGET_INFO_TAB].top + 1, STR_02BD, TC_BLACK);
|
|
|
|
|
|
/* Draw the lists */
|
|
|
for (byte i = 0; i < 2; i++) {
|
|
|
uint widget = (i == 0) ? RVW_WIDGET_LEFT_MATRIX : RVW_WIDGET_RIGHT_MATRIX;
|
|
|
GUIEngineList *list = &this->list[i]; // which list to draw
|
|
|
EngineID start = i == 0 ? this->vscroll.pos : this->vscroll2.pos; // what is the offset for the start (scrolling)
|
|
|
EngineID end = min((i == 0 ? this->vscroll.cap : this->vscroll2.cap) + start, list->Length());
|
|
|
|
|
|
/* Do the actual drawing */
|
|
|
DrawEngineList((VehicleType)this->window_number, this->widget[widget].left + 2, this->widget[widget].top + 1, list, start, end, this->sel_engine[i], i == 0 ? this->widget[RVW_WIDGET_LEFT_MATRIX].right - 2 : 0, selected_group);
|
|
|
DrawEngineList((VehicleType)this->window_number, this->widget[widget].left + 2, this->widget[widget].right, this->widget[widget].top + 1, list, start, end, this->sel_engine[i], i == 0 ? this->widget[RVW_WIDGET_LEFT_MATRIX].right - 2 : 0, selected_group);
|
|
|
|
|
|
/* Also draw the details if an engine is selected */
|
|
|
if (this->sel_engine[i] != INVALID_ENGINE) {
|
|
|
const Widget *wi = &this->widget[i == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS];
|
|
|
int text_end = DrawVehiclePurchaseInfo(wi->left + 2, wi->top + 1, wi->right - wi->left - 2, this->sel_engine[i]);
|
|
|
|
|
|
if (text_end > wi->bottom) {
|
|
|
this->SetDirty();
|
|
|
ResizeWindowForWidget(this, i == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS, 0, text_end - wi->bottom);
|
|
|
this->SetDirty();
|
|
|
}
|
|
|
}
|