Changeset - r10781:758b3ae29fdd
[Not reviewed]
master
0 3 0
peter1138 - 15 years ago 2009-01-16 19:53:52
peter1138@openttd.org
(svn r15114) -Codechange: Add support for 8 byte action7/9 data, used as a mask for GRFID checks.
3 files changed with 5 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/newgrf.cpp
Show inline comments
 
@@ -3960,12 +3960,13 @@ static void SkipIf(byte *buf, size_t len
 
	if (condtype < 2) {
 
		/* Always 1 for bit tests, the given value should be ignored. */
 
		paramsize = 1;
 
	}
 

	
 
	switch (paramsize) {
 
		case 8: cond_val = grf_load_dword(&buf); mask = grf_load_dword(&buf); break;
 
		case 4: cond_val = grf_load_dword(&buf); mask = 0xFFFFFFFF; break;
 
		case 2: cond_val = grf_load_word(&buf);  mask = 0x0000FFFF; break;
 
		case 1: cond_val = grf_load_byte(&buf);  mask = 0x000000FF; break;
 
		default: break;
 
	}
 

	
 
@@ -3985,13 +3986,13 @@ static void SkipIf(byte *buf, size_t len
 
	 * either of those, the specific variable 0x88 code is skipped, so
 
	 * the "general" code for the cargo availability conditions kicks in.
 
	 */
 
	if (param == 0x88 && condtype != 0x0B && condtype != 0x0C) {
 
		/* GRF ID checks */
 

	
 
		GRFConfig *c = GetGRFConfig(cond_val);
 
		GRFConfig *c = GetGRFConfig(cond_val, mask);
 

	
 
		if (c != NULL && HasBit(c->flags, GCF_STATIC) && !HasBit(_cur_grfconfig->flags, GCF_STATIC) && c->status != GCS_DISABLED && _networking) {
 
			DisableStaticNewGRFInfluencingNonStaticNewGRFs(c);
 
			c = NULL;
 
		}
 

	
src/newgrf_config.cpp
Show inline comments
 
@@ -453,18 +453,18 @@ char *FindUnknownGRFName(uint32 grfid, u
 
}
 

	
 
#endif /* ENABLE_NETWORK */
 

	
 

	
 
/* Retrieve a NewGRF from the current config by its grfid */
 
GRFConfig *GetGRFConfig(uint32 grfid)
 
GRFConfig *GetGRFConfig(uint32 grfid, uint32 mask)
 
{
 
	GRFConfig *c;
 

	
 
	for (c = _grfconfig; c != NULL; c = c->next) {
 
		if (c->grfid == grfid) return c;
 
		if ((c->grfid & mask) == (grfid & mask)) return c;
 
	}
 

	
 
	return NULL;
 
}
 

	
 

	
src/newgrf_config.h
Show inline comments
 
@@ -79,13 +79,13 @@ extern GRFConfig *_all_grfs;          //
 
extern GRFConfig *_grfconfig;         ///< First item in list of current GRF set up
 
extern GRFConfig *_grfconfig_newgame; ///< First item in list of default GRF set up
 
extern GRFConfig *_grfconfig_static;  ///< First item in list of static GRF set up
 

	
 
void ScanNewGRFFiles();
 
const GRFConfig *FindGRFConfig(uint32 grfid, const uint8 *md5sum = NULL);
 
GRFConfig *GetGRFConfig(uint32 grfid);
 
GRFConfig *GetGRFConfig(uint32 grfid, uint32 mask = 0xFFFFFFFF);
 
GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src, bool init_only);
 
void AppendStaticGRFConfigs(GRFConfig **dst);
 
void AppendToGRFConfigList(GRFConfig **dst, GRFConfig *el);
 
void ClearGRFConfig(GRFConfig **config);
 
void ClearGRFConfigList(GRFConfig **config);
 
void ResetGRFConfig(bool defaults);
0 comments (0 inline, 0 general)