Merge tag '14.0-beta1' into jgrpp
# Conflicts: # src/3rdparty/squirrel/squirrel/sqcompiler.cpp # src/aircraft.h # src/animated_tile.h # src/base_consist.h # src/cargotype.h # src/company_gui.cpp # src/console_cmds.cpp # src/core/overflowsafe_type.hpp # src/engine_gui.cpp # src/industry_gui.cpp # src/lang/english.txt # src/music/extmidi.cpp # src/network/core/network_game_info.cpp # src/network/network_server.cpp # src/newgrf.cpp # src/newgrf_industries.cpp # src/order_base.h # src/order_cmd.cpp # src/order_gui.cpp # src/order_type.h # src/os/macosx/misc_osx.cpp # src/os/windows/crashlog_win.cpp # src/rail_gui.cpp # src/rail_gui.h # src/roadveh.h # src/roadveh_cmd.cpp # src/saveload/afterload.cpp # src/saveload/company_sl.cpp # src/saveload/saveload.cpp # src/saveload/saveload.h # src/saveload/saveload_error.hpp # src/script/api/script_town.cpp # src/settingsgen/settingsgen.cpp # src/ship.h # src/ship_cmd.cpp # src/smallmap_gui.cpp # src/spritecache.cpp # src/stdafx.h # src/strgen/strgen.cpp # src/strgen/strgen.h # src/table/settings/script_settings.ini # src/timetable_cmd.cpp # src/timetable_gui.cpp # src/town.h # src/town_cmd.cpp # src/town_cmd.h # src/town_gui.cpp # src/train.h # src/train_cmd.cpp # src/tree_cmd.cpp # src/vehicle.cpp # src/vehicle_base.h # src/vehicle_cmd.cpp # src/vehicle_gui.cpp # src/vehiclelist.cpp # src/waypoint_base.h # src/widget.cpp
This commit is contained in:
@@ -148,20 +148,14 @@ struct AIConfigWindow : public Window {
|
||||
/**
|
||||
* Can the AI config in the given company slot be edited?
|
||||
* @param slot The slot to query.
|
||||
* @return True if and only if the given AI Config slot can e edited.
|
||||
* @return True if and only if the given AI Config slot can be edited.
|
||||
*/
|
||||
static bool IsEditable(CompanyID slot)
|
||||
{
|
||||
if (_game_mode != GM_NORMAL) {
|
||||
return slot > 0 && slot <= GetGameSettings().difficulty.max_no_competitors;
|
||||
return slot > 0 && slot < MAX_COMPANIES;
|
||||
}
|
||||
if (Company::IsValidID(slot)) 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 && !Company::IsValidID(slot);
|
||||
}
|
||||
|
||||
void DrawWidget(const Rect &r, WidgetID widget) const override
|
||||
@@ -185,7 +179,14 @@ struct AIConfigWindow : public Window {
|
||||
if (this->selected_slot == i) {
|
||||
tc = TC_WHITE;
|
||||
} else if (IsEditable((CompanyID)i)) {
|
||||
tc = TC_ORANGE;
|
||||
int max_slot = GetGameSettings().difficulty.max_no_competitors;
|
||||
for (const Company *c : Company::Iterate()) {
|
||||
if (c->is_ai) max_slot--;
|
||||
}
|
||||
for (CompanyID cid = COMPANY_FIRST; cid < (CompanyID)max_slot && cid < MAX_COMPANIES; cid++) {
|
||||
if (Company::IsValidHumanID(cid)) max_slot++;
|
||||
}
|
||||
if (i < max_slot) tc = TC_ORANGE;
|
||||
} else if (Company::IsValidAiID(i)) {
|
||||
tc = TC_GREEN;
|
||||
}
|
||||
|
Reference in New Issue
Block a user