|
@@ -150,13 +150,13 @@ struct AIListWindow : public Window {
|
|
|
AIConfig::GetConfig(slot)->ChangeAI(NULL);
|
|
|
} else {
|
|
|
AIInfoList::const_iterator it = this->ai_info_list->begin();
|
|
|
for (int i = 0; i < this->selected; i++) it++;
|
|
|
AIConfig::GetConfig(slot)->ChangeAI((*it).second->GetName(), (*it).second->GetVersion());
|
|
|
}
|
|
|
InvalidateWindow(WC_GAME_OPTIONS, 0);
|
|
|
SetWindowDirty(WC_GAME_OPTIONS, 0);
|
|
|
}
|
|
|
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
{
|
|
|
switch (widget) {
|
|
|
case AIL_WIDGET_LIST: { // Select one of the AIs
|
|
@@ -764,13 +764,13 @@ struct AIDebugWindow : public Window {
|
|
|
|
|
|
int scroll_count = (log == NULL) ? 0 : log->used;
|
|
|
if (this->vscroll.GetCount() != scroll_count) {
|
|
|
this->vscroll.SetCount(scroll_count);
|
|
|
|
|
|
/* We need a repaint */
|
|
|
this->InvalidateWidget(AID_WIDGET_SCROLLBAR);
|
|
|
this->SetWidgetDirty(AID_WIDGET_SCROLLBAR);
|
|
|
}
|
|
|
|
|
|
if (log == NULL) return;
|
|
|
|
|
|
/* Detect when the user scrolls the window. Enable autoscroll when the
|
|
|
* bottom-most line becomes visible. */
|
|
@@ -780,14 +780,14 @@ struct AIDebugWindow : public Window {
|
|
|
if (this->autoscroll) {
|
|
|
int scroll_pos = max(0, log->used - this->vscroll.GetCapacity());
|
|
|
if (scroll_pos != this->vscroll.GetPosition()) {
|
|
|
this->vscroll.SetPosition(scroll_pos);
|
|
|
|
|
|
/* We need a repaint */
|
|
|
this->InvalidateWidget(AID_WIDGET_SCROLLBAR);
|
|
|
this->InvalidateWidget(AID_WIDGET_LOG_PANEL);
|
|
|
this->SetWidgetDirty(AID_WIDGET_SCROLLBAR);
|
|
|
this->SetWidgetDirty(AID_WIDGET_LOG_PANEL);
|
|
|
}
|
|
|
}
|
|
|
this->last_vscroll_pos = this->vscroll.GetPosition();
|
|
|
|
|
|
}
|
|
|
|