src/newgrf_spritegroup.cpp
branchcpp_gui
changeset 6308 646711c5feaa
parent 6303 84c215fc8eb8
equal deleted inserted replaced
6307:f40e88cff863 6308:646711c5feaa
    73 {
    73 {
    74 	CleanPool(&_SpriteGroup_pool);
    74 	CleanPool(&_SpriteGroup_pool);
    75 
    75 
    76 	_spritegroup_count = 0;
    76 	_spritegroup_count = 0;
    77 }
    77 }
       
    78 
       
    79 static uint32 _temp_store[0x110];
    78 
    80 
    79 
    81 
    80 static inline uint32 GetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available)
    82 static inline uint32 GetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available)
    81 {
    83 {
    82 	/* Return common variables */
    84 	/* Return common variables */
    94 		case 0x1A: return UINT_MAX;
    96 		case 0x1A: return UINT_MAX;
    95 		case 0x1B: return GB(_display_opt, 0, 6);
    97 		case 0x1B: return GB(_display_opt, 0, 6);
    96 		case 0x1C: return object->last_value;
    98 		case 0x1C: return object->last_value;
    97 		case 0x20: return _opt.landscape == LT_ARCTIC ? GetSnowLine() : 0xFF;
    99 		case 0x20: return _opt.landscape == LT_ARCTIC ? GetSnowLine() : 0xFF;
    98 
   100 
       
   101 		case 0x7D: return _temp_store[parameter];
       
   102 
    99 		/* Not a common variable, so evalute the feature specific variables */
   103 		/* Not a common variable, so evalute the feature specific variables */
   100 		default: return object->GetVariable(object, variable, parameter, available);
   104 		default: return object->GetVariable(object, variable, parameter, available);
   101 	}
   105 	}
   102 }
   106 }
   103 
   107 
   131 		case DSGA_OP_UMOD: return (U)last_value % (U)value;
   135 		case DSGA_OP_UMOD: return (U)last_value % (U)value;
   132 		case DSGA_OP_MUL:  return last_value * value;
   136 		case DSGA_OP_MUL:  return last_value * value;
   133 		case DSGA_OP_AND:  return last_value & value;
   137 		case DSGA_OP_AND:  return last_value & value;
   134 		case DSGA_OP_OR:   return last_value | value;
   138 		case DSGA_OP_OR:   return last_value | value;
   135 		case DSGA_OP_XOR:  return last_value ^ value;
   139 		case DSGA_OP_XOR:  return last_value ^ value;
       
   140 		case DSGA_OP_STO:
       
   141 			if (value < lengthof(_temp_store)) _temp_store[value] = last_value;
       
   142 			return last_value;
       
   143 		case DSGA_OP_RST:  return value;
   136 		default:           return value;
   144 		default:           return value;
   137 	}
   145 	}
   138 }
   146 }
   139 
   147 
   140 
   148