mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 10:30:28 +00:00
(svn r21239) -Codechange/Fix: [NewGRF] Use 0xFF instead of 0 as default value for visual effect. This makes setting train prop 22 to 0 actually work (Hirundo)
This commit is contained in:
parent
61ff042460
commit
46186134c8
@ -85,6 +85,8 @@ Engine::Engine(VehicleType type, EngineID base)
|
|||||||
this->info.base_life = 0xFF;
|
this->info.base_life = 0xFF;
|
||||||
/* Set road vehicle tractive effort to the default value */
|
/* Set road vehicle tractive effort to the default value */
|
||||||
if (type == VEH_ROAD) this->u.road.tractive_effort = 0x4C;
|
if (type == VEH_ROAD) this->u.road.tractive_effort = 0x4C;
|
||||||
|
/* Set visual effect to the default value */
|
||||||
|
if (type == VEH_TRAIN) this->u.rail.visual_effect = VE_DEFAULT;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "vehicle_func.h"
|
#include "vehicle_func.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
#include "vehicle_base.h"
|
||||||
|
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
#include "table/build_industry.h"
|
#include "table/build_industry.h"
|
||||||
@ -710,8 +711,13 @@ static ChangeInfoResult RailVehicleChangeInfo(uint engine, int numinfo, int prop
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x22: // Visual effect
|
case 0x22: // Visual effect
|
||||||
/** @see note in engine.h about rvi->visual_effect */
|
|
||||||
rvi->visual_effect = buf->ReadByte();
|
rvi->visual_effect = buf->ReadByte();
|
||||||
|
/* Avoid accidentally setting visual_effect to the default value
|
||||||
|
* Since bit 6 (disable effects) is set anyways, we can safely erase some bits. */
|
||||||
|
if (rvi->visual_effect == VE_DEFAULT) {
|
||||||
|
assert(HasBit(rvi->visual_effect, VE_DISABLE_EFFECT));
|
||||||
|
SB(rvi->visual_effect, VE_TYPE_START, VE_TYPE_COUNT, 0);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x23: // Powered wagons weight bonus
|
case 0x23: // Powered wagons weight bonus
|
||||||
|
@ -364,7 +364,7 @@ static const EngineInfo _orig_engine_info[] = {
|
|||||||
* Tractive effort coefficient by default is the same as TTDPatch, 0.30*256=76
|
* Tractive effort coefficient by default is the same as TTDPatch, 0.30*256=76
|
||||||
* Air drag value depends on the top speed of the vehicle.
|
* Air drag value depends on the top speed of the vehicle.
|
||||||
*/
|
*/
|
||||||
#define RVI(a, b, c, d, e, f, g, h, i, j, k) { a, b, c, {j}, d, e, f, g, h, k, i, 0, 0, 0, 0, 0, 76, 0, 0 }
|
#define RVI(a, b, c, d, e, f, g, h, i, j, k) { a, b, c, {j}, d, e, f, g, h, k, i, 0, 0, 0, VE_DEFAULT, 0, 76, 0, 0 }
|
||||||
#define M RAILVEH_MULTIHEAD
|
#define M RAILVEH_MULTIHEAD
|
||||||
#define W RAILVEH_WAGON
|
#define W RAILVEH_WAGON
|
||||||
#define G RAILVEH_SINGLEHEAD
|
#define G RAILVEH_SINGLEHEAD
|
||||||
|
@ -1864,7 +1864,7 @@ void Vehicle::UpdateVisualEffect(bool allow_power_change)
|
|||||||
|
|
||||||
const Engine *e = Engine::Get(this->engine_type);
|
const Engine *e = Engine::Get(this->engine_type);
|
||||||
if (this->type == VEH_TRAIN) {
|
if (this->type == VEH_TRAIN) {
|
||||||
if (e->u.rail.visual_effect != 0) {
|
if (e->u.rail.visual_effect != VE_DEFAULT) {
|
||||||
this->vcache.cached_vis_effect = e->u.rail.visual_effect;
|
this->vcache.cached_vis_effect = e->u.rail.visual_effect;
|
||||||
} else {
|
} else {
|
||||||
Train *t = Train::From(this);
|
Train *t = Train::From(this);
|
||||||
|
@ -79,6 +79,8 @@ enum VisualEffect {
|
|||||||
|
|
||||||
VE_DISABLE_EFFECT = 6, ///< Flag to disable visual effect
|
VE_DISABLE_EFFECT = 6, ///< Flag to disable visual effect
|
||||||
VE_DISABLE_WAGON_POWER = 7, ///< Flag to disable wagon power
|
VE_DISABLE_WAGON_POWER = 7, ///< Flag to disable wagon power
|
||||||
|
|
||||||
|
VE_DEFAULT = 0xFF, ///< Default value to indicate that visual effect should be based on engine class
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Cached often queried values common to all vehicles. */
|
/** Cached often queried values common to all vehicles. */
|
||||||
|
Loading…
Reference in New Issue
Block a user