forked from mirror/OpenTTD
(svn r8075) -Feature: Add support for variable 7E - subroutines. (peter1138)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "variables.h"
|
||||
#include "macros.h"
|
||||
#include "oldpool.h"
|
||||
#include "newgrf_callbacks.h"
|
||||
#include "newgrf_spritegroup.h"
|
||||
#include "date.h"
|
||||
|
||||
@@ -142,7 +143,16 @@ static inline const SpriteGroup *ResolveVariable(const SpriteGroup *group, Resol
|
||||
|
||||
/* Try to get the variable. We shall assume it is available, unless told otherwise. */
|
||||
bool available = true;
|
||||
value = GetVariable(object, adjust->variable, adjust->parameter, &available);
|
||||
if (adjust->variable == 0x7E) {
|
||||
const SpriteGroup *subgroup = Resolve(adjust->subroutine, object);
|
||||
if (subgroup == NULL || subgroup->type != SGT_CALLBACK) {
|
||||
value = CALLBACK_FAILED;
|
||||
} else {
|
||||
value = subgroup->g.callback.result;
|
||||
}
|
||||
} else {
|
||||
value = GetVariable(object, adjust->variable, adjust->parameter, &available);
|
||||
}
|
||||
|
||||
if (!available) {
|
||||
/* Unsupported property: skip further processing and return either
|
||||
|
Reference in New Issue
Block a user