Loading

Revision differences

Old revision #pgd6a1c5yNew revision #pvg5ftb8r
1Index: src/ai/ai_gui.cpp  1Index: src/ai/ai_gui.cpp  
2===================================================================  2===================================================================  
3--- src/ai/ai_gui.cpp    (revision 27548)  3--- src/ai/ai_gui.cpp    (revision 27549)
4+++ src/ai/ai_gui.cpp    (working copy)  4+++ src/ai/ai_gui.cpp    (working copy)  
5@@ -685,7 +685,10 @@  5@@ -685,7 +685,7 @@
6         EndContainer(),  6         EndContainer(),  
7         NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7),  7         NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7),  
8             NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CHANGE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CHANGE, STR_AI_CONFIG_CHANGE_TOOLTIP),  8             NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CHANGE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CHANGE, STR_AI_CONFIG_CHANGE_TOOLTIP),  
9-            NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CONFIGURE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP),  9-            NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CONFIGURE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP),  
10+            NWidget(NWID_SELECTION, INVALID_COLOUR, WID_AIC_SELECT_CONFIGURE),  10+            NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CONFIGURE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_DEBUG_SETTINGS_TOOLTIP),
11+                NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CONFIGURE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP),    
12+                NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_SETTINGS), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP),    
13+            EndContainer(),    
14             NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CLOSE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_SETTINGS_CLOSE, STR_NULL),  11             NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CLOSE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_SETTINGS_CLOSE, STR_NULL),  
15             EndContainer(),  12             EndContainer(),  
16         NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7),  13         NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7),  
17@@ -751,6 +754,34 @@  17@@ -751,6 +751,29 @@
18                         break;  15                         break;  
19                 }  16                 }  
20                 break;  17                 break;  
21+            case WID_AIC_CONFIGURE:  18+//            case WID_AIC_CONFIGURE:
22+                switch (selected_slot) {  19+//                switch (selected_slot) {
23+                    case OWNER_DEITY:  20+//                    case OWNER_DEITY:
24+                        SetDParam(0, _game_mode == GM_NORMAL ? IsEditable(this->selected_slot) ? STR_AI_DEBUG_SETTINGS : STR_AI_CONFIG_CONFIGURE : STR_AI_CONFIG_CONFIGURE);  21+//                        if (_game_mode == GM_NORMAL && IsEditable(selected_slot)) {
25+                        break;  22+//                            SetDParam(0, STR_AI_DEBUG_SETTINGS);
   23+//                        } else {
   24+//                            SetDParam(0, STR_AI_CONFIG_CONFIGURE);
   25+//                        }
   26+//                        break;
26+  27+  
27+                    case INVALID_COMPANY:  27+//                    case INVALID_COMPANY:
28+                        SetDParam(0, STR_AI_CONFIG_CONFIGURE);  28+//                        SetDParam(0, STR_AI_CONFIG_CONFIGURE);
29+                        break;  29+//                        break;
30+  31+  
31+                    default:  31+//                    default:
32+                        SetDParam(0, (_game_mode == GM_NORMAL && IsEditable((CompanyID)(this->selected_slot)) && Company::IsValidID(this->selected_slot) && Company::IsValidAiID(this->selected_slot) && !Company::Get(this->selected_slot)->ai_instance->IsDead()) ? STR_AI_DEBUG_SETTINGS : STR_AI_CONFIG_CONFIGURE);  32+//                        if (_game_mode != GM_NORMAL || (_game_mode == GM_NORMAL && IsEditable((CompanyID)selected_slot) && (!Company::IsValidID(selected_slot) || Company::IsValidAiID(selected_slot) && Company::Get(selected_slot)->ai_instance->IsDead()))) {
33+                        break;  33+//                            SetDParam(0, STR_AI_CONFIG_CONFIGURE);
34+                }  34+//                        } else {
35+            case WID_AIC_SETTINGS:  35+//                            SetDParam(0, STR_AI_DEBUG_SETTINGS);
36+                switch (selected_slot) {  36+//                        }
37+                    case OWNER_DEITY:  37+//                        break;
38+                        SetDParam(0, _game_mode == GM_NORMAL ? IsEditable(this->selected_slot) ? STR_AI_DEBUG_SETTINGS : STR_AI_CONFIG_CONFIGURE : STR_AI_CONFIG_CONFIGURE);  38+//                }
39+                        break;  39+//                break;
40+    
41+                    case INVALID_COMPANY:    
42+                        SetDParam(0, STR_AI_DEBUG_SETTINGS);    
43+                        break;    
44+    
45+                    default:    
46+                        SetDParam(0, (_game_mode == GM_NORMAL && IsEditable((CompanyID)(this->selected_slot)) && Company::IsValidID(this->selected_slot) && Company::IsValidAiID(this->selected_slot) && !Company::Get(this->selected_slot)->ai_instance->IsDead()) ? STR_AI_DEBUG_SETTINGS : STR_AI_CONFIG_CONFIGURE);    
47+                        break;    
48+                }    
49         }  41         }  
50     }  42     }  
51   43   
52Index: src/widgets/ai_widget.h  52@@ -925,6 +948,16 @@
53===================================================================  53         this->SetWidgetDisabledState(WID_AIC_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES - 1);
54--- src/widgets/ai_widget.h    (revision 27548)  54         this->SetWidgetDisabledState(WID_AIC_CHANGE, (this->selected_slot == OWNER_DEITY && _game_mode == GM_NORMAL) || this->selected_slot == INVALID_COMPANY);
55+++ src/widgets/ai_widget.h    (working copy)  55         this->SetWidgetDisabledState(WID_AIC_CONFIGURE, this->selected_slot == INVALID_COMPANY || GetConfig(this->selected_slot)->GetConfigList()->size() == 0);
56@@ -46,7 +46,11 @@    
57     WID_AIC_MOVE_UP,          ///< Move up button.    
58     WID_AIC_MOVE_DOWN,        ///< Move down button.    
59     WID_AIC_CHANGE,           ///< Select another AI button.    
60-    WID_AIC_CONFIGURE,        ///< Change AI settings button.    
61+  48+  
62+    WID_AIC_SELECT_CONFIGURE, ///< Change AI settings button.  49+        NWidgetCore *configure_button = this->GetWidget<NWidgetCore>(WID_AIC_CONFIGURE);
63+    WID_AIC_CONFIGURE,        ///< Configure button.  50+        /* Display Configure button*/
64+    WID_AIC_SETTINGS,         ///< Settings button.  51+        if (this->selected_slot == INVALID_OWNER || (this->selected_slot == OWNER_DEITY && _game_mode != GM_NORMAL && IsEditable(this->selected_slot)) || ((this->selected_slot != OWNER_DEITY && this->selected_slot != INVALID_OWNER) && (_game_mode != GM_NORMAL || (_game_mode == GM_NORMAL && IsEditable((CompanyID)selected_slot) && (!Company::IsValidID(selected_slot) || Company::IsValidAiID(selected_slot) && Company::Get(selected_slot)->ai_instance->IsDead()))))) {
65+  52+            configure_button->SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP);
66     WID_AIC_CLOSE,            ///< Close window button.  53+        } else {
67     WID_AIC_TEXTFILE,         ///< Open AI readme, changelog (+1) or license (+2).  54+            /* Display Settings button */
68     WID_AIC_CONTENT_DOWNLOAD = WID_AIC_TEXTFILE + TFT_END, ///< Download content button. 55+            configure_button->SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP);
   56+        }
   57+       
   58         this->SetWidgetDisabledState(WID_AIC_MOVE_UP, this->selected_slot == OWNER_DEITY || this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot - 1)));
   59         this->SetWidgetDisabledState(WID_AIC_MOVE_DOWN, this->selected_slot == OWNER_DEITY || this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot + 1)));