Loading

Paste #pr2xjzcwr

  1. Index: src/ai/ai_core.cpp
  2. ===================================================================
  3. --- src/ai/ai_core.cpp  (revision 27553)
  4. +++ src/ai/ai_core.cpp  (working copy)
  5. @@ -62,6 +62,7 @@
  6.     cur_company.Restore();
  7.  
  8.     InvalidateWindowData(WC_AI_DEBUG, 0, -1);
  9. +   DeleteWindowById(WC_AI_SETTINGS, company);
  10.     return;
  11.  }
  12.  
  13. Index: src/ai/ai_gui.cpp
  14. ===================================================================
  15. --- src/ai/ai_gui.cpp   (revision 27553)
  16. +++ src/ai/ai_gui.cpp   (working copy)
  17. @@ -177,7 +177,8 @@
  18.             GetConfig(slot)->Change((*it).second->GetName(), (*it).second->GetVersion());
  19.         }
  20.         InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI);
  21. -       InvalidateWindowClassesData(WC_AI_SETTINGS);
  22. +       DeleteWindowByClass(WC_AI_SETTINGS);
  23. +       DeleteWindowByClass(WC_TEXTFILE);
  24.         DeleteWindowByClass(WC_QUERY_STRING);
  25.     }
  26.  
  27. @@ -276,6 +277,23 @@
  28.  }
  29.  
  30.  /**
  31. +* Check whether a script, be it AI or GS, is dead in this slot.
  32. +* @note Also returns dead for AI slots which are currently occupied
  33. +*       by Human Companies or when the AI didn't start.
  34. +* @note Also returns dead when no GS was set up.
  35. +* @param slot The slot that is checked.
  36. +* @return true if the slot that is checked is dead.
  37. +*/
  38. +static bool IsDead(CompanyID slot)
  39. +{
  40. +   if (slot == OWNER_DEITY) {
  41. +       return Game::GetInstance() == NULL || Game::GetInstance()->IsDead();
  42. +   } else {
  43. +       return !Company::IsValidAiID(slot) || Company::Get(slot)->ai_instance->IsDead();
  44. +   }
  45. +}
  46. +
  47. +/**
  48.   * Window for settings the parameters of an AI.
  49.   */
  50.  struct AISettingsWindow : public Window {
  51. @@ -311,7 +329,7 @@
  52.         this->vscroll = this->GetScrollbar(WID_AIS_SCROLLBAR);
  53.         this->FinishInitNested(slot);  // Initializes 'this->line_height' as side effect.
  54.  
  55. -       this->SetWidgetDisabledState(WID_AIS_RESET, _game_mode != GM_MENU && Company::IsValidID(this->slot));
  56. +       this->SetWidgetDisabledState(WID_AIS_RESET, _game_mode == GM_NORMAL && !IsDead(this->slot));
  57.  
  58.         this->vscroll->SetCount((int)this->visible_settings.size());
  59.     }
  60. @@ -375,7 +393,7 @@
  61.         for (; this->vscroll->IsVisible(i) && it != visible_settings.end(); i++, it++) {
  62.             const ScriptConfigItem &config_item = **it;
  63.             int current_value = config->GetSetting((config_item).name);
  64. -           bool editable = _game_mode == GM_MENU || ((this->slot != OWNER_DEITY) && !Company::IsValidID(this->slot)) || (config_item.flags & SCRIPTCONFIG_INGAME) != 0;
  65. +           bool editable = _game_mode != GM_NORMAL || IsDead(this->slot) || (config_item.flags & SCRIPTCONFIG_INGAME) != 0;
  66.  
  67.             StringID str;
  68.             TextColour colour;
  69. @@ -438,7 +456,7 @@
  70.                 VisibleSettingsList::const_iterator it = this->visible_settings.begin();
  71.                 for (int i = 0; i < num; i++) it++;
  72.                 const ScriptConfigItem config_item = **it;
  73. -               if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (config_item.flags & SCRIPTCONFIG_INGAME) == 0) return;
  74. +               if (_game_mode == GM_NORMAL && !IsDead(this->slot) && (config_item.flags & SCRIPTCONFIG_INGAME) == 0) return;
  75.  
  76.                 if (this->clicked_row != num) {
  77.                     DeleteChildWindows(WC_QUERY_STRING);
  78. @@ -519,7 +537,7 @@
  79.                 break;
  80.  
  81.             case WID_AIS_RESET:
  82. -               if (_game_mode == GM_MENU || !Company::IsValidID(this->slot)) {
  83. +               if (_game_mode != GM_NORMAL || IsDead(this->slot)) {
  84.                     this->ai_config->ResetSettings();
  85.                     this->SetDirty();
  86.                 }
  87. @@ -532,7 +550,7 @@
  88.         if (StrEmpty(str)) return;
  89.         ScriptConfigItemList::const_iterator it = this->ai_config->GetConfigList()->begin();
  90.         for (int i = 0; i < this->clicked_row; i++) it++;
  91. -       if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (it->flags & SCRIPTCONFIG_INGAME) == 0) return;
  92. +       if (_game_mode == GM_NORMAL && !IsDead(this->slot) && (it->flags & SCRIPTCONFIG_INGAME) == 0) return;
  93.         int32 value = atoi(str);
  94.         this->ai_config->SetSetting((*it).name, value);
  95.         this->SetDirty();
  96. @@ -543,7 +561,7 @@
  97.         assert(this->clicked_dropdown);
  98.         ScriptConfigItemList::const_iterator it = this->ai_config->GetConfigList()->begin();
  99.         for (int i = 0; i < this->clicked_row; i++) it++;
  100. -       if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (it->flags & SCRIPTCONFIG_INGAME) == 0) return;
  101. +       if (_game_mode == GM_NORMAL && !IsDead(this->slot) && (it->flags & SCRIPTCONFIG_INGAME) == 0) return;
  102.         this->ai_config->SetSetting((*it).name, index);
  103.         this->SetDirty();
  104.     }
  105. @@ -658,7 +676,7 @@
  106.  static const NWidgetPart _nested_ai_config_widgets[] = {
  107.     NWidget(NWID_HORIZONTAL),
  108.         NWidget(WWT_CLOSEBOX, COLOUR_MAUVE),
  109. -       NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_AI_CONFIG_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
  110. +       NWidget(WWT_CAPTION, COLOUR_MAUVE, WID_AIC_CAPTION), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
  111.     EndContainer(),
  112.     NWidget(WWT_PANEL, COLOUR_MAUVE, WID_AIC_BACKGROUND),
  113.         NWidget(NWID_VERTICAL), SetPIP(4, 4, 4),
  114. @@ -675,8 +693,7 @@
  115.         EndContainer(),
  116.         NWidget(WWT_FRAME, COLOUR_MAUVE), SetDataTip(STR_AI_CONFIG_AI, STR_NULL), SetPadding(0, 5, 0, 5),
  117.             NWidget(NWID_HORIZONTAL),
  118. -               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),
  119. -               NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, WID_AIC_SCROLLBAR),
  120. +               NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_LIST), SetMinimalSize(288, 210), SetFill(1, 0), SetMatrixDataTip(1, 15, STR_AI_CONFIG_AILIST_TOOLTIP),
  121.             EndContainer(),
  122.         EndContainer(),
  123.         NWidget(NWID_SPACER), SetMinimalSize(0, 9),
  124. @@ -711,16 +728,11 @@
  125.  struct AIConfigWindow : public Window {
  126.     CompanyID selected_slot; ///< The currently selected AI slot or \c INVALID_COMPANY.
  127.     int line_height;         ///< Height of a single AI-name line.
  128. -   Scrollbar *vscroll;      ///< Cache of the vertical scrollbar.
  129.  
  130.     AIConfigWindow() : Window(&_ai_config_desc)
  131.     {
  132.         this->InitNested(WN_GAME_OPTIONS_AI); // Initializes 'this->line_height' as a side effect.
  133. -       this->vscroll = this->GetScrollbar(WID_AIC_SCROLLBAR);
  134.         this->selected_slot = INVALID_COMPANY;
  135. -       NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_AIC_LIST);
  136. -       this->vscroll->SetCapacity(nwi->current_y / this->line_height);
  137. -       this->vscroll->SetCount(MAX_COMPANIES);
  138.         this->OnInvalidateData(0);
  139.     }
  140.  
  141. @@ -733,6 +745,9 @@
  142.     virtual void SetStringParameters(int widget) const
  143.     {
  144.         switch (widget) {
  145. +           case WID_AIC_CAPTION:
  146. +               SetDParam(0, (_game_mode != GM_NORMAL) ? STR_AI_CONFIG_CAPTION : STR_AI_CONFIG_CAPTION_INGAME);
  147. +               break;
  148.             case WID_AIC_NUMBER:
  149.                 SetDParam(0, GetGameSettings().difficulty.max_no_competitors);
  150.                 break;
  151. @@ -764,7 +779,7 @@
  152.  
  153.             case WID_AIC_LIST:
  154.                 this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
  155. -               size->height = 8 * this->line_height;
  156. +               size->height = 15 * this->line_height;
  157.                 break;
  158.         }
  159.     }
  160. @@ -779,15 +794,11 @@
  161.         if (slot == OWNER_DEITY) return _game_mode != GM_NORMAL || Game::GetInstance() != NULL;
  162.  
  163.         if (_game_mode != GM_NORMAL) {
  164. -           return slot > 0 && slot <= GetGameSettings().difficulty.max_no_competitors;
  165. +           return slot >= 0 && slot < MAX_COMPANIES;
  166.         }
  167. -       if (Company::IsValidID(slot) || slot < 0) return false;
  168. +       if (Company::IsValidHumanID(slot) || slot < 0) return false;
  169.  
  170. -       int max_slot = GetGameSettings().difficulty.max_no_competitors;
  171. -       for (CompanyID cid = COMPANY_FIRST; cid < (CompanyID)max_slot && cid < MAX_COMPANIES; cid++) {
  172. -           if (Company::IsValidHumanID(cid)) max_slot++;
  173. -       }
  174. -       return slot < max_slot;
  175. +       return slot < MAX_COMPANIES;
  176.     }
  177.  
  178.     virtual void DrawWidget(const Rect &r, int widget) const
  179. @@ -802,7 +813,7 @@
  180.                 }
  181.  
  182.                 DrawString(r.left + 10, r.right - 10, r.top + WD_MATRIX_TOP, text,
  183. -                       (this->selected_slot == OWNER_DEITY) ? TC_WHITE : (IsEditable(OWNER_DEITY) ? TC_ORANGE : TC_SILVER));
  184. +                       (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));
  185.  
  186.                 break;
  187.             }
  188. @@ -809,10 +820,10 @@
  189.  
  190.             case WID_AIC_LIST: {
  191.                 int y = r.top;
  192. -               for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < MAX_COMPANIES; i++) {
  193. +               for (int i = 0; i < MAX_COMPANIES; i++) {
  194.                     StringID text;
  195.  
  196. -                   if ((_game_mode != GM_NORMAL && i == 0) || (_game_mode == GM_NORMAL && Company::IsValidHumanID(i))) {
  197. +                   if (_game_mode == GM_NORMAL && Company::IsValidHumanID(i)) {
  198.                         text = STR_AI_CONFIG_HUMAN_PLAYER;
  199.                     } else if (AIConfig::GetConfig((CompanyID)i)->GetInfo() != NULL) {
  200.                         SetDParamStr(0, AIConfig::GetConfig((CompanyID)i)->GetInfo()->GetName());
  201. @@ -821,7 +832,7 @@
  202.                         text = STR_AI_CONFIG_RANDOM_AI;
  203.                     }
  204.                     DrawString(r.left + 10, r.right - 10, y + WD_MATRIX_TOP, text,
  205. -                           (this->selected_slot == i) ? TC_WHITE : (IsEditable((CompanyID)i) ? TC_ORANGE : TC_SILVER));
  206. +                           (this->selected_slot == i) ? TC_WHITE : (IsEditable((CompanyID)i) ? Company::IsValidAiID(i) ? IsDead((CompanyID)i) ? TC_RED : TC_GREEN : TC_ORANGE : TC_SILVER));
  207.                     y += this->line_height;
  208.                 }
  209.                 break;
  210. @@ -845,7 +856,7 @@
  211.                 if (widget == WID_AIC_DECREASE) {
  212.                     new_value = max(0, GetGameSettings().difficulty.max_no_competitors - 1);
  213.                 } else {
  214. -                   new_value = min(MAX_COMPANIES - 1, GetGameSettings().difficulty.max_no_competitors + 1);
  215. +                   new_value = min(MAX_COMPANIES, GetGameSettings().difficulty.max_no_competitors + 1);
  216.                 }
  217.                 IConsoleSetSetting("difficulty.max_no_competitors", new_value);
  218.                 this->InvalidateData();
  219. @@ -860,7 +871,7 @@
  220.             }
  221.  
  222.             case WID_AIC_LIST: { // Select a slot
  223. -               this->selected_slot = (CompanyID)this->vscroll->GetScrolledRowFromWidget(pt.y, this, widget, 0, this->line_height);
  224. +               this->selected_slot = (CompanyID)this->GetRowFromWidget(pt.y, widget, 0, this->line_height);
  225.                 this->InvalidateData();
  226.                 if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
  227.                 break;
  228. @@ -867,19 +878,17 @@
  229.             }
  230.  
  231.             case WID_AIC_MOVE_UP:
  232. -               if (IsEditable(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot - 1))) {
  233. +               if (IsEditable(this->selected_slot) && IsDead(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot - 1)) && IsDead((CompanyID)(this->selected_slot - 1))) {
  234.                     Swap(GetGameSettings().ai_config[this->selected_slot], GetGameSettings().ai_config[this->selected_slot - 1]);
  235.                     this->selected_slot--;
  236. -                   this->vscroll->ScrollTowards(this->selected_slot);
  237.                     this->InvalidateData();
  238.                 }
  239.                 break;
  240.  
  241.             case WID_AIC_MOVE_DOWN:
  242. -               if (IsEditable(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot + 1))) {
  243. +               if (IsEditable(this->selected_slot) && IsDead(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot + 1)) && IsDead((CompanyID)(this->selected_slot + 1))) {
  244.                     Swap(GetGameSettings().ai_config[this->selected_slot], GetGameSettings().ai_config[this->selected_slot + 1]);
  245.                     this->selected_slot++;
  246. -                   this->vscroll->ScrollTowards(this->selected_slot);
  247.                     this->InvalidateData();
  248.                 }
  249.                 break;
  250. @@ -922,12 +931,21 @@
  251.         if (!gui_scope) return;
  252.  
  253.         this->SetWidgetDisabledState(WID_AIC_DECREASE, GetGameSettings().difficulty.max_no_competitors == 0);
  254. -       this->SetWidgetDisabledState(WID_AIC_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES - 1);
  255. -       this->SetWidgetDisabledState(WID_AIC_CHANGE, (this->selected_slot == OWNER_DEITY && _game_mode == GM_NORMAL) || this->selected_slot == INVALID_COMPANY);
  256. +       this->SetWidgetDisabledState(WID_AIC_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES);
  257. +       this->SetWidgetDisabledState(WID_AIC_CHANGE, this->selected_slot == INVALID_COMPANY || _game_mode == GM_NORMAL && (this->selected_slot == OWNER_DEITY || !IsDead(this->selected_slot)));
  258.         this->SetWidgetDisabledState(WID_AIC_CONFIGURE, this->selected_slot == INVALID_COMPANY || GetConfig(this->selected_slot)->GetConfigList()->size() == 0);
  259. -       this->SetWidgetDisabledState(WID_AIC_MOVE_UP, this->selected_slot == OWNER_DEITY || this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot - 1)));
  260. -       this->SetWidgetDisabledState(WID_AIC_MOVE_DOWN, this->selected_slot == OWNER_DEITY || this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot + 1)));
  261.  
  262. +       /* Display either Settings or Configure button */
  263. +       NWidgetCore *configure_button = this->GetWidget<NWidgetCore>(WID_AIC_CONFIGURE);
  264. +       if (_game_mode == GM_NORMAL && this->selected_slot != INVALID_COMPANY && !IsDead(this->selected_slot)) {
  265. +           configure_button->SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP);
  266. +       } else {
  267. +           configure_button->SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP);
  268. +       }
  269. +
  270. +       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)));
  271. +       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)));
  272. +
  273.         for (TextfileType tft = TFT_BEGIN; tft < TFT_END; tft++) {
  274.             this->SetWidgetDisabledState(WID_AIC_TEXTFILE + tft, this->selected_slot == INVALID_COMPANY || (GetConfig(this->selected_slot)->GetTextfile(tft, this->selected_slot) == NULL));
  275.         }
  276. @@ -991,19 +1009,6 @@
  277.     }
  278.  
  279.     /**
  280. -    * Check whether the currently selected AI/GS is dead.
  281. -    * @return true if dead.
  282. -    */
  283. -   bool IsDead() const
  284. -   {
  285. -       if (ai_debug_company == OWNER_DEITY) {
  286. -           GameInstance *game = Game::GetInstance();
  287. -           return game == NULL || game->IsDead();
  288. -       }
  289. -       return !Company::IsValidAiID(ai_debug_company) || Company::Get(ai_debug_company)->ai_instance->IsDead();
  290. -   }
  291. -
  292. -   /**
  293.      * Check whether a company is a valid AI company or GS.
  294.      * @param company Company to check for validity.
  295.      * @return true if company is valid for debugging.
  296. @@ -1276,7 +1281,7 @@
  297.  
  298.             case WID_AID_CONTINUE_BTN:
  299.                 /* Unpause current AI / game script and mark the corresponding script button dirty. */
  300. -               if (!this->IsDead()) {
  301. +               if (!IsDead(this->ai_debug_company)) {
  302.                     if (ai_debug_company == OWNER_DEITY) {
  303.                         Game::Unpause();
  304.                     } else {
  305. @@ -1336,7 +1341,7 @@
  306.                 this->break_string_filter.AddLine(log->lines[log->pos]);
  307.                 if (this->break_string_filter.GetState()) {
  308.                     /* Pause execution of script. */
  309. -                   if (!this->IsDead()) {
  310. +                   if (!IsDead(this->ai_debug_company)) {
  311.                         if (ai_debug_company == OWNER_DEITY) {
  312.                             Game::Pause();
  313.                         } else {
  314. @@ -1375,6 +1380,15 @@
  315.         this->SetWidgetLoweredState(WID_AID_MATCH_CASE_BTN, this->case_sensitive_break_check);
  316.  
  317.         this->SetWidgetDisabledState(WID_AID_SETTINGS, ai_debug_company == INVALID_COMPANY);
  318. +
  319. +       /* Display either Settings or Configure button */
  320. +       NWidgetCore *settings_button = this->GetWidget<NWidgetCore>(WID_AID_SETTINGS);
  321. +       if (ai_debug_company == INVALID_COMPANY || !IsDead(this->ai_debug_company)) {
  322. +           settings_button->SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP);
  323. +       } else {
  324. +           settings_button->SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP);
  325. +       }
  326. +
  327.         this->SetWidgetDisabledState(WID_AID_RELOAD_TOGGLE, ai_debug_company == INVALID_COMPANY || ai_debug_company == OWNER_DEITY);
  328.         this->SetWidgetDisabledState(WID_AID_CONTINUE_BTN, ai_debug_company == INVALID_COMPANY ||
  329.                 (ai_debug_company == OWNER_DEITY ? !Game::IsPaused() : !AI::IsPaused(ai_debug_company)));
  330. Index: src/ai/ai_instance.cpp
  331. ===================================================================
  332. --- src/ai/ai_instance.cpp  (revision 27553)
  333. +++ src/ai/ai_instance.cpp  (working copy)
  334. @@ -81,6 +81,7 @@
  335.  
  336.  #include "../company_base.h"
  337.  #include "../company_func.h"
  338. +#include "../window_func.h"
  339.  
  340.  #include "../safeguards.h"
  341.  
  342. @@ -214,6 +215,7 @@
  343.     ScriptInstance::Died();
  344.  
  345.     ShowAIDebugWindow(_current_company);
  346. +   InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI);
  347.  
  348.     const AIInfo *info = AIConfig::GetConfig(_current_company, AIConfig::SSS_FORCE_GAME)->GetInfo();
  349.     if (info != NULL) {
  350. Index: src/game/game_instance.cpp
  351. ===================================================================
  352. --- src/game/game_instance.cpp  (revision 27553)
  353. +++ src/game/game_instance.cpp  (working copy)
  354. @@ -85,6 +85,8 @@
  355.  #include "../script/api/game/game_waypointlist.hpp.sq"
  356.  #include "../script/api/game/game_window.hpp.sq"
  357.  
  358. +#include "../window_func.h"
  359. +
  360.  #include "../safeguards.h"
  361.  
  362.  
  363. @@ -232,6 +234,7 @@
  364.     ScriptInstance::Died();
  365.  
  366.     ShowAIDebugWindow(OWNER_DEITY);
  367. +   InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI);
  368.  
  369.     const GameInfo *info = Game::GetInfo();
  370.     if (info != NULL) {
  371. Index: src/lang/english.txt
  372. ===================================================================
  373. --- src/lang/english.txt    (revision 27553)
  374. +++ src/lang/english.txt    (working copy)
  375. @@ -373,6 +373,7 @@
  376.  ############ range for settings menu starts
  377.  STR_SETTINGS_MENU_GAME_OPTIONS                                  :Game options
  378.  STR_SETTINGS_MENU_CONFIG_SETTINGS_TREE                          :Settings
  379. +STR_SETTINGS_MENU_SCRIPT_CONFIGURATION                          :AI/Game script configuration
  380.  STR_SETTINGS_MENU_SCRIPT_SETTINGS                               :AI/Game script settings
  381.  STR_SETTINGS_MENU_NEWGRF_SETTINGS                               :NewGRF settings
  382.  STR_SETTINGS_MENU_TRANSPARENCY_OPTIONS                          :Transparency options
  383. @@ -1738,7 +1739,7 @@
  384.  STR_INTRO_CONFIG_SETTINGS_TREE                                  :{BLACK}Settings
  385.  STR_INTRO_NEWGRF_SETTINGS                                       :{BLACK}NewGRF Settings
  386.  STR_INTRO_ONLINE_CONTENT                                        :{BLACK}Check Online Content
  387. -STR_INTRO_SCRIPT_SETTINGS                                       :{BLACK}AI/Game Script Settings
  388. +STR_INTRO_SCRIPT_SETTINGS                                       :{BLACK}AI/Game Script Configuration
  389.  STR_INTRO_QUIT                                                  :{BLACK}Exit
  390.  
  391.  STR_INTRO_TOOLTIP_NEW_GAME                                      :{BLACK}Start a new game. Ctrl+Click skips map configuration
  392. @@ -1758,7 +1759,7 @@
  393.  STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE                          :{BLACK}Display settings
  394.  STR_INTRO_TOOLTIP_NEWGRF_SETTINGS                               :{BLACK}Display NewGRF settings
  395.  STR_INTRO_TOOLTIP_ONLINE_CONTENT                                :{BLACK}Check for new and updated content to download
  396. -STR_INTRO_TOOLTIP_SCRIPT_SETTINGS                               :{BLACK}Display AI/Game script settings
  397. +STR_INTRO_TOOLTIP_SCRIPT_SETTINGS                               :{BLACK}Display AI/Game script configuration
  398.  STR_INTRO_TOOLTIP_QUIT                                          :{BLACK}Exit 'OpenTTD'
  399.  
  400.  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.
  401. @@ -3980,9 +3981,10 @@
  402.  
  403.  # AI configuration window
  404.  STR_AI_CONFIG_CAPTION                                           :{WHITE}AI/Game Script Configuration
  405. -STR_AI_CONFIG_GAMELIST_TOOLTIP                                  :{BLACK}The Game Script that will be loaded in the next game
  406. -STR_AI_CONFIG_AILIST_TOOLTIP                                    :{BLACK}The AIs that will be loaded in the next game
  407. -STR_AI_CONFIG_HUMAN_PLAYER                                      :Human player
  408. +STR_AI_CONFIG_CAPTION_INGAME                                    :{WHITE}AI/Game Script Settings
  409. +STR_AI_CONFIG_GAMELIST_TOOLTIP                                  :{BLACK}The Game Script that is loaded or will be loaded in the next game
  410. +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
  411. +STR_AI_CONFIG_HUMAN_PLAYER                                      :Human Company
  412.  STR_AI_CONFIG_RANDOM_AI                                         :Random AI
  413.  STR_AI_CONFIG_NONE                                              :(none)
  414.  
  415. @@ -4000,7 +4002,7 @@
  416.  STR_AI_CONFIG_CHANGE_GAMESCRIPT                                 :Game Script
  417.  STR_AI_CONFIG_CHANGE_TOOLTIP                                    :{BLACK}Load another script
  418.  STR_AI_CONFIG_CONFIGURE                                         :{BLACK}Configure
  419. -STR_AI_CONFIG_CONFIGURE_TOOLTIP                                 :{BLACK}Configure the parameters of the Script
  420. +STR_AI_CONFIG_CONFIGURE_TOOLTIP                                 :{BLACK}Configure the parameters of the script
  421.  
  422.  # Available AIs window
  423.  STR_AI_LIST_CAPTION                                             :{WHITE}Available {STRING}
  424. Index: src/script/api/game/game_window.hpp.sq
  425. ===================================================================
  426. --- src/script/api/game/game_window.hpp.sq  (revision 27553)
  427. +++ src/script/api/game/game_window.hpp.sq  (working copy)
  428. @@ -170,6 +170,7 @@
  429.     SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIS_SCROLLBAR,                         "WID_AIS_SCROLLBAR");
  430.     SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIS_ACCEPT,                            "WID_AIS_ACCEPT");
  431.     SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIS_RESET,                             "WID_AIS_RESET");
  432. +   SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_CAPTION,                           "WID_AIC_CAPTION");
  433.     SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_BACKGROUND,                        "WID_AIC_BACKGROUND");
  434.     SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_DECREASE,                          "WID_AIC_DECREASE");
  435.     SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_INCREASE,                          "WID_AIC_INCREASE");
  436. @@ -176,7 +177,6 @@
  437.     SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_NUMBER,                            "WID_AIC_NUMBER");
  438.     SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_GAMELIST,                          "WID_AIC_GAMELIST");
  439.     SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_LIST,                              "WID_AIC_LIST");
  440. -   SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_SCROLLBAR,                         "WID_AIC_SCROLLBAR");
  441.     SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_MOVE_UP,                           "WID_AIC_MOVE_UP");
  442.     SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_MOVE_DOWN,                         "WID_AIC_MOVE_DOWN");
  443.     SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_CHANGE,                            "WID_AIC_CHANGE");
  444. Index: src/script/api/script_window.hpp
  445. ===================================================================
  446. --- src/script/api/script_window.hpp    (revision 27553)
  447. +++ src/script/api/script_window.hpp    (working copy)
  448. @@ -861,6 +861,7 @@
  449.  
  450.     /** Widgets of the #AIConfigWindow class. */
  451.     enum AIConfigWidgets {
  452. +       WID_AIC_CAPTION                              = ::WID_AIC_CAPTION,                              ///< Caption of the window.
  453.         WID_AIC_BACKGROUND                           = ::WID_AIC_BACKGROUND,                           ///< Window background.
  454.         WID_AIC_DECREASE                             = ::WID_AIC_DECREASE,                             ///< Decrease the number of AIs.
  455.         WID_AIC_INCREASE                             = ::WID_AIC_INCREASE,                             ///< Increase the number of AIs.
  456. @@ -867,7 +868,6 @@
  457.         WID_AIC_NUMBER                               = ::WID_AIC_NUMBER,                               ///< Number of AIs.
  458.         WID_AIC_GAMELIST                             = ::WID_AIC_GAMELIST,                             ///< List with current selected GameScript.
  459.         WID_AIC_LIST                                 = ::WID_AIC_LIST,                                 ///< List with currently selected AIs.
  460. -       WID_AIC_SCROLLBAR                            = ::WID_AIC_SCROLLBAR,                            ///< Scrollbar to scroll through the selected AIs.
  461.         WID_AIC_MOVE_UP                              = ::WID_AIC_MOVE_UP,                              ///< Move up button.
  462.         WID_AIC_MOVE_DOWN                            = ::WID_AIC_MOVE_DOWN,                            ///< Move down button.
  463.         WID_AIC_CHANGE                               = ::WID_AIC_CHANGE,                               ///< Select another AI button.
  464. Index: src/table/settings.ini
  465. ===================================================================
  466. --- src/table/settings.ini  (revision 27553)
  467. +++ src/table/settings.ini  (working copy)
  468. @@ -103,7 +103,7 @@
  469.  from     = 97
  470.  def      = 0
  471.  min      = 0
  472. -max      = MAX_COMPANIES - 1
  473. +max      = MAX_COMPANIES
  474.  interval = 1
  475.  proc     = MaxNoAIsChange
  476.  cat      = SC_BASIC
  477. Index: src/toolbar_gui.cpp
  478. ===================================================================
  479. --- src/toolbar_gui.cpp (revision 27553)
  480. +++ src/toolbar_gui.cpp (working copy)
  481. @@ -315,7 +315,7 @@
  482.     /* Changes to the per-AI settings don't get send from the server to the clients. Clients get
  483.      * the settings once they join but never update it. As such don't show the window at all
  484.      * to network clients. */
  485. -   if (!_networking || _network_server) *list->Append() = new DropDownListStringItem(STR_SETTINGS_MENU_SCRIPT_SETTINGS, OME_SCRIPT_SETTINGS, false);
  486. +   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);
  487.     *list->Append() = new DropDownListStringItem(STR_SETTINGS_MENU_NEWGRF_SETTINGS,          OME_NEWGRFSETTINGS, false);
  488.     *list->Append() = new DropDownListStringItem(STR_SETTINGS_MENU_TRANSPARENCY_OPTIONS,     OME_TRANSPARENCIES, false);
  489.     *list->Append() = new DropDownListItem(-1, false);
  490. Index: src/widgets/ai_widget.h
  491. ===================================================================
  492. --- src/widgets/ai_widget.h (revision 27553)
  493. +++ src/widgets/ai_widget.h (working copy)
  494. @@ -36,6 +36,7 @@
  495.  
  496.  /** Widgets of the #AIConfigWindow class. */
  497.  enum AIConfigWidgets {
  498. +   WID_AIC_CAPTION,          ///< Caption of the window.
  499.     WID_AIC_BACKGROUND,       ///< Window background.
  500.     WID_AIC_DECREASE,         ///< Decrease the number of AIs.
  501.     WID_AIC_INCREASE,         ///< Increase the number of AIs.
  502. @@ -42,7 +43,6 @@
  503.     WID_AIC_NUMBER,           ///< Number of AIs.
  504.     WID_AIC_GAMELIST,         ///< List with current selected GameScript.
  505.     WID_AIC_LIST,             ///< List with currently selected AIs.
  506. -   WID_AIC_SCROLLBAR,        ///< Scrollbar to scroll through the selected AIs.
  507.     WID_AIC_MOVE_UP,          ///< Move up button.
  508.     WID_AIC_MOVE_DOWN,        ///< Move down button.
  509.     WID_AIC_CHANGE,           ///< Select another AI button.

Comments