changeset 18817:bff544da26a2 draft

(svn r23665) -Fix (r23664): revert, and apply other fix, which allows switching companies safely in SinglePlayer
author truebrain <truebrain@openttd.org>
date Fri, 23 Dec 2011 23:34:19 +0000
parents 64f2407c01a7
children b63f851861ef
files src/goal.cpp src/goal_gui.cpp
diffstat 2 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/goal.cpp
+++ b/src/goal.cpp
@@ -80,8 +80,6 @@
 		default: return CMD_ERROR;
 	}
 
-	if (company != INVALID_OWNER && company != _local_company) return CommandCost();
-
 	if (flags & DC_EXEC) {
 		Goal *g = new Goal();
 		g->type = type;
--- 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 @@
 		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 @@
 		FOR_ALL_GOALS(s) {
 			if (s->company == INVALID_COMPANY) {
 				num_global++;
-			} else {
+			} else if (s->company == _local_company) {
 				num_company++;
 			}
 		}
@@ -189,7 +190,7 @@
 		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);