(svn r9707) -Codechange: Add some support for NewGRF var 7D, temporary storage array.
authorpeter1138
Sat, 21 Apr 2007 07:27:16 +0000
changeset 7017 59a26efc3832
parent 7016 c5c554ec339b
child 7018 cf6ba638333e
(svn r9707) -Codechange: Add some support for NewGRF var 7D, temporary storage array.
src/newgrf_spritegroup.cpp
src/newgrf_spritegroup.h
--- a/src/newgrf_spritegroup.cpp	Sat Apr 21 07:17:14 2007 +0000
+++ b/src/newgrf_spritegroup.cpp	Sat Apr 21 07:27:16 2007 +0000
@@ -76,6 +76,8 @@
 	_spritegroup_count = 0;
 }
 
+static uint32 _temp_store[0x110];
+
 
 static inline uint32 GetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available)
 {
@@ -96,6 +98,8 @@
 		case 0x1C: return object->last_value;
 		case 0x20: return _opt.landscape == LT_ARCTIC ? GetSnowLine() : 0xFF;
 
+		case 0x7D: return _temp_store[parameter];
+
 		/* Not a common variable, so evalute the feature specific variables */
 		default: return object->GetVariable(object, variable, parameter, available);
 	}
@@ -133,6 +137,10 @@
 		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:
+			if (value < lengthof(_temp_store)) _temp_store[value] = last_value;
+			return last_value;
+		case DSGA_OP_RST:  return value;
 		default:           return value;
 	}
 }
--- a/src/newgrf_spritegroup.h	Sat Apr 21 07:17:14 2007 +0000
+++ b/src/newgrf_spritegroup.h	Sat Apr 21 07:27:16 2007 +0000
@@ -60,6 +60,8 @@
 	DSGA_OP_AND,  ///< a & b
 	DSGA_OP_OR,   ///< a | b
 	DSGA_OP_XOR,  ///< a ^ b
+	DSGA_OP_STO,  ///< store a into temporary storage, indexed by b. return a
+	DSGA_OP_RST,  ///< return b
 };