Changeset - r14993:43e9f15bd64b
[Not reviewed]
master
0 2 0
terkhen - 14 years ago 2010-04-12 17:58:09
terkhen@openttd.org
(svn r19615) -Fix [FS#3763]: Company related graphs weren't updated correctly after changing the company colour.
2 files changed with 8 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/company_cmd.cpp
Show inline comments
 
@@ -960,24 +960,31 @@ CommandCost CmdSetCompanyColour(TileInde
 
						c->livery[LS_DEFAULT].in_use = true;
 
						break;
 
					}
 
				}
 
				break;
 

	
 
			default:
 
				break;
 
		}
 
		ResetVehicleColourMap();
 
		MarkWholeScreenDirty();
 

	
 
		/* All graph related to companies use the company colour. */
 
		InvalidateWindowData(WC_INCOME_GRAPH, 0);
 
		InvalidateWindowData(WC_OPERATING_PROFIT, 0);
 
		InvalidateWindowData(WC_DELIVERED_CARGO, 0);
 
		InvalidateWindowData(WC_PERFORMANCE_HISTORY, 0);
 
		InvalidateWindowData(WC_COMPANY_VALUE, 0);
 

	
 
		/* Company colour data is indirectly cached. */
 
		Vehicle *v;
 
		FOR_ALL_VEHICLES(v) {
 
			if (v->owner == _current_company) v->InvalidateNewGRFCache();
 
		}
 
	}
 
	return CommandCost();
 
}
 

	
 
static bool IsUniqueCompanyName(const char *name)
 
{
 
	const Company *c;
src/graph_gui.cpp
Show inline comments
 
@@ -519,25 +519,25 @@ public:
 
	{
 
		/* Clicked on legend? */
 
		if (widget == BGW_KEY_BUTTON) ShowGraphLegend();
 
	}
 

	
 
	virtual void OnTick()
 
	{
 
		this->UpdateStatistics(false);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	{
 
		this->OnTick();
 
		this->UpdateStatistics(true);
 
	}
 

	
 
	/**
 
	 * Update the statistics.
 
	 * @param initialize Initialize the data structure.
 
	 */
 
	void UpdateStatistics(bool initialize)
 
	{
 
		uint excluded_companies = _legend_excluded_companies;
 

	
 
		/* Exclude the companies which aren't valid */
 
		for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
0 comments (0 inline, 0 general)