Fix setting of object spec ctrl flags from GRF properties
This commit is contained in:
@@ -4298,12 +4298,13 @@ static ChangeInfoResult ObjectChangeInfo(uint id, int numinfo, int prop, const G
|
||||
|
||||
case A0RPI_OBJECT_USE_LAND_GROUND:
|
||||
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;
|
||||
|
||||
case A0RPI_OBJECT_EDGE_FOUNDATION_MODE:
|
||||
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++) {
|
||||
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:
|
||||
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;
|
||||
|
||||
default:
|
||||
|
@@ -43,8 +43,8 @@ DECLARE_ENUM_AS_BIT_SET(ObjectFlags)
|
||||
enum ObjectCtrlFlags {
|
||||
OBJECT_CTRL_FLAG_NONE = 0, ///< Just nothing.
|
||||
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_FLOOD_RESISTANT = 1 << 3, ///< Object is flood-resistant.
|
||||
OBJECT_CTRL_FLAG_EDGE_FOUNDATION = 1 << 1, ///< Use edge foundation mode.
|
||||
OBJECT_CTRL_FLAG_FLOOD_RESISTANT = 1 << 2, ///< Object is flood-resistant.
|
||||
};
|
||||
DECLARE_ENUM_AS_BIT_SET(ObjectCtrlFlags)
|
||||
|
||||
|
Reference in New Issue
Block a user