Fix: [Script] Use Money instead of int32 for presenting the value of a company to AIs
This commit is contained in:
@@ -703,7 +703,7 @@ static void HandleBankruptcyTakeover(Company *c)
|
|||||||
|
|
||||||
c->bankrupt_timeout = TAKE_OVER_TIMEOUT;
|
c->bankrupt_timeout = TAKE_OVER_TIMEOUT;
|
||||||
if (best->is_ai) {
|
if (best->is_ai) {
|
||||||
AI::NewEvent(best->index, new ScriptEventCompanyAskMerger(c->index, ClampToI32(c->bankrupt_value)));
|
AI::NewEvent(best->index, new ScriptEventCompanyAskMerger(c->index, c->bankrupt_value));
|
||||||
} else if (IsInteractiveCompany(best->index)) {
|
} else if (IsInteractiveCompany(best->index)) {
|
||||||
ShowBuyCompanyDialog(c->index);
|
ShowBuyCompanyDialog(c->index);
|
||||||
}
|
}
|
||||||
|
@@ -381,7 +381,7 @@ public:
|
|||||||
* @param owner The company that can be bought.
|
* @param owner The company that can be bought.
|
||||||
* @param value The value/costs of buying the company.
|
* @param value The value/costs of buying the company.
|
||||||
*/
|
*/
|
||||||
ScriptEventCompanyAskMerger(Owner owner, int32 value) :
|
ScriptEventCompanyAskMerger(Owner owner, Money value) :
|
||||||
ScriptEvent(ET_COMPANY_ASK_MERGER),
|
ScriptEvent(ET_COMPANY_ASK_MERGER),
|
||||||
owner((ScriptCompany::CompanyID)owner),
|
owner((ScriptCompany::CompanyID)owner),
|
||||||
value(value)
|
value(value)
|
||||||
@@ -406,7 +406,7 @@ public:
|
|||||||
* Get the value of the new company.
|
* Get the value of the new company.
|
||||||
* @return The value of the new company.
|
* @return The value of the new company.
|
||||||
*/
|
*/
|
||||||
int32 GetValue() { return this->value; }
|
Money GetValue() { return this->value; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take over the company for this merger.
|
* Take over the company for this merger.
|
||||||
@@ -416,7 +416,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
ScriptCompany::CompanyID owner; ///< The company that is in trouble.
|
ScriptCompany::CompanyID owner; ///< The company that is in trouble.
|
||||||
int32 value; ///< The value of the company, i.e. the amount you would pay.
|
Money value; ///< The value of the company, i.e. the amount you would pay.
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user