Index: src/ai/ai_core.cpp
===================================================================
--- src/ai/ai_core.cpp (revision 27553)
+++ src/ai/ai_core.cpp (working copy)
@@ -62,6 +62,7 @@
cur_company.Restore();
InvalidateWindowData(WC_AI_DEBUG, 0, -1);
+ DeleteWindowById(WC_AI_SETTINGS, company);
return;
}
Index: src/ai/ai_gui.cpp
===================================================================
--- src/ai/ai_gui.cpp (revision 27553)
+++ src/ai/ai_gui.cpp (working copy)
@@ -177,7 +177,8 @@
GetConfig(slot)->Change((*it).second->GetName(), (*it).second->GetVersion());
}
InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI);
- InvalidateWindowClassesData(WC_AI_SETTINGS);
+ DeleteWindowByClass(WC_AI_SETTINGS);
+ DeleteWindowByClass(WC_TEXTFILE);
DeleteWindowByClass(WC_QUERY_STRING);
}
@@ -276,6 +277,23 @@
}
/**
+* Check whether a script, be it AI or GS, is dead in this slot.
+* @note Also returns dead for AI slots which are currently occupied
+* by Human Companies or when the AI didn't start.
+* @note Also returns dead when no GS was set up.
+* @param slot The slot that is checked.
+* @return true if the slot that is checked is dead.
+*/
+static bool IsDead(CompanyID slot)
+{
+ if (slot == OWNER_DEITY) {
+ return Game::GetInstance() == NULL || Game::GetInstance()->IsDead();
+ } else {
+ return !Company::IsValidAiID(slot) || Company::Get(slot)->ai_instance->IsDead();
+ }
+}
+
+/**
* Window for settings the parameters of an AI.
*/
struct AISettingsWindow : public Window {
@@ -311,7 +329,7 @@
this->vscroll = this->GetScrollbar(WID_AIS_SCROLLBAR);
this->FinishInitNested(slot); // Initializes 'this->line_height' as side effect.
- this->SetWidgetDisabledState(WID_AIS_RESET, _game_mode != GM_MENU && Company::IsValidID(this->slot));
+ this->SetWidgetDisabledState(WID_AIS_RESET, _game_mode == GM_NORMAL && !IsDead(this->slot));
this->vscroll->SetCount((int)this->visible_settings.size());
}
@@ -375,7 +393,7 @@
for (; this->vscroll->IsVisible(i) && it != visible_settings.end(); i++, it++) {
const ScriptConfigItem &config_item = **it;
int current_value = config->GetSetting((config_item).name);
- bool editable = _game_mode == GM_MENU || ((this->slot != OWNER_DEITY) && !Company::IsValidID(this->slot)) || (config_item.flags & SCRIPTCONFIG_INGAME) != 0;
+ bool editable = _game_mode != GM_NORMAL || IsDead(this->slot) || (config_item.flags & SCRIPTCONFIG_INGAME) != 0;
StringID str;
TextColour colour;
@@ -438,7 +456,7 @@
VisibleSettingsList::const_iterator it = this->visible_settings.begin();
for (int i = 0; i < num; i++) it++;
const ScriptConfigItem config_item = **it;
- if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (config_item.flags & SCRIPTCONFIG_INGAME) == 0) return;
+ if (_game_mode == GM_NORMAL && !IsDead(this->slot) && (config_item.flags & SCRIPTCONFIG_INGAME) == 0) return;
if (this->clicked_row != num) {
DeleteChildWindows(WC_QUERY_STRING);
@@ -519,7 +537,7 @@
break;
case WID_AIS_RESET:
- if (_game_mode == GM_MENU || !Company::IsValidID(this->slot)) {
+ if (_game_mode != GM_NORMAL || IsDead(this->slot)) {
this->ai_config->ResetSettings();
this->SetDirty();
}
@@ -532,7 +550,7 @@
if (StrEmpty(str)) return;
ScriptConfigItemList::const_iterator it = this->ai_config->GetConfigList()->begin();
for (int i = 0; i < this->clicked_row; i++) it++;
- if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (it->flags & SCRIPTCONFIG_INGAME) == 0) return;
+ if (_game_mode == GM_NORMAL && !IsDead(this->slot) && (it->flags & SCRIPTCONFIG_INGAME) == 0) return;
int32 value = atoi(str);
this->ai_config->SetSetting((*it).name, value);
this->SetDirty();
@@ -543,7 +561,7 @@
assert(this->clicked_dropdown);
ScriptConfigItemList::const_iterator it = this->ai_config->GetConfigList()->begin();
for (int i = 0; i < this->clicked_row; i++) it++;
- if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (it->flags & SCRIPTCONFIG_INGAME) == 0) return;
+ if (_game_mode == GM_NORMAL && !IsDead(this->slot) && (it->flags & SCRIPTCONFIG_INGAME) == 0) return;
this->ai_config->SetSetting((*it).name, index);
this->SetDirty();
}
@@ -658,7 +676,7 @@
static const NWidgetPart _nested_ai_config_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_MAUVE),
- NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_AI_CONFIG_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
+ NWidget(WWT_CAPTION, COLOUR_MAUVE, WID_AIC_CAPTION), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_MAUVE, WID_AIC_BACKGROUND),
NWidget(NWID_VERTICAL), SetPIP(4, 4, 4),
@@ -675,8 +693,7 @@
EndContainer(),
NWidget(WWT_FRAME, COLOUR_MAUVE), SetDataTip(STR_AI_CONFIG_AI, STR_NULL), SetPadding(0, 5, 0, 5),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_LIST), SetMinimalSize(288, 112), SetFill(1, 0), SetMatrixDataTip(1, 8, STR_AI_CONFIG_AILIST_TOOLTIP), SetScrollbar(WID_AIC_SCROLLBAR),
- NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, WID_AIC_SCROLLBAR),
+ NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_LIST), SetMinimalSize(288, 210), SetFill(1, 0), SetMatrixDataTip(1, 15, STR_AI_CONFIG_AILIST_TOOLTIP),
EndContainer(),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 9),
@@ -711,16 +728,11 @@
struct AIConfigWindow : public Window {
CompanyID selected_slot; ///< The currently selected AI slot or \c INVALID_COMPANY.
int line_height; ///< Height of a single AI-name line.
- Scrollbar *vscroll; ///< Cache of the vertical scrollbar.
AIConfigWindow() : Window(&_ai_config_desc)
{
this->InitNested(WN_GAME_OPTIONS_AI); // Initializes 'this->line_height' as a side effect.
- this->vscroll = this->GetScrollbar(WID_AIC_SCROLLBAR);
this->selected_slot = INVALID_COMPANY;
- NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_AIC_LIST);
- this->vscroll->SetCapacity(nwi->current_y / this->line_height);
- this->vscroll->SetCount(MAX_COMPANIES);
this->OnInvalidateData(0);
}
@@ -733,6 +745,9 @@
virtual void SetStringParameters(int widget) const
{
switch (widget) {
+ case WID_AIC_CAPTION:
+ SetDParam(0, (_game_mode != GM_NORMAL) ? STR_AI_CONFIG_CAPTION : STR_AI_CONFIG_CAPTION_INGAME);
+ break;
case WID_AIC_NUMBER:
SetDParam(0, GetGameSettings().difficulty.max_no_competitors);
break;
@@ -764,7 +779,7 @@
case WID_AIC_LIST:
this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
- size->height = 8 * this->line_height;
+ size->height = 15 * this->line_height;
break;
}
}
@@ -779,15 +794,11 @@
if (slot == OWNER_DEITY) return _game_mode != GM_NORMAL || Game::GetInstance() != NULL;
if (_game_mode != GM_NORMAL) {
- return slot > 0 && slot <= GetGameSettings().difficulty.max_no_competitors;
+ return slot >= 0 && slot < MAX_COMPANIES;
}
- if (Company::IsValidID(slot) || slot < 0) return false;
+ if (Company::IsValidHumanID(slot) || slot < 0) return false;
- int max_slot = GetGameSettings().difficulty.max_no_competitors;
- for (CompanyID cid = COMPANY_FIRST; cid < (CompanyID)max_slot && cid < MAX_COMPANIES; cid++) {
- if (Company::IsValidHumanID(cid)) max_slot++;
- }
- return slot < max_slot;
+ return slot < MAX_COMPANIES;
}
virtual void DrawWidget(const Rect &r, int widget) const
@@ -802,7 +813,7 @@
}
DrawString(r.left + 10, r.right - 10, r.top + WD_MATRIX_TOP, text,
- (this->selected_slot == OWNER_DEITY) ? TC_WHITE : (IsEditable(OWNER_DEITY) ? TC_ORANGE : TC_SILVER));
+ (this->selected_slot == OWNER_DEITY) ? TC_WHITE : (IsEditable(OWNER_DEITY) ? (_game_mode == GM_NORMAL) ? (IsDead(OWNER_DEITY)) ? TC_RED : TC_GREEN : TC_ORANGE : TC_SILVER));
break;
}
@@ -809,10 +820,10 @@
case WID_AIC_LIST: {
int y = r.top;
- for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < MAX_COMPANIES; i++) {
+ for (int i = 0; i < MAX_COMPANIES; i++) {
StringID text;
- if ((_game_mode != GM_NORMAL && i == 0) || (_game_mode == GM_NORMAL && Company::IsValidHumanID(i))) {
+ if (_game_mode == GM_NORMAL && Company::IsValidHumanID(i)) {
text = STR_AI_CONFIG_HUMAN_PLAYER;
} else if (AIConfig::GetConfig((CompanyID)i)->GetInfo() != NULL) {
SetDParamStr(0, AIConfig::GetConfig((CompanyID)i)->GetInfo()->GetName());
@@ -821,7 +832,7 @@
text = STR_AI_CONFIG_RANDOM_AI;
}
DrawString(r.left + 10, r.right - 10, y + WD_MATRIX_TOP, text,
- (this->selected_slot == i) ? TC_WHITE : (IsEditable((CompanyID)i) ? TC_ORANGE : TC_SILVER));
+ (this->selected_slot == i) ? TC_WHITE : (IsEditable((CompanyID)i) ? Company::IsValidAiID(i) ? IsDead((CompanyID)i) ? TC_RED : TC_GREEN : TC_ORANGE : TC_SILVER));
y += this->line_height;
}
break;
@@ -845,7 +856,7 @@
if (widget == WID_AIC_DECREASE) {
new_value = max(0, GetGameSettings().difficulty.max_no_competitors - 1);
} else {
- new_value = min(MAX_COMPANIES - 1, GetGameSettings().difficulty.max_no_competitors + 1);
+ new_value = min(MAX_COMPANIES, GetGameSettings().difficulty.max_no_competitors + 1);
}
IConsoleSetSetting("difficulty.max_no_competitors", new_value);
this->InvalidateData();
@@ -860,7 +871,7 @@
}
case WID_AIC_LIST: { // Select a slot
- this->selected_slot = (CompanyID)this->vscroll->GetScrolledRowFromWidget(pt.y, this, widget, 0, this->line_height);
+ this->selected_slot = (CompanyID)this->GetRowFromWidget(pt.y, widget, 0, this->line_height);
this->InvalidateData();
if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
break;
@@ -867,19 +878,17 @@
}
case WID_AIC_MOVE_UP:
- if (IsEditable(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot - 1))) {
+ if (IsEditable(this->selected_slot) && IsDead(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot - 1)) && IsDead((CompanyID)(this->selected_slot - 1))) {
Swap(GetGameSettings().ai_config[this->selected_slot], GetGameSettings().ai_config[this->selected_slot - 1]);
this->selected_slot--;
- this->vscroll->ScrollTowards(this->selected_slot);
this->InvalidateData();
}
break;
case WID_AIC_MOVE_DOWN:
- if (IsEditable(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot + 1))) {
+ if (IsEditable(this->selected_slot) && IsDead(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot + 1)) && IsDead((CompanyID)(this->selected_slot + 1))) {
Swap(GetGameSettings().ai_config[this->selected_slot], GetGameSettings().ai_config[this->selected_slot + 1]);
this->selected_slot++;
- this->vscroll->ScrollTowards(this->selected_slot);
this->InvalidateData();
}
break;
@@ -922,12 +931,21 @@
if (!gui_scope) return;
this->SetWidgetDisabledState(WID_AIC_DECREASE, GetGameSettings().difficulty.max_no_competitors == 0);
- this->SetWidgetDisabledState(WID_AIC_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES - 1);
- this->SetWidgetDisabledState(WID_AIC_CHANGE, (this->selected_slot == OWNER_DEITY && _game_mode == GM_NORMAL) || this->selected_slot == INVALID_COMPANY);
+ this->SetWidgetDisabledState(WID_AIC_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES);
+ this->SetWidgetDisabledState(WID_AIC_CHANGE, this->selected_slot == INVALID_COMPANY || _game_mode == GM_NORMAL && (this->selected_slot == OWNER_DEITY || !IsDead(this->selected_slot)));
this->SetWidgetDisabledState(WID_AIC_CONFIGURE, this->selected_slot == INVALID_COMPANY || GetConfig(this->selected_slot)->GetConfigList()->size() == 0);
- this->SetWidgetDisabledState(WID_AIC_MOVE_UP, this->selected_slot == OWNER_DEITY || this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot - 1)));
- this->SetWidgetDisabledState(WID_AIC_MOVE_DOWN, this->selected_slot == OWNER_DEITY || this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot + 1)));
+ /* Display either Settings or Configure button */
+ NWidgetCore *configure_button = this->GetWidget<NWidgetCore>(WID_AIC_CONFIGURE);
+ if (_game_mode == GM_NORMAL && this->selected_slot != INVALID_COMPANY && !IsDead(this->selected_slot)) {
+ configure_button->SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP);
+ } else {
+ configure_button->SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP);
+ }
+
+ this->SetWidgetDisabledState(WID_AIC_MOVE_UP, this->selected_slot == INVALID_COMPANY || this->selected_slot == OWNER_DEITY || !IsDead(this->selected_slot) || !IsEditable((CompanyID)(this->selected_slot - 1)) || !IsDead((CompanyID)(this->selected_slot - 1)));
+ this->SetWidgetDisabledState(WID_AIC_MOVE_DOWN, this->selected_slot == INVALID_COMPANY || this->selected_slot == OWNER_DEITY || !IsDead(this->selected_slot) || !IsEditable((CompanyID)(this->selected_slot + 1)) || !IsDead((CompanyID)(this->selected_slot + 1)));
+
for (TextfileType tft = TFT_BEGIN; tft < TFT_END; tft++) {
this->SetWidgetDisabledState(WID_AIC_TEXTFILE + tft, this->selected_slot == INVALID_COMPANY || (GetConfig(this->selected_slot)->GetTextfile(tft, this->selected_slot) == NULL));
}
@@ -991,19 +1009,6 @@
}
/**
- * Check whether the currently selected AI/GS is dead.
- * @return true if dead.
- */
- bool IsDead() const
- {
- if (ai_debug_company == OWNER_DEITY) {
- GameInstance *game = Game::GetInstance();
- return game == NULL || game->IsDead();
- }
- return !Company::IsValidAiID(ai_debug_company) || Company::Get(ai_debug_company)->ai_instance->IsDead();
- }
-
- /**
* Check whether a company is a valid AI company or GS.
* @param company Company to check for validity.
* @return true if company is valid for debugging.
@@ -1276,7 +1281,7 @@
case WID_AID_CONTINUE_BTN:
/* Unpause current AI / game script and mark the corresponding script button dirty. */
- if (!this->IsDead()) {
+ if (!IsDead(this->ai_debug_company)) {
if (ai_debug_company == OWNER_DEITY) {
Game::Unpause();
} else {
@@ -1336,7 +1341,7 @@
this->break_string_filter.AddLine(log->lines[log->pos]);
if (this->break_string_filter.GetState()) {
/* Pause execution of script. */
- if (!this->IsDead()) {
+ if (!IsDead(this->ai_debug_company)) {
if (ai_debug_company == OWNER_DEITY) {
Game::Pause();
} else {
@@ -1375,6 +1380,15 @@
this->SetWidgetLoweredState(WID_AID_MATCH_CASE_BTN, this->case_sensitive_break_check);
this->SetWidgetDisabledState(WID_AID_SETTINGS, ai_debug_company == INVALID_COMPANY);
+
+ /* Display either Settings or Configure button */
+ NWidgetCore *settings_button = this->GetWidget<NWidgetCore>(WID_AID_SETTINGS);
+ if (ai_debug_company == INVALID_COMPANY || !IsDead(this->ai_debug_company)) {
+ settings_button->SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP);
+ } else {
+ settings_button->SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP);
+ }
+
this->SetWidgetDisabledState(WID_AID_RELOAD_TOGGLE, ai_debug_company == INVALID_COMPANY || ai_debug_company == OWNER_DEITY);
this->SetWidgetDisabledState(WID_AID_CONTINUE_BTN, ai_debug_company == INVALID_COMPANY ||
(ai_debug_company == OWNER_DEITY ? !Game::IsPaused() : !AI::IsPaused(ai_debug_company)));
Index: src/ai/ai_instance.cpp
===================================================================
--- src/ai/ai_instance.cpp (revision 27553)
+++ src/ai/ai_instance.cpp (working copy)
@@ -81,6 +81,7 @@
#include "../company_base.h"
#include "../company_func.h"
+#include "../window_func.h"
#include "../safeguards.h"
@@ -214,6 +215,7 @@
ScriptInstance::Died();
ShowAIDebugWindow(_current_company);
+ InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI);
const AIInfo *info = AIConfig::GetConfig(_current_company, AIConfig::SSS_FORCE_GAME)->GetInfo();
if (info != NULL) {
Index: src/game/game_instance.cpp
===================================================================
--- src/game/game_instance.cpp (revision 27553)
+++ src/game/game_instance.cpp (working copy)
@@ -85,6 +85,8 @@
#include "../script/api/game/game_waypointlist.hpp.sq"
#include "../script/api/game/game_window.hpp.sq"
+#include "../window_func.h"
+
#include "../safeguards.h"
@@ -232,6 +234,7 @@
ScriptInstance::Died();
ShowAIDebugWindow(OWNER_DEITY);
+ InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI);
const GameInfo *info = Game::GetInfo();
if (info != NULL) {
Index: src/lang/english.txt
===================================================================
--- src/lang/english.txt (revision 27553)
+++ src/lang/english.txt (working copy)
@@ -373,6 +373,7 @@
############ range for settings menu starts
STR_SETTINGS_MENU_GAME_OPTIONS :Game options
STR_SETTINGS_MENU_CONFIG_SETTINGS_TREE :Settings
+STR_SETTINGS_MENU_SCRIPT_CONFIGURATION :AI/Game script configuration
STR_SETTINGS_MENU_SCRIPT_SETTINGS :AI/Game script settings
STR_SETTINGS_MENU_NEWGRF_SETTINGS :NewGRF settings
STR_SETTINGS_MENU_TRANSPARENCY_OPTIONS :Transparency options
@@ -1738,7 +1739,7 @@
STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}Settings
STR_INTRO_NEWGRF_SETTINGS :{BLACK}NewGRF Settings
STR_INTRO_ONLINE_CONTENT :{BLACK}Check Online Content
-STR_INTRO_SCRIPT_SETTINGS :{BLACK}AI/Game Script Settings
+STR_INTRO_SCRIPT_SETTINGS :{BLACK}AI/Game Script Configuration
STR_INTRO_QUIT :{BLACK}Exit
STR_INTRO_TOOLTIP_NEW_GAME :{BLACK}Start a new game. Ctrl+Click skips map configuration
@@ -1758,7 +1759,7 @@
STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}Display settings
STR_INTRO_TOOLTIP_NEWGRF_SETTINGS :{BLACK}Display NewGRF settings
STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}Check for new and updated content to download
-STR_INTRO_TOOLTIP_SCRIPT_SETTINGS :{BLACK}Display AI/Game script settings
+STR_INTRO_TOOLTIP_SCRIPT_SETTINGS :{BLACK}Display AI/Game script configuration
STR_INTRO_TOOLTIP_QUIT :{BLACK}Exit 'OpenTTD'
STR_INTRO_TRANSLATION :{BLACK}This translation misses {NUM} string{P "" s}. Please help make OpenTTD better by signing up as translator. See readme.txt for details.
@@ -3980,9 +3981,10 @@
# AI configuration window
STR_AI_CONFIG_CAPTION :{WHITE}AI/Game Script Configuration
-STR_AI_CONFIG_GAMELIST_TOOLTIP :{BLACK}The Game Script that will be loaded in the next game
-STR_AI_CONFIG_AILIST_TOOLTIP :{BLACK}The AIs that will be loaded in the next game
-STR_AI_CONFIG_HUMAN_PLAYER :Human player
+STR_AI_CONFIG_CAPTION_INGAME :{WHITE}AI/Game Script Settings
+STR_AI_CONFIG_GAMELIST_TOOLTIP :{BLACK}The Game Script that is loaded or will be loaded in the next game
+STR_AI_CONFIG_AILIST_TOOLTIP :{BLACK}The AIs that are currently loaded or will be loaded next time they start on these Company IDs while in a game
+STR_AI_CONFIG_HUMAN_PLAYER :Human Company
STR_AI_CONFIG_RANDOM_AI :Random AI
STR_AI_CONFIG_NONE :(none)
@@ -4000,7 +4002,7 @@
STR_AI_CONFIG_CHANGE_GAMESCRIPT :Game Script
STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Load another script
STR_AI_CONFIG_CONFIGURE :{BLACK}Configure
-STR_AI_CONFIG_CONFIGURE_TOOLTIP :{BLACK}Configure the parameters of the Script
+STR_AI_CONFIG_CONFIGURE_TOOLTIP :{BLACK}Configure the parameters of the script
# Available AIs window
STR_AI_LIST_CAPTION :{WHITE}Available {STRING}
Index: src/script/api/game/game_window.hpp.sq
===================================================================
--- src/script/api/game/game_window.hpp.sq (revision 27553)
+++ src/script/api/game/game_window.hpp.sq (working copy)
@@ -170,6 +170,7 @@
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIS_SCROLLBAR, "WID_AIS_SCROLLBAR");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIS_ACCEPT, "WID_AIS_ACCEPT");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIS_RESET, "WID_AIS_RESET");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_CAPTION, "WID_AIC_CAPTION");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_BACKGROUND, "WID_AIC_BACKGROUND");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_DECREASE, "WID_AIC_DECREASE");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_INCREASE, "WID_AIC_INCREASE");
@@ -176,7 +177,6 @@
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_NUMBER, "WID_AIC_NUMBER");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_GAMELIST, "WID_AIC_GAMELIST");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_LIST, "WID_AIC_LIST");
- SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_SCROLLBAR, "WID_AIC_SCROLLBAR");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_MOVE_UP, "WID_AIC_MOVE_UP");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_MOVE_DOWN, "WID_AIC_MOVE_DOWN");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_CHANGE, "WID_AIC_CHANGE");
Index: src/script/api/script_window.hpp
===================================================================
--- src/script/api/script_window.hpp (revision 27553)
+++ src/script/api/script_window.hpp (working copy)
@@ -861,6 +861,7 @@
/** Widgets of the #AIConfigWindow class. */
enum AIConfigWidgets {
+ WID_AIC_CAPTION = ::WID_AIC_CAPTION, ///< Caption of the window.
WID_AIC_BACKGROUND = ::WID_AIC_BACKGROUND, ///< Window background.
WID_AIC_DECREASE = ::WID_AIC_DECREASE, ///< Decrease the number of AIs.
WID_AIC_INCREASE = ::WID_AIC_INCREASE, ///< Increase the number of AIs.
@@ -867,7 +868,6 @@
WID_AIC_NUMBER = ::WID_AIC_NUMBER, ///< Number of AIs.
WID_AIC_GAMELIST = ::WID_AIC_GAMELIST, ///< List with current selected GameScript.
WID_AIC_LIST = ::WID_AIC_LIST, ///< List with currently selected AIs.
- WID_AIC_SCROLLBAR = ::WID_AIC_SCROLLBAR, ///< Scrollbar to scroll through the selected AIs.
WID_AIC_MOVE_UP = ::WID_AIC_MOVE_UP, ///< Move up button.
WID_AIC_MOVE_DOWN = ::WID_AIC_MOVE_DOWN, ///< Move down button.
WID_AIC_CHANGE = ::WID_AIC_CHANGE, ///< Select another AI button.
Index: src/table/settings.ini
===================================================================
--- src/table/settings.ini (revision 27553)
+++ src/table/settings.ini (working copy)
@@ -103,7 +103,7 @@
from = 97
def = 0
min = 0
-max = MAX_COMPANIES - 1
+max = MAX_COMPANIES
interval = 1
proc = MaxNoAIsChange
cat = SC_BASIC
Index: src/toolbar_gui.cpp
===================================================================
--- src/toolbar_gui.cpp (revision 27553)
+++ src/toolbar_gui.cpp (working copy)
@@ -315,7 +315,7 @@
/* Changes to the per-AI settings don't get send from the server to the clients. Clients get
* the settings once they join but never update it. As such don't show the window at all
* to network clients. */
- if (!_networking || _network_server) *list->Append() = new DropDownListStringItem(STR_SETTINGS_MENU_SCRIPT_SETTINGS, OME_SCRIPT_SETTINGS, false);
+ if (!_networking || _network_server) *list->Append() = new DropDownListStringItem(((_game_mode != GM_NORMAL) ? STR_SETTINGS_MENU_SCRIPT_CONFIGURATION : STR_SETTINGS_MENU_SCRIPT_SETTINGS), OME_SCRIPT_SETTINGS, false);
*list->Append() = new DropDownListStringItem(STR_SETTINGS_MENU_NEWGRF_SETTINGS, OME_NEWGRFSETTINGS, false);
*list->Append() = new DropDownListStringItem(STR_SETTINGS_MENU_TRANSPARENCY_OPTIONS, OME_TRANSPARENCIES, false);
*list->Append() = new DropDownListItem(-1, false);
Index: src/widgets/ai_widget.h
===================================================================
--- src/widgets/ai_widget.h (revision 27553)
+++ src/widgets/ai_widget.h (working copy)
@@ -36,6 +36,7 @@
/** Widgets of the #AIConfigWindow class. */
enum AIConfigWidgets {
+ WID_AIC_CAPTION, ///< Caption of the window.
WID_AIC_BACKGROUND, ///< Window background.
WID_AIC_DECREASE, ///< Decrease the number of AIs.
WID_AIC_INCREASE, ///< Increase the number of AIs.
@@ -42,7 +43,6 @@
WID_AIC_NUMBER, ///< Number of AIs.
WID_AIC_GAMELIST, ///< List with current selected GameScript.
WID_AIC_LIST, ///< List with currently selected AIs.
- WID_AIC_SCROLLBAR, ///< Scrollbar to scroll through the selected AIs.
WID_AIC_MOVE_UP, ///< Move up button.
WID_AIC_MOVE_DOWN, ///< Move down button.
WID_AIC_CHANGE, ///< Select another AI button.