Changeset - r10996:0e63d43ecea9
[Not reviewed]
master
0 14 0
rubidium - 16 years ago 2009-02-04 16:45:07
rubidium@openttd.org
(svn r15336) -Fix: do not use _current_company in the GUI as there are no guarantees that _current_company is the same as _local_company.
14 files changed with 18 insertions and 18 deletions:
0 comments (0 inline, 0 general)
src/airport_gui.cpp
Show inline comments
 
@@ -147,7 +147,7 @@ static const WindowDesc _air_toolbar_des
 

	
 
void ShowBuildAirToolbar()
 
{
 
	if (!IsValidCompanyID(_current_company)) return;
 
	if (!IsValidCompanyID(_local_company)) return;
 

	
 
	DeleteWindowByClass(WC_BUILD_TOOLBAR);
 
	AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
src/cheat_gui.cpp
Show inline comments
 
@@ -166,7 +166,7 @@ struct CheatWindow : Window {
 
						case STR_CHEAT_CHANGE_COMPANY:
 
							SetDParam(0, val + 1);
 
							GetString(buf, STR_CHEAT_CHANGE_COMPANY, lastof(buf));
 
							DrawCompanyIcon(_current_company, 60 + GetStringBoundingBox(buf).width, y + 2);
 
							DrawCompanyIcon(_local_company, 60 + GetStringBoundingBox(buf).width, y + 2);
 
							break;
 

	
 
						/* Set correct string for switch climate cheat */
src/dock_gui.cpp
Show inline comments
 
@@ -282,7 +282,7 @@ static const WindowDesc _build_docks_too
 

	
 
void ShowBuildDocksToolbar()
 
{
 
	if (!IsValidCompanyID(_current_company)) return;
 
	if (!IsValidCompanyID(_local_company)) return;
 

	
 
	DeleteWindowByClass(WC_BUILD_TOOLBAR);
 
	AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_toolbar_desc, TRANSPORT_WATER);
src/industry_gui.cpp
Show inline comments
 
@@ -417,7 +417,7 @@ public:
 

	
 
void ShowBuildIndustryWindow()
 
{
 
	if (_game_mode != GM_EDITOR && !IsValidCompanyID(_current_company)) return;
 
	if (_game_mode != GM_EDITOR && !IsValidCompanyID(_local_company)) return;
 
	if (BringWindowToFrontById(WC_BUILD_INDUSTRY, 0)) return;
 
	new BuildIndustryWindow();
 
}
src/main_gui.cpp
Show inline comments
 
@@ -61,7 +61,7 @@ void HandleOnEditText(const char *str)
 
	switch (_rename_what) {
 
#ifdef ENABLE_NETWORK
 
	case 3: { // Give money, you can only give money in excess of loan
 
		const Company *c = GetCompany(_current_company);
 
		const Company *c = GetCompany(_local_company);
 
		Money money = min(c->money - c->current_loan, (Money)(atoi(str) / _currency->rate));
 

	
 
		uint32 money_c = Clamp(ClampToI32(money), 0, 20000000); // Clamp between 20 million and 0
src/order_gui.cpp
Show inline comments
 
@@ -350,7 +350,7 @@ static Order GetOrderCmdFromTile(const V
 
		StationID st_index = GetStationIndex(tile);
 
		const Station *st = GetStation(st_index);
 

	
 
		if (st->owner == _current_company || st->owner == OWNER_NONE) {
 
		if (st->owner == _local_company || st->owner == OWNER_NONE) {
 
			byte facil;
 
			(facil = FACIL_DOCK, v->type == VEH_SHIP) ||
 
			(facil = FACIL_TRAIN, v->type == VEH_TRAIN) ||
src/rail_gui.cpp
Show inline comments
 
@@ -833,7 +833,7 @@ void ShowBuildRailToolbar(RailType railt
 
{
 
	BuildRailToolbarWindow *w;
 

	
 
	if (!IsValidCompanyID(_current_company)) return;
 
	if (!IsValidCompanyID(_local_company)) return;
 
	if (!ValParamRailtype(railtype)) return;
 

	
 
	// don't recreate the window if we're clicking on a button and the window exists.
src/road_gui.cpp
Show inline comments
 
@@ -678,7 +678,7 @@ static const WindowDesc _build_tramway_d
 

	
 
void ShowBuildRoadToolbar(RoadType roadtype)
 
{
 
	if (!IsValidCompanyID(_current_company)) return;
 
	if (!IsValidCompanyID(_local_company)) return;
 
	_cur_roadtype = roadtype;
 

	
 
	DeleteWindowByClass(WC_BUILD_TOOLBAR);
src/station_gui.cpp
Show inline comments
 
@@ -952,16 +952,16 @@ struct StationViewWindow : public Window
 

	
 
			case SVW_PLANES: { // Show a list of scheduled aircraft to this station
 
				const Station *st = GetStation(this->window_number);
 
				/* Since oilrigs have no owners, show the scheduled aircraft of current company */
 
				Owner owner = (st->owner == OWNER_NONE) ? _current_company : st->owner;
 
				/* Since oilrigs have no owners, show the scheduled aircraft of local company */
 
				Owner owner = (st->owner == OWNER_NONE) ? _local_company : st->owner;
 
				ShowVehicleListWindow(owner, VEH_AIRCRAFT, (StationID)this->window_number);
 
				break;
 
			}
 

	
 
			case SVW_SHIPS: { // Show a list of scheduled ships to this station
 
				const Station *st = GetStation(this->window_number);
 
				/* Since oilrigs/bouys have no owners, show the scheduled ships of current company */
 
				Owner owner = (st->owner == OWNER_NONE) ? _current_company : st->owner;
 
				/* Since oilrigs/bouys have no owners, show the scheduled ships of local company */
 
				Owner owner = (st->owner == OWNER_NONE) ? _local_company : st->owner;
 
				ShowVehicleListWindow(owner, VEH_SHIP, (StationID)this->window_number);
 
				break;
 
			}
src/terraform_gui.cpp
Show inline comments
 
@@ -334,7 +334,7 @@ static const WindowDesc _terraform_desc 
 

	
 
void ShowTerraformToolbar(Window *link)
 
{
 
	if (!IsValidCompanyID(_current_company)) return;
 
	if (!IsValidCompanyID(_local_company)) return;
 

	
 
	Window *w = AllocateWindowDescFront<TerraformToolbarWindow>(&_terraform_desc, 0);
 
	if (link == NULL) return;
src/toolbar_gui.cpp
Show inline comments
 
@@ -529,7 +529,7 @@ static void MenuClickLeague(int index)
 
static void ToolbarIndustryClick(Window *w)
 
{
 
	/* Disable build-industry menu if we are a spectator */
 
	PopupMainToolbMenu(w, TBN_INDUSTRIES, STR_INDUSTRY_DIR, (_current_company == COMPANY_SPECTATOR) ? 1 : 2);
 
	PopupMainToolbMenu(w, TBN_INDUSTRIES, STR_INDUSTRY_DIR, (_local_company == COMPANY_SPECTATOR) ? 1 : 2);
 
}
 

	
 
static void MenuClickIndustry(int index)
 
@@ -1035,7 +1035,7 @@ struct MainToolbarWindow : Window {
 
		/* If spectator, disable all construction buttons
 
		* ie : Build road, rail, ships, airports and landscaping
 
		* Since enabled state is the default, just disable when needed */
 
		this->SetWidgetsDisabledState(_current_company == COMPANY_SPECTATOR, TBN_RAILS, TBN_ROADS, TBN_WATER, TBN_AIR, TBN_LANDSCAPE, WIDGET_LIST_END);
 
		this->SetWidgetsDisabledState(_local_company == COMPANY_SPECTATOR, TBN_RAILS, TBN_ROADS, TBN_WATER, TBN_AIR, TBN_LANDSCAPE, WIDGET_LIST_END);
 
		/* disable company list drop downs, if there are no companies */
 
		this->SetWidgetsDisabledState(ActiveCompanyCount() == TBN_PAUSE, TBN_STATIONS, TBN_FINANCES, TBN_TRAINS, TBN_ROADVEHS, TBN_SHIPS, TBN_AIRCRAFTS, WIDGET_LIST_END);
 

	
src/town_gui.cpp
Show inline comments
 
@@ -725,6 +725,6 @@ static const WindowDesc _scen_edit_town_
 

	
 
void ShowBuildTownWindow()
 
{
 
	if (_game_mode != GM_EDITOR && !IsValidCompanyID(_current_company)) return;
 
	if (_game_mode != GM_EDITOR && !IsValidCompanyID(_local_company)) return;
 
	AllocateWindowDescFront<ScenarioEditorTownGenerationWindow>(&_scen_edit_town_gen_desc, 0);
 
}
src/tree_gui.cpp
Show inline comments
 
@@ -180,6 +180,6 @@ static const WindowDesc _build_trees_des
 

	
 
void ShowBuildTreesToolbar()
 
{
 
	if (_game_mode != GM_EDITOR && !IsValidCompanyID(_current_company)) return;
 
	if (_game_mode != GM_EDITOR && !IsValidCompanyID(_local_company)) return;
 
	AllocateWindowDescFront<BuildTreesWindow>(&_build_trees_desc, 0);
 
}
src/vehicle.cpp
Show inline comments
 
@@ -1786,7 +1786,7 @@ bool CanBuildVehicleInfrastructure(Vehic
 
{
 
	assert(IsCompanyBuildableVehicleType(type));
 

	
 
	if (!IsValidCompanyID(_current_company)) return false;
 
	if (!IsValidCompanyID(_local_company)) return false;
 
	if (_settings_client.gui.always_build_infrastructure) return true;
 

	
 
	UnitID max;
0 comments (0 inline, 0 general)