Changeset - r17482:4dbb8b190ff9
[Not reviewed]
master
0 10 0
frosch - 13 years ago 2011-03-13 21:34:21
frosch@openttd.org
(svn r22247) -Codechange: Update comments wrt. ForceRebuild() in command-scope.
10 files changed with 11 insertions and 31 deletions:
0 comments (0 inline, 0 general)
src/autoreplace_gui.cpp
Show inline comments
 
@@ -495,14 +495,14 @@ public:
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (data != 0) {
 
			/* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
 
			this->engines[0].ForceRebuild();
 
		} else {
 
			this->engines[1].ForceRebuild();
 
		}
 
	}
 
};
src/depot_gui.cpp
Show inline comments
 
@@ -639,13 +639,12 @@ struct DepotWindow : Window {
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->generate_list = true;
 
	}
 

	
 
	virtual void OnPaint()
 
	{
 
		if (this->generate_list) {
src/graph_gui.cpp
Show inline comments
 
@@ -1269,14 +1269,14 @@ public:
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (data == 0) {
 
			/* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
 
			this->companies.ForceRebuild();
 
		} else {
 
			this->companies.ForceResort();
 
		}
 
	}
 
};
src/group_gui.cpp
Show inline comments
 
@@ -257,24 +257,22 @@ public:
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* We can only set the trigger for resorting/rebuilding.
 
		 * We cannot safely resort at this point, as there might be multiple scheduled invalidations,
 
		 * and a rebuild needs to be done first though it is scheduled later. */
 
		if (data == 0) {
 
			/* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
 
			this->vehicles.ForceRebuild();
 
			this->groups.ForceRebuild();
 
		} else {
 
			this->vehicles.ForceResort();
 
			this->groups.ForceResort();
 
		}
 

	
 
		/* Process ID-invalidation in command-scope as well */
 
		if (this->group_rename != INVALID_GROUP && !Group::IsValidID(this->group_rename)) {
 
			DeleteWindowByClass(WC_QUERY_STRING);
 
			this->group_rename = INVALID_GROUP;
 
		}
 

	
 
		if (!(IsAllGroupID(this->vli.index) || IsDefaultGroupID(this->vli.index) || Group::IsValidID(this->vli.index))) {
src/industry_gui.cpp
Show inline comments
 
@@ -1362,17 +1362,14 @@ public:
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* We can only set the trigger for resorting/rebuilding.
 
		 * We cannot safely resort at this point, as there might be multiple scheduled invalidations,
 
		 * and a rebuild needs to be done first though it is scheduled later. */
 
		if (data == 0) {
 
			/* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
 
			this->industries.ForceRebuild();
 
		} else {
 
			this->industries.ForceResort();
 
		}
 
	}
 
};
src/network/network_gui.cpp
Show inline comments
 
@@ -798,13 +798,12 @@ public:
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (data == 1) {
 
			this->server = NULL;
 
			this->list_pos = SLP_INVALID;
 
		}
 
		this->servers.ForceRebuild();
 
		this->SetDirty();
src/signs_gui.cpp
Show inline comments
 
@@ -371,21 +371,17 @@ struct SignListWindow : QueryStringBaseW
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* When there is a filter string, we always need to rebuild the list even if
 
		 * the amount of signs in total is unchanged, as the subset of signs that is
 
		 * accepted by the filter might has changed.
 
		 *
 
		 * We can only set the trigger for resorting/rebuilding.
 
		 * We cannot safely resort at this point, as there might be multiple scheduled invalidations,
 
		 * and a rebuild needs to be done first though it is scheduled later. */
 
		 * accepted by the filter might has changed. */
 
		if (data == 0 || !StrEmpty(this->filter_string)) { // New or deleted sign, or there is a filter string
 
			/* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
 
			this->signs.ForceRebuild();
 
		} else { // Change of sign contents while there is no filter string
 
			this->signs.ForceResort();
 
		}
 
	}
 

	
src/station_gui.cpp
Show inline comments
 
@@ -691,17 +691,14 @@ public:
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* We can only set the trigger for resorting/rebuilding.
 
		 * We cannot safely resort at this point, as there might be multiple scheduled invalidations,
 
		 * and a rebuild needs to be done first though it is scheduled later. */
 
		if (data == 0) {
 
			/* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
 
			this->stations.ForceRebuild();
 
		} else {
 
			this->stations.ForceResort();
 
		}
 
	}
 
};
src/town_gui.cpp
Show inline comments
 
@@ -873,17 +873,14 @@ public:
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* We can only set the trigger for resorting/rebuilding.
 
		 * We cannot safely resort at this point, as there might be multiple scheduled invalidations,
 
		 * and a rebuild needs to be done first though it is scheduled later. */
 
		if (data == 0) {
 
			/* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
 
			this->towns.ForceRebuild();
 
		} else {
 
			this->towns.ForceResort();
 
		}
 
	}
 
};
src/vehicle_gui.cpp
Show inline comments
 
@@ -1613,18 +1613,15 @@ public:
 
			/* Needs to be done in command-scope, so everything stays valid */
 
			this->vli.index = GB(data, 0, 20);
 
			this->window_number = this->vli.Pack();
 
			this->vehicles.ForceRebuild();
 
			return;
 
		}
 
		if (!gui_scope) return;
 

	
 
		/* We can only set the trigger for resorting/rebuilding.
 
		 * We cannot safely resort at this point, as there might be multiple scheduled invalidations,
 
		 * and a rebuild needs to be done first though it is scheduled later. */
 

	
 
		if (data == 0) {
 
			/* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
 
			this->vehicles.ForceRebuild();
 
		} else {
 
			this->vehicles.ForceResort();
 
		}
 
	}
 
};
0 comments (0 inline, 0 general)