Changeset - r10890:d53fc8ed7a65
[Not reviewed]
master
0 3 0
rubidium - 15 years ago 2009-01-23 15:06:56
rubidium@openttd.org
(svn r15225) -Fix (r15126): searching for 'missing' NewGRFs gave the 'compatability loaded' NewGRF instead of the one that we're actually looking for
3 files changed with 30 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/gamelog.cpp
Show inline comments
 
@@ -666,3 +666,30 @@ void GamelogGRFUpdate(const GRFConfig *o
 
	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();
 
}
src/gamelog.h
Show inline comments
 
@@ -46,4 +46,6 @@ void GamelogTestGRF();
 

	
 
bool GamelogGRFBugReverse(uint32 grfid, uint16 internal_id);
 

	
 
void GamelogGetOriginalGRFMD5Checksum(uint32 grfid, byte *md5sum);
 

	
 
#endif /* GAMELOG_H */
src/newgrf_gui.cpp
Show inline comments
 
@@ -617,6 +617,7 @@ struct NewGRFWindow : public Window {
 
						ttd_strlcpy(ci->name, c->name != NULL ? c->name : c->filename, lengthof(ci->name));
 
						ci->unique_id = BSWAP32(c->grfid);
 
						memcpy(ci->md5sum, c->md5sum, sizeof(ci->md5sum));
 
						if (HasBit(c->flags, GCF_COMPATIBLE)) GamelogGetOriginalGRFMD5Checksum(c->grfid, ci->md5sum);
 
						*cv.Append() = ci;
 
					}
 
					ShowNetworkContentListWindow(cv.Length() == 0 ? NULL : &cv, CONTENT_TYPE_NEWGRF);
0 comments (0 inline, 0 general)