summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-02-04 16:45:07 +0000
committerrubidium <rubidium@openttd.org>2009-02-04 16:45:07 +0000
commita49197f522ea4377c731c69ac6e4117c49170682 (patch)
tree4a5fe41066de010bd441a15fc54033301d5a6f07 /src
parentce1fcfd8c03f0f4e46915abfc96d635d856421cc (diff)
downloadopenttd-a49197f522ea4377c731c69ac6e4117c49170682.tar.xz
(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.
Diffstat (limited to 'src')
-rw-r--r--src/airport_gui.cpp2
-rw-r--r--src/cheat_gui.cpp2
-rw-r--r--src/dock_gui.cpp2
-rw-r--r--src/industry_gui.cpp2
-rw-r--r--src/main_gui.cpp2
-rw-r--r--src/order_gui.cpp2
-rw-r--r--src/rail_gui.cpp2
-rw-r--r--src/road_gui.cpp2
-rw-r--r--src/station_gui.cpp8
-rw-r--r--src/terraform_gui.cpp2
-rw-r--r--src/toolbar_gui.cpp4
-rw-r--r--src/town_gui.cpp2
-rw-r--r--src/tree_gui.cpp2
-rw-r--r--src/vehicle.cpp2
14 files changed, 18 insertions, 18 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index ff6a70627..25d920e4e 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -147,7 +147,7 @@ static const WindowDesc _air_toolbar_desc = {
void ShowBuildAirToolbar()
{
- if (!IsValidCompanyID(_current_company)) return;
+ if (!IsValidCompanyID(_local_company)) return;
DeleteWindowByClass(WC_BUILD_TOOLBAR);
AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp
index bfb9a2b6f..ac0324682 100644
--- a/src/cheat_gui.cpp
+++ b/src/cheat_gui.cpp
@@ -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 */
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 433d4c34a..caecae95a 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -282,7 +282,7 @@ static const WindowDesc _build_docks_toolbar_desc = {
void ShowBuildDocksToolbar()
{
- if (!IsValidCompanyID(_current_company)) return;
+ if (!IsValidCompanyID(_local_company)) return;
DeleteWindowByClass(WC_BUILD_TOOLBAR);
AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_toolbar_desc, TRANSPORT_WATER);
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index d63002674..a2943a309 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -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();
}
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index e4e6913f2..e333bf7f8 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -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
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index b20d1c556..a7a8dc5ce 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -350,7 +350,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
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) ||
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 86cc5f298..309af58fc 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -833,7 +833,7 @@ void ShowBuildRailToolbar(RailType railtype, int button)
{
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.
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index ad9357d99..b36c4a9b7 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -678,7 +678,7 @@ static const WindowDesc _build_tramway_desc = {
void ShowBuildRoadToolbar(RoadType roadtype)
{
- if (!IsValidCompanyID(_current_company)) return;
+ if (!IsValidCompanyID(_local_company)) return;
_cur_roadtype = roadtype;
DeleteWindowByClass(WC_BUILD_TOOLBAR);
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 62d3d642d..94b7afc01 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -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;
}
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp
index f60d92cf7..82d2f5c42 100644
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -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;
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index 29d5c62e6..ab70c9f6d 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -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);
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 20f68492f..d887dcc7b 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -725,6 +725,6 @@ static const WindowDesc _scen_edit_town_gen_desc = {
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);
}
diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp
index 990f784da..045de6c36 100644
--- a/src/tree_gui.cpp
+++ b/src/tree_gui.cpp
@@ -180,6 +180,6 @@ static const WindowDesc _build_trees_desc = {
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);
}
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 2e5f87eea..c53c13049 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1786,7 +1786,7 @@ bool CanBuildVehicleInfrastructure(VehicleType type)
{
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;