diff options
author | rubidium <rubidium@openttd.org> | 2009-01-23 15:06:56 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-01-23 15:06:56 +0000 |
commit | aaad553233d95d68134d2eba573dc144d14d7f00 (patch) | |
tree | 672c125cc095db3db691e298d451435923f66498 /src/gamelog.cpp | |
parent | a88883c1c1b962b33ea4916ce0b1a7fc8967d7e3 (diff) | |
download | openttd-aaad553233d95d68134d2eba573dc144d14d7f00.tar.xz |
(svn r15225) -Fix (r15126): searching for 'missing' NewGRFs gave the 'compatability loaded' NewGRF instead of the one that we're actually looking for
Diffstat (limited to 'src/gamelog.cpp')
-rw-r--r-- | src/gamelog.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gamelog.cpp b/src/gamelog.cpp index 145351ba9..81c4e59fa 100644 --- a/src/gamelog.cpp +++ b/src/gamelog.cpp @@ -666,3 +666,30 @@ void GamelogGRFUpdate(const GRFConfig *oldc, const GRFConfig *newc) free(ol); free(nl); } + +/** + * Get the MD5 checksum of the original NewGRF that was loaded. + * @param grfid the GRF ID to search for + * @param md5sum the MD5 checksum to write to. + */ +void GamelogGetOriginalGRFMD5Checksum(uint32 grfid, byte *md5sum) +{ + const LoggedAction *la = &_gamelog_action[_gamelog_actions - 1]; + /* There should always be a "start game" action */ + assert(_gamelog_actions > 0); + + do { + const LoggedChange *lc = &la->change[la->changes - 1]; + /* There should always be at least one change per action */ + assert(la->changes > 0); + + do { + if (lc->ct == GLCT_GRFADD && lc->grfadd.grfid == grfid) { + memcpy(md5sum, lc->grfadd.md5sum, sizeof(lc->grfadd.md5sum)); + return; + } + } while (lc-- != la->change); + } while (la-- != _gamelog_action); + + NOT_REACHED(); +} |