forked from mirror/OpenTTD
(svn r20437) -Codechange: lets Engines use GRFFilePropsBase as well
This commit is contained in:
@@ -357,7 +357,7 @@ static Engine *GetNewEngine(const GRFFile *file, VehicleType type, uint16 intern
|
||||
EngineID engine = _engine_mngr.GetID(type, internal_id, scope_grfid);
|
||||
if (engine != INVALID_ENGINE) {
|
||||
Engine *e = Engine::Get(engine);
|
||||
if (e->grffile == NULL) e->grffile = file;
|
||||
if (e->grf_prop.grffile == NULL) e->grf_prop.grffile = file;
|
||||
return e;
|
||||
}
|
||||
}
|
||||
@@ -367,8 +367,8 @@ static Engine *GetNewEngine(const GRFFile *file, VehicleType type, uint16 intern
|
||||
if (engine != INVALID_ENGINE) {
|
||||
Engine *e = Engine::Get(engine);
|
||||
|
||||
if (e->grffile == NULL) {
|
||||
e->grffile = file;
|
||||
if (e->grf_prop.grffile == NULL) {
|
||||
e->grf_prop.grffile = file;
|
||||
grfmsg(5, "Replaced engine at index %d for GRFID %x, type %d, index %d", e->index, BSWAP32(file->grfid), type, internal_id);
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ static Engine *GetNewEngine(const GRFFile *file, VehicleType type, uint16 intern
|
||||
|
||||
/* ... it's not, so create a new one based off an existing engine */
|
||||
Engine *e = new Engine(type, internal_id);
|
||||
e->grffile = file;
|
||||
e->grf_prop.grffile = file;
|
||||
|
||||
/* Reserve the engine slot */
|
||||
assert(_engine_mngr.Length() == e->index);
|
||||
@@ -6925,7 +6925,7 @@ static void CalculateRefitMasks()
|
||||
/* Did the newgrf specify any refitting? If not, use defaults. */
|
||||
if (_gted[engine].refitmask_valid) {
|
||||
if (ei->refit_mask != 0) {
|
||||
const GRFFile *file = e->grffile;
|
||||
const GRFFile *file = e->grf_prop.grffile;
|
||||
if (file != NULL && file->cargo_max != 0) {
|
||||
/* Apply cargo translation table to the refit mask */
|
||||
uint num_cargo = min(32, file->cargo_max);
|
||||
@@ -6987,7 +6987,7 @@ static void FinaliseEngineArray()
|
||||
Engine *e;
|
||||
|
||||
FOR_ALL_ENGINES(e) {
|
||||
if (e->grffile == NULL) {
|
||||
if (e->grf_prop.grffile == NULL) {
|
||||
const EngineIDMapping &eid = _engine_mngr[e->index];
|
||||
if (eid.grfid != INVALID_GRFID || eid.internal_id != eid.substitute_id) {
|
||||
e->info.string_id = STR_NEWGRF_INVALID_ENGINE;
|
||||
|
Reference in New Issue
Block a user