Changeset - r21293:73e1e2f0d8f4
[Not reviewed]
master
0 1 0
frosch - 10 years ago 2014-02-27 21:53:14
frosch@openttd.org
(svn r26382) -Fix [FS#5932] (r25372): All goal commands invalidated the goal list of company 0.
1 file changed with 26 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/goal.cpp
Show inline comments
 
@@ -92,7 +92,11 @@ CommandCost CmdCreateGoal(TileIndex tile
 
		g->progress = NULL;
 
		g->completed = false;
 

	
 
		InvalidateWindowData(WC_GOALS_LIST, 0);
 
		if (g->company == INVALID_COMPANY) {
 
			InvalidateWindowClassesData(WC_GOALS_LIST);
 
		} else {
 
			InvalidateWindowData(WC_GOALS_LIST, g->company);
 
		}
 
		if (Goal::GetNumItems() == 1) InvalidateWindowData(WC_MAIN_TOOLBAR, 0);
 

	
 
		_new_goal_id = g->index;
 
@@ -117,9 +121,14 @@ CommandCost CmdRemoveGoal(TileIndex tile
 

	
 
	if (flags & DC_EXEC) {
 
		Goal *g = Goal::Get(p1);
 
		CompanyID c = g->company;
 
		delete g;
 

	
 
		InvalidateWindowData(WC_GOALS_LIST, 0);
 
		if (c == INVALID_COMPANY) {
 
			InvalidateWindowClassesData(WC_GOALS_LIST);
 
		} else {
 
			InvalidateWindowData(WC_GOALS_LIST, c);
 
		}
 
		if (Goal::GetNumItems() == 0) InvalidateWindowData(WC_MAIN_TOOLBAR, 0);
 
	}
 

	
 
@@ -146,7 +155,11 @@ CommandCost CmdSetGoalText(TileIndex til
 
		free(g->text);
 
		g->text = strdup(text);
 

	
 
		InvalidateWindowData(WC_GOALS_LIST, 0);
 
		if (g->company == INVALID_COMPANY) {
 
			InvalidateWindowClassesData(WC_GOALS_LIST);
 
		} else {
 
			InvalidateWindowData(WC_GOALS_LIST, g->company);
 
		}
 
	}
 

	
 
	return CommandCost();
 
@@ -175,7 +188,11 @@ CommandCost CmdSetGoalProgress(TileIndex
 
			g->progress = strdup(text);
 
		}
 

	
 
		InvalidateWindowData(WC_GOALS_LIST, 0);
 
		if (g->company == INVALID_COMPANY) {
 
			InvalidateWindowClassesData(WC_GOALS_LIST);
 
		} else {
 
			InvalidateWindowData(WC_GOALS_LIST, g->company);
 
		}
 
	}
 

	
 
	return CommandCost();
 
@@ -199,7 +216,11 @@ CommandCost CmdSetGoalCompleted(TileInde
 
		Goal *g = Goal::Get(p1);
 
		g->completed = p2 == 1;
 

	
 
		InvalidateWindowData(WC_GOALS_LIST, 0);
 
		if (g->company == INVALID_COMPANY) {
 
			InvalidateWindowClassesData(WC_GOALS_LIST);
 
		} else {
 
			InvalidateWindowData(WC_GOALS_LIST, g->company);
 
		}
 
	}
 

	
 
	return CommandCost();
0 comments (0 inline, 0 general)