summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-03-13 21:34:21 +0000
committerfrosch <frosch@openttd.org>2011-03-13 21:34:21 +0000
commit652c9cb6635cc5f72a32077fdcd4e0f4bcc859e0 (patch)
tree3b78a1acc0ee0efe1e64ada470e815b44dc63442
parent5689b3dbda6b3e4adee2c20e32d06a9e5a158c07 (diff)
downloadopenttd-652c9cb6635cc5f72a32077fdcd4e0f4bcc859e0.tar.xz
(svn r22247) -Codechange: Update comments wrt. ForceRebuild() in command-scope.
-rw-r--r--src/autoreplace_gui.cpp2
-rw-r--r--src/depot_gui.cpp1
-rw-r--r--src/graph_gui.cpp2
-rw-r--r--src/group_gui.cpp6
-rw-r--r--src/industry_gui.cpp5
-rw-r--r--src/network/network_gui.cpp1
-rw-r--r--src/signs_gui.cpp8
-rw-r--r--src/station_gui.cpp5
-rw-r--r--src/town_gui.cpp5
-rw-r--r--src/vehicle_gui.cpp5
10 files changed, 10 insertions, 30 deletions
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 000df7963..86a84fec7 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -498,8 +498,8 @@ public:
*/
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();
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index 095d67b57..6779b9b83 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -642,7 +642,6 @@ struct DepotWindow : Window {
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
- if (!gui_scope) return;
this->generate_list = true;
}
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index 6354366b0..3c1047b43 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -1272,8 +1272,8 @@ public:
*/
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();
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index 906b099ec..6cbd89920 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -260,11 +260,8 @@ public:
*/
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 {
@@ -272,6 +269,7 @@ public:
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;
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index bc72f1965..ab1cfe28f 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -1365,11 +1365,8 @@ public:
*/
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();
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 5cb031d01..0eb99ce7f 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -801,7 +801,6 @@ public:
*/
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;
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index d639e1dcc..40039c3cf 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -374,15 +374,11 @@ struct SignListWindow : QueryStringBaseWindow, SignList {
*/
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();
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index cb40cb37d..e55c03226 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -694,11 +694,8 @@ public:
*/
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();
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 016399e70..c2a8909a6 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -876,11 +876,8 @@ public:
*/
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();
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 2974c351f..324a4d979 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1616,12 +1616,9 @@ public:
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();