company_func.h File Reference

Functions related to companies. More...

#include "company_type.h"
#include "tile_type.h"
#include "gfx_type.h"

Go to the source code of this file.

Functions

bool MayCompanyTakeOver (CompanyID cbig, CompanyID small)
 May company cbig buy company csmall?
void ChangeOwnershipOfCompanyItems (Owner old_owner, Owner new_owner)
void GetNameOfOwner (Owner owner, TileIndex tile)
 Set the right DParams to get the name of an owner.
void SetLocalCompany (CompanyID new_company)
 Sets the local company and updates the settings that are set on a per-company basis to reflect the core's state in the GUI.
void ShowBuyCompanyDialog (CompanyID company)
void CompanyAdminUpdate (const Company *company)
 Called whenever company related information changes in order to notify admins.
void CompanyAdminBankrupt (CompanyID company_id)
 Called whenever a company goes bankrupt in order to notify admins.
void UpdateLandscapingLimits ()
 Update the landscaping limits per company.
static bool IsLocalCompany ()
 Is the current company the local company?
static bool IsInteractiveCompany (CompanyID company)
 Is the user representing company?

Variables

CompanyByte _local_company
 Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
CompanyByte _current_company
 Company currently doing an action.
Colours _company_colours [MAX_COMPANIES]
 NOSAVE: can be determined from company structs.
CompanyManagerFace _company_manager_face
 for company manager face storage in openttd.cfg

Detailed Description

Functions related to companies.

Definition in file company_func.h.


Function Documentation

void CompanyAdminBankrupt ( CompanyID  company_id  ) 

Called whenever a company goes bankrupt in order to notify admins.

Parameters:
company_id The company that went bankrupt.

Definition at line 779 of file company_cmd.cpp.

References _network_server, ADMIN_CRR_BANKRUPT, and NetworkAdminCompanyRemove().

Referenced by CmdCompanyCtrl(), and CompanyCheckBankrupt().

void CompanyAdminUpdate ( const Company company  ) 

Called whenever company related information changes in order to notify admins.

Parameters:
company The company data changed of.

Definition at line 768 of file company_cmd.cpp.

References _network_server, and NetworkAdminCompanyUpdate().

Referenced by CmdBuyShareInCompany(), CmdRenameCompany(), CmdRenamePresident(), CmdSellShareInCompany(), and CmdSetCompanyColour().

void GetNameOfOwner ( Owner  owner,
TileIndex  tile 
)

Set the right DParams to get the name of an owner.

Parameters:
owner the owner to get the name of.
tile optional tile to get the right town.
Precondition:
if tile == 0, then owner can't be OWNER_TOWN.

Definition at line 274 of file company_cmd.cpp.

References ClosestTownFromTile(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), OWNER_TOWN, and SetDParam().

Referenced by CheckOwnership(), and CheckTileOwnership().

static bool IsInteractiveCompany ( CompanyID  company  )  [inline, static]

Is the user representing company?

Parameters:
company Company where interaction is needed with.
Returns:
Gives true if the user can answer questions interactively as representative of company, else false

Definition at line 48 of file company_func.h.

Referenced by EnginesDailyLoop(), and HandleBankruptcyTakeover().

static bool IsLocalCompany (  )  [inline, static]

Is the current company the local company?

Returns:
true of the current company is the local company, false otherwise.

Definition at line 38 of file company_func.h.

Referenced by CheckTileOwnership(), CmdBuildVehicle(), CmdSellRailWagon(), CmdSetAutoReplace(), DoCommandP(), HandleKeypress(), HandleMouseEvents(), InputLoop(), NetworkExecuteLocalCommandQueue(), SetLocalCompany(), and StateGameLoop().

bool MayCompanyTakeOver ( CompanyID  cbig,
CompanyID  csmall 
)

May company cbig buy company csmall?

Parameters:
cbig Company buying csmall.
csmall Company getting bought.
Returns:
Return true if it is allowed.

Definition at line 614 of file company_cmd.cpp.

References _settings_game, CountCompanyVehicles(), VehicleSettings::max_aircraft, VehicleSettings::max_roadveh, VehicleSettings::max_ships, VehicleSettings::max_trains, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, VEH_TRAIN, and GameSettings::vehicle.

Referenced by CmdBuyCompany(), CmdBuyShareInCompany(), and HandleBankruptcyTakeover().

void SetLocalCompany ( CompanyID  new_company  ) 

Sets the local company and updates the settings that are set on a per-company basis to reflect the core's state in the GUI.

Parameters:
new_company the new company
Precondition:
Company::IsValidID(new_company) || new_company == COMPANY_SPECTATOR || new_company == OWNER_NONE

Definition at line 97 of file company_cmd.cpp.

References COMPANY_SPECTATOR, DeleteConstructionWindows(), DESTTYPE_TEAM, InvalidateWindowData(), IsLocalCompany(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), MarkWholeScreenDirty(), and OWNER_NONE.

Referenced by ClickChangeCompanyCheat(), CmdCompanyCtrl(), GenerateWorld(), NetworkServerDoMove(), and StartScenario().

void UpdateLandscapingLimits (  ) 

Generated on Thu Jan 20 22:57:45 2011 for OpenTTD by  doxygen 1.6.1