summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-12-23 23:34:19 +0000
committertruebrain <truebrain@openttd.org>2011-12-23 23:34:19 +0000
commit7702151a62e739b07805c738901bce9fef660fb2 (patch)
treed344bc4e24454a72293ed42f0ca78f590ce074e8
parentd6e88a7cab45928aad1bd9d8f958854c571593a8 (diff)
downloadopenttd-7702151a62e739b07805c738901bce9fef660fb2.tar.xz
(svn r23665) -Fix (r23664): revert, and apply other fix, which allows switching companies safely in SinglePlayer
-rw-r--r--src/goal.cpp2
-rw-r--r--src/goal_gui.cpp7
2 files changed, 4 insertions, 5 deletions
diff --git a/src/goal.cpp b/src/goal.cpp
index b6eabcdfe..91ba6d288 100644
--- a/src/goal.cpp
+++ b/src/goal.cpp
@@ -80,8 +80,6 @@ CommandCost CmdCreateGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
default: return CMD_ERROR;
}
- if (company != INVALID_OWNER && company != _local_company) return CommandCost();
-
if (flags & DC_EXEC) {
Goal *g = new Goal();
g->type = type;
diff --git a/src/goal_gui.cpp b/src/goal_gui.cpp
index aeba8e576..26d5238df 100644
--- a/src/goal_gui.cpp
+++ b/src/goal_gui.cpp
@@ -20,6 +20,7 @@
#include "gui.h"
#include "goal_base.h"
#include "core/geometry_func.hpp"
+#include "company_func.h"
#include "widgets/goal_widget.h"
@@ -63,7 +64,7 @@ struct GoalListWindow : Window {
if (y < 0) return;
FOR_ALL_GOALS(s) {
- if (s->company != INVALID_COMPANY) {
+ if (s->company == _local_company) {
y--;
if (y == 0) {
this->HandleClick(s);
@@ -119,7 +120,7 @@ struct GoalListWindow : Window {
FOR_ALL_GOALS(s) {
if (s->company == INVALID_COMPANY) {
num_global++;
- } else {
+ } else if (s->company == _local_company) {
num_company++;
}
}
@@ -189,7 +190,7 @@ struct GoalListWindow : Window {
num = 0;
FOR_ALL_GOALS(s) {
- if (s->company != INVALID_COMPANY) {
+ if (s->company == _local_company) {
if (IsInsideMM(pos, 0, cap)) {
/* Display the goal */
SetDParamStr(0, s->text);