summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-08-21 12:06:24 +0000
committerfrosch <frosch@openttd.org>2011-08-21 12:06:24 +0000
commit7bd7324b305e1ce1ac39be1cf5e937d946ef353f (patch)
treefdb182d686ce99979c2d1fb676b3994e4418af28
parent6963ce6665fa01d604692c8dd654d9bef275ea7a (diff)
downloadopenttd-7bd7324b305e1ce1ac39be1cf5e937d946ef353f.tar.xz
(svn r22782) -Fix: Add GrfProcessingState::ClearDataForNextFile() to clear temporary data at a specific spot, esp. clear 'data_blocks' now.
-rw-r--r--src/newgrf.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 3b542290a..17edf3113 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -94,6 +94,14 @@ struct GrfProcessingState {
int skip_sprites; ///< Number of psuedo sprites to skip before processing the next one. (-1 to skip to end of file)
byte data_blocks; ///< Number of binary include sprites to read before processing the next pseudo sprite.
GrfDataType data_type; ///< Type of the binary include sprites to read.
+
+ /** Clear temporary data before processing the next file in the current loading stage */
+ void ClearDataForNextFile()
+ {
+ nfo_line = 0;
+ skip_sprites = 0;
+ data_blocks = 0;
+ }
};
static GrfProcessingState _cur;
@@ -8116,8 +8124,7 @@ void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage)
return;
}
- _cur.skip_sprites = 0; // XXX
- _cur.nfo_line = 0;
+ _cur.ClearDataForNextFile();
ReusableBuffer<byte> buf;