Changeset - r14890:f3cb6e331a95
[Not reviewed]
master
0 5 0
frosch - 14 years ago 2010-03-21 11:05:39
frosch@openttd.org
(svn r19497) -Fix: [NewGRF] Bytes and words get sign-extended for temporary/persistent storage. (Spotted by yexo)
5 files changed with 9 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/industry.h
Show inline comments
 
@@ -26,7 +26,7 @@ extern IndustryPool _industry_pool;
 
 * Defines the internal data of a functionnal industry
 
 */
 
struct Industry : IndustryPool::PoolItem<&_industry_pool> {
 
	typedef PersistentStorageArray<uint32, 16> PersistentStorage;
 
	typedef PersistentStorageArray<int32, 16> PersistentStorage;
 

	
 
	TileArea location;                  ///< Location of the industry
 
	const Town *town;                   ///< Nearest town
src/newgrf_spritegroup.cpp
Show inline comments
 
@@ -42,7 +42,7 @@ TileLayoutSpriteGroup::~TileLayoutSprite
 
	free(this->dts);
 
}
 

	
 
TemporaryStorageArray<uint32, 0x110> _temp_store;
 
TemporaryStorageArray<int32, 0x110> _temp_store;
 

	
 

	
 
static inline uint32 GetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available)
 
@@ -118,9 +118,9 @@ static U EvalAdjustT(const Deterministic
 
		case DSGA_OP_AND:  return last_value & value;
 
		case DSGA_OP_OR:   return last_value | value;
 
		case DSGA_OP_XOR:  return last_value ^ value;
 
		case DSGA_OP_STO:  _temp_store.Store(value, last_value); return last_value;
 
		case DSGA_OP_STO:  _temp_store.Store((U)value, (S)last_value); return last_value;
 
		case DSGA_OP_RST:  return value;
 
		case DSGA_OP_STOP: if (object->psa != NULL) object->psa->Store(value, last_value); return last_value;
 
		case DSGA_OP_STOP: if (object->psa != NULL) object->psa->Store((U)value, (S)last_value); return last_value;
 
		case DSGA_OP_ROR:  return RotateRight(last_value, value);
 
		case DSGA_OP_SCMP: return ((S)last_value == (S)value) ? 1 : ((S)last_value < (S)value ? 0 : 2);
 
		case DSGA_OP_UCMP: return ((U)last_value == (U)value) ? 1 : ((U)last_value < (U)value ? 0 : 2);
src/newgrf_spritegroup.h
Show inline comments
 
@@ -31,7 +31,7 @@
 
 */
 
static inline uint32 GetRegister(uint i)
 
{
 
	extern TemporaryStorageArray<uint32, 0x110> _temp_store;
 
	extern TemporaryStorageArray<int32, 0x110> _temp_store;
 
	return _temp_store.Get(i);
 
}
 

	
src/newgrf_storage.h
Show inline comments
 
@@ -37,7 +37,7 @@ struct BaseStorageArray
 
	 * @param pos   the position to write at
 
	 * @param value the value to write
 
	 */
 
	virtual void Store(uint pos, uint32 value) = 0;
 
	virtual void Store(uint pos, int32 value) = 0;
 
};
 

	
 
/**
 
@@ -70,7 +70,7 @@ struct PersistentStorageArray : BaseStor
 
	 * @param pos   the position to write at
 
	 * @param value the value to write
 
	 */
 
	void Store(uint pos, uint32 value)
 
	void Store(uint pos, int32 value)
 
	{
 
		/* Out of the scope of the array */
 
		if (pos >= SIZE) return;
 
@@ -138,7 +138,7 @@ struct TemporaryStorageArray : BaseStora
 
	 * @param pos   the position to write at
 
	 * @param value the value to write
 
	 */
 
	void Store(uint pos, uint32 value)
 
	void Store(uint pos, int32 value)
 
	{
 
		/* Out of the scope of the array */
 
		if (pos >= SIZE) return;
src/newgrf_text.cpp
Show inline comments
 
@@ -597,7 +597,7 @@ static TextRefStack *_newgrf_textrefstac
 
 */
 
void PrepareTextRefStackUsage(byte numEntries)
 
{
 
	extern TemporaryStorageArray<uint32, 0x110> _temp_store;
 
	extern TemporaryStorageArray<int32, 0x110> _temp_store;
 

	
 
	_newgrf_textrefstack->ResetStack();
 

	
0 comments (0 inline, 0 general)