@@ -128,6 +128,11 @@ function GetAvailableTransportModes(min_vehicles_left = 1)
128
128
return tm_list;
129
129
}
130
130
131
+ function GetSupportedVehicleTypeList ()
132
+ {
133
+ return [AIVehicle. VT_AIR , AIVehicle. VT_ROAD ];
134
+ }
135
+
131
136
function GetVehiclesWithoutOrders ()
132
137
{
133
138
local empty_orders = AIVehicleList ();
@@ -203,14 +208,37 @@ function GetCargoFromStation(station_id)
203
208
function AnyVehicleTypeBuildable ()
204
209
{
205
210
local vt_available = false ;
206
- foreach (vt in [AIVehicle. VT_ROAD , AIVehicle. VT_AIR ])
211
+ local vt_list = GetSupportedVehicleTypeList ();
212
+ foreach (vt in vt_list)
207
213
{
208
- vt_available = vt_available || Vehicle. GetVehicleLimit (vt);
214
+ vt_available = vt_available || Vehicle. GetVehicleLimit (vt) > 0 ;
209
215
}
210
216
211
217
return vt_available;
212
218
}
213
219
220
+ // Call this function if AnyVehicleTypeBuildable returns false
221
+ function DisplayEnableVehicleTypesTips ()
222
+ {
223
+ local vt_list = GetSupportedVehicleTypeList ();
224
+ foreach (vt in vt_list)
225
+ {
226
+ local label = TransportModeToString ( VehicleTypeToTransportMode (vt) );
227
+ label = label. toupper ();
228
+
229
+ local s = Vehicle. GetVehicleTypeDisabledBySettingString (vt);
230
+ if (s != null )
231
+ Log. Info (label + " is disabled by: " + s);
232
+ else
233
+ {
234
+ if (Vehicle. GetVehiclesLeft (vt) == 0 )
235
+ Log. Info (label + " is enabled, but have zero vehicles left" );
236
+ else
237
+ Log. Info (label + " is enabled" );
238
+ }
239
+ }
240
+ }
241
+
214
242
// if avoid_small_airports is true, the result will only contain small airports
215
243
// if there are no large ones.
216
244
function GetAirportTypeList_AllowedAndBuildable (avoid_small_airports = false )
@@ -525,6 +553,8 @@ function CluelessPlus::Start()
525
553
Log. Error (" All transport modes that are supported by this AI are disabled for AIs (or have vehicle limit = 0)." , Log. LVL_INFO );
526
554
Log. Info (" Enable road or air transport mode in advanced settings if you want that this AI should build something" , Log. LVL_INFO );
527
555
Log. Info (" " , Log. LVL_INFO );
556
+ DisplayEnableVehicleTypesTips ();
557
+ Log. Info (" " , Log. LVL_INFO );
528
558
}
529
559
530
560
state_build = false ;
@@ -735,7 +765,7 @@ function CluelessPlus::Start()
735
765
736
766
// wait a year for next yearly manage
737
767
last_yearly_manage = AIDate. GetCurrentDate ();
738
- Log. Info (" Yearly manage - done" , Log. LVL_INFO );
768
+ Log. Info (" Yearly manage - done" , Log. LVL_SUB_DECISIONS );
739
769
}
740
770
741
771
TimerStop (" all" );
@@ -1119,10 +1149,13 @@ function CluelessPlus::GetNewPairMoneyLimit()
1119
1149
{
1120
1150
local limits = this . GetNewPairMoneyLimitPerTransportMode ();
1121
1151
local min_limit = null ;
1122
- foreach (item in limits )
1152
+ if (limits != null )
1123
1153
{
1124
- if (min_limit == null || item. limit < min_limit)
1125
- min_limit = item. limit ;
1154
+ foreach (item in limits)
1155
+ {
1156
+ if (min_limit == null || item. limit < min_limit)
1157
+ min_limit = item. limit ;
1158
+ }
1126
1159
}
1127
1160
1128
1161
if (min_limit == null ) min_limit = 95000 ;
@@ -1137,7 +1170,7 @@ function CluelessPlus::GetNewPairMoneyLimitPerTransportMode()
1137
1170
1138
1171
// Make sure there are at least one transport mode
1139
1172
if (tm_list. len () == 0 )
1140
- return 95000 ;
1173
+ return null ;
1141
1174
1142
1175
local tm_money_limits = [];
1143
1176
foreach (tm in tm_list)
0 commit comments