- added a proper error message when '--' or '++' gets used on 8 or 16 bit values.

This commit is contained in:
Christoph Oelckers 2021-05-17 12:17:03 +02:00
parent f4143f7624
commit a94f5dd1b3
2 changed files with 5 additions and 5 deletions

View file

@ -2145,9 +2145,9 @@ FxExpression *FxPreIncrDecr::Resolve(FCompileContext &ctx)
ValueType = Base->ValueType; ValueType = Base->ValueType;
if (!Base->IsNumeric()) if (!Base->IsNumeric() || Base->ValueType->Size != 4)
{ {
ScriptPosition.Message(MSG_ERROR, "Numeric type expected"); ScriptPosition.Message(MSG_ERROR, "Numeric 32 bit type expected");
delete this; delete this;
return nullptr; return nullptr;
} }
@ -2232,9 +2232,9 @@ FxExpression *FxPostIncrDecr::Resolve(FCompileContext &ctx)
ValueType = Base->ValueType; ValueType = Base->ValueType;
if (!Base->IsNumeric()) if (!Base->IsNumeric() || ValueType->Size != 4)
{ {
ScriptPosition.Message(MSG_ERROR, "Numeric type expected"); ScriptPosition.Message(MSG_ERROR, "Numeric 32 bit type expected");
delete this; delete this;
return nullptr; return nullptr;
} }

View file

@ -406,7 +406,7 @@ class StateProvider : Inventory
if ((player.cmd.buttons & BT_ATTACK) if ((player.cmd.buttons & BT_ATTACK)
&& !player.ReadyWeapon.bAltFire && !pending && player.health > 0) && !player.ReadyWeapon.bAltFire && !pending && player.health > 0)
{ {
player.refire++; player.refire = player.refire + 1;
player.mo.FireWeapon(ResolveState(flash)); player.mo.FireWeapon(ResolveState(flash));
} }
else if ((player.cmd.buttons & BT_ALTATTACK) else if ((player.cmd.buttons & BT_ALTATTACK)