|
@@ -2014,13 +2014,13 @@ extern int GetAmountOwnedBy(const Compan
|
|
|
* @param flags type of operation
|
|
|
* @param p1 company to buy the shares from
|
|
|
* @param p2 unused
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdBuyShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
CommandCost CmdBuyShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
|
|
{
|
|
|
CommandCost cost(EXPENSES_OTHER);
|
|
|
CompanyID target_company = (CompanyID)p1;
|
|
|
Company *c = Company::GetIfValid(target_company);
|
|
|
|
|
|
/* Check if buying shares is allowed (protection against modified clients)
|
|
@@ -2066,13 +2066,13 @@ CommandCost CmdBuyShareInCompany(TileInd
|
|
|
* @param flags type of operation
|
|
|
* @param p1 company to sell the shares from
|
|
|
* @param p2 unused
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdSellShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
CommandCost CmdSellShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
|
|
{
|
|
|
CompanyID target_company = (CompanyID)p1;
|
|
|
Company *c = Company::GetIfValid(target_company);
|
|
|
|
|
|
/* Cannot sell own shares */
|
|
|
if (c == nullptr || _current_company == target_company) return CMD_ERROR;
|
|
@@ -2107,13 +2107,13 @@ CommandCost CmdSellShareInCompany(TileIn
|
|
|
* @param flags type of operation
|
|
|
* @param p1 company to buy up
|
|
|
* @param p2 unused
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdBuyCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
CommandCost CmdBuyCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
|
|
{
|
|
|
CompanyID target_company = (CompanyID)p1;
|
|
|
Company *c = Company::GetIfValid(target_company);
|
|
|
if (c == nullptr) return CMD_ERROR;
|
|
|
|
|
|
/* Disable takeovers when not asked */
|