(svn r22247) -Codechange: Update comments wrt. ForceRebuild() in command-scope.

This commit is contained in:
frosch 2011-03-13 21:34:21 +00:00
parent 5689b3dbda
commit 652c9cb663
10 changed files with 10 additions and 30 deletions

View File

@ -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();

View File

@ -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;
}

View File

@ -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();

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();