mirror of https://github.com/OpenTTD/OpenTTD
(svn r4818) - NewGRF: add support for reading another GRF file's parameters, and warn if GRF Resource Management is tried.
parent
bd28390b2e
commit
90be3fadf7
22
newgrf.c
22
newgrf.c
|
@ -2300,6 +2300,27 @@ static void ParamSet(byte *buf, int len)
|
||||||
oper &= 0x7F;
|
oper &= 0x7F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (src2 == 0xFE) {
|
||||||
|
if (GB(data, 0, 8) == 0xFF) {
|
||||||
|
if (data == 0x0000FFFF) {
|
||||||
|
/* Patch variables */
|
||||||
|
grfmsg(GMS_WARN, "ParamSet: Reading Patch variables unsupport.");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
/* GRF Resource Management */
|
||||||
|
grfmsg(GMS_WARN, "ParamSet: GRF Resource Management unsupported.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Read another GRF File's parameter */
|
||||||
|
const GRFFile *file = GetFileByGRFID(data);
|
||||||
|
if (file == NULL || src1 >= file->param_end) {
|
||||||
|
src1 = 0;
|
||||||
|
} else {
|
||||||
|
src1 = file->param[src1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
/* The source1 and source2 operands refer to the grf parameter number
|
/* The source1 and source2 operands refer to the grf parameter number
|
||||||
* like in action 6 and 7. In addition, they can refer to the special
|
* like in action 6 and 7. In addition, they can refer to the special
|
||||||
* variables available in action 7, or they can be FF to use the value
|
* variables available in action 7, or they can be FF to use the value
|
||||||
|
@ -2318,6 +2339,7 @@ static void ParamSet(byte *buf, int len)
|
||||||
uint32 temp;
|
uint32 temp;
|
||||||
src2 = GetParamVal(src2, &temp);
|
src2 = GetParamVal(src2, &temp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: You can access the parameters of another GRF file by using
|
/* TODO: You can access the parameters of another GRF file by using
|
||||||
* source2=FE, source1=the other GRF's parameter number and data=GRF
|
* source2=FE, source1=the other GRF's parameter number and data=GRF
|
||||||
|
|
Loading…
Reference in New Issue