summaryrefslogtreecommitdiff
path: root/src/command_type.h
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-02-14 15:44:21 +0000
committeralberth <alberth@openttd.org>2010-02-14 15:44:21 +0000
commit7dcc41400010e20560fc0cf702d74b2f8f5bf4d4 (patch)
tree71c505a7dff710786f016ad1b0bc0808815f77cf /src/command_type.h
parent8641f08df3335d11513fa0363e752d79adfad50c (diff)
downloadopenttd-7dcc41400010e20560fc0cf702d74b2f8f5bf4d4.tar.xz
(svn r19130) -Codechange: Use references and inlining in CommandCost.
Diffstat (limited to 'src/command_type.h')
-rw-r--r--src/command_type.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/command_type.h b/src/command_type.h
index 100a96bc9..fb71eac27 100644
--- a/src/command_type.h
+++ b/src/command_type.h
@@ -48,25 +48,25 @@ public:
* @param ex_t the expense type
* @param cst the initial cost of this command
*/
- CommandCost(ExpensesType ex_t, Money cst) : expense_type(ex_t), cost(cst), message(INVALID_STRING_ID), success(true) {}
+ CommandCost(ExpensesType ex_t, const Money &cst) : expense_type(ex_t), cost(cst), message(INVALID_STRING_ID), success(true) {}
/**
* Adds the given cost to the cost of the command.
* @param cost the cost to add
*/
- void AddCost(Money cost)
+ FORCEINLINE void AddCost(const Money &cost)
{
this->cost += cost;
}
- void AddCost(CommandCost ret);
+ void AddCost(const CommandCost &cmd_cost);
/**
* Multiplies the cost of the command by the given factor.
* @param factor factor to multiply the costs with
*/
- void MultiplyCost(int factor)
+ FORCEINLINE void MultiplyCost(int factor)
{
this->cost *= factor;
}
@@ -75,7 +75,7 @@ public:
* The costs as made up to this moment
* @return the costs
*/
- Money GetCost() const
+ FORCEINLINE Money GetCost() const
{
return this->cost;
}
@@ -84,7 +84,7 @@ public:
* The expense type of the cost
* @return the expense type
*/
- ExpensesType GetExpensesType() const
+ FORCEINLINE ExpensesType GetExpensesType() const
{
return this->expense_type;
}
@@ -92,7 +92,7 @@ public:
/**
* Sets the global error message *if* this class has one.
*/
- void SetGlobalErrorMessage() const
+ FORCEINLINE void SetGlobalErrorMessage() const
{
extern StringID _error_message;
if (this->message != INVALID_STRING_ID) _error_message = this->message;
@@ -126,7 +126,7 @@ public:
* Did this command succeed?
* @return true if and only if it succeeded
*/
- bool Succeeded() const
+ FORCEINLINE bool Succeeded() const
{
return this->success;
}
@@ -135,7 +135,7 @@ public:
* Did this command fail?
* @return true if and only if it failed
*/
- bool Failed() const
+ FORCEINLINE bool Failed() const
{
return !this->success;
}