summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/command.cpp2
-rw-r--r--src/command_type.h18
2 files changed, 10 insertions, 10 deletions
diff --git a/src/command.cpp b/src/command.cpp
index 1e422a777..430f9d2eb 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -687,7 +687,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
* Also takes a possible error message when it is set.
* @param ret The command to add the cost of.
*/
-void CommandCost::AddCost(CommandCost ret)
+void CommandCost::AddCost(const CommandCost &ret)
{
this->AddCost(ret.cost);
if (this->success && !ret.success) {
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;
}