Fix setting of object spec ctrl flags from GRF properties

This commit is contained in:
Jonathan G Rennison
2021-12-08 03:35:56 +00:00
parent bfe7bbebd8
commit b807f0d50e
2 changed files with 7 additions and 5 deletions

View File

@@ -4298,12 +4298,13 @@ static ChangeInfoResult ObjectChangeInfo(uint id, int numinfo, int prop, const G
case A0RPI_OBJECT_USE_LAND_GROUND: case A0RPI_OBJECT_USE_LAND_GROUND:
if (MappedPropertyLengthMismatch(buf, 1, mapping_entry)) break; if (MappedPropertyLengthMismatch(buf, 1, mapping_entry)) break;
SB(spec->ctrl_flags, OBJECT_CTRL_FLAG_USE_LAND_GROUND, 1, (buf->ReadByte() != 0 ? 1 : 0)); spec->ctrl_flags &= ~OBJECT_CTRL_FLAG_USE_LAND_GROUND;
if (buf->ReadByte() != 0) spec->ctrl_flags |= OBJECT_CTRL_FLAG_USE_LAND_GROUND;
break; break;
case A0RPI_OBJECT_EDGE_FOUNDATION_MODE: case A0RPI_OBJECT_EDGE_FOUNDATION_MODE:
if (MappedPropertyLengthMismatch(buf, 4, mapping_entry)) break; if (MappedPropertyLengthMismatch(buf, 4, mapping_entry)) break;
SetBit(spec->ctrl_flags, OBJECT_CTRL_FLAG_EDGE_FOUNDATION); spec->ctrl_flags |= OBJECT_CTRL_FLAG_EDGE_FOUNDATION;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
spec->edge_foundation[i] = buf->ReadByte(); spec->edge_foundation[i] = buf->ReadByte();
} }
@@ -4311,7 +4312,8 @@ static ChangeInfoResult ObjectChangeInfo(uint id, int numinfo, int prop, const G
case A0RPI_OBJECT_FLOOD_RESISTANT: case A0RPI_OBJECT_FLOOD_RESISTANT:
if (MappedPropertyLengthMismatch(buf, 1, mapping_entry)) break; if (MappedPropertyLengthMismatch(buf, 1, mapping_entry)) break;
SB(spec->ctrl_flags, OBJECT_CTRL_FLAG_FLOOD_RESISTANT, 1, (buf->ReadByte() != 0 ? 1 : 0)); spec->ctrl_flags &= ~OBJECT_CTRL_FLAG_FLOOD_RESISTANT;
if (buf->ReadByte() != 0) spec->ctrl_flags |= OBJECT_CTRL_FLAG_FLOOD_RESISTANT;
break; break;
default: default:

View File

@@ -43,8 +43,8 @@ DECLARE_ENUM_AS_BIT_SET(ObjectFlags)
enum ObjectCtrlFlags { enum ObjectCtrlFlags {
OBJECT_CTRL_FLAG_NONE = 0, ///< Just nothing. OBJECT_CTRL_FLAG_NONE = 0, ///< Just nothing.
OBJECT_CTRL_FLAG_USE_LAND_GROUND = 1 << 0, ///< Use land for ground sprite. OBJECT_CTRL_FLAG_USE_LAND_GROUND = 1 << 0, ///< Use land for ground sprite.
OBJECT_CTRL_FLAG_EDGE_FOUNDATION = 1 << 2, ///< Use edge foundation mode. OBJECT_CTRL_FLAG_EDGE_FOUNDATION = 1 << 1, ///< Use edge foundation mode.
OBJECT_CTRL_FLAG_FLOOD_RESISTANT = 1 << 3, ///< Object is flood-resistant. OBJECT_CTRL_FLAG_FLOOD_RESISTANT = 1 << 2, ///< Object is flood-resistant.
}; };
DECLARE_ENUM_AS_BIT_SET(ObjectCtrlFlags) DECLARE_ENUM_AS_BIT_SET(ObjectCtrlFlags)