Mercurial > hg > openttd
diff src/command.cpp @ 8230:5b61305fcdd4 draft
(svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
author | rubidium <rubidium@openttd.org> |
---|---|
date | Wed, 09 Jan 2008 16:55:48 +0000 |
parents | 5d7588dd08d6 |
children | cca79a4335e0 |
line wrap: on
line diff
--- a/src/command.cpp +++ b/src/command.cpp @@ -441,7 +441,7 @@ } /* Execute the command here. All cost-relevant functions set the expenses type - * themselves with "SET_EXPENSES_TYPE(...);" at the beginning of the function */ + * themselves to the cost object at some point */ res = proc(tile, flags, p1, p2); if (CmdFailed(res)) { res.SetGlobalErrorMessage(); @@ -622,7 +622,6 @@ /* Actually try and execute the command. If no cost-type is given * use the construction one */ - _yearly_expenses_type = EXPENSES_CONSTRUCTION; res2 = proc(tile, flags | DC_EXEC, p1, p2); /* If notest is on, it means the result of the test can be different than @@ -697,6 +696,11 @@ return this->cost; } +ExpensesType CommandCost::GetExpensesType() const +{ + return this->expense_type; +} + void CommandCost::SetGlobalErrorMessage() const { extern StringID _error_message;