forked from Mirrors/openclonk
fixed pressing use1/use2 on gamepad when no item is selected (#535)
parent
9a15b99753
commit
957f865cfa
|
@ -518,8 +518,6 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
|
|||
// appropiate procedure:
|
||||
if (proc != "ATTACH" && proc != "PUSH")
|
||||
vehicle = nil;
|
||||
var contents = GetItem(0);
|
||||
var contents2 = GetItem(1);
|
||||
|
||||
// menu
|
||||
if (menu)
|
||||
|
@ -527,6 +525,9 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
|
|||
return Control2Menu(ctrl, x,y,strength, repeat, release);
|
||||
}
|
||||
|
||||
var contents = GetItem(0);
|
||||
var contents2 = GetItem(1);
|
||||
|
||||
// usage
|
||||
var use = (ctrl == CON_Use || ctrl == CON_UseDelayed || ctrl == CON_UseAlt || ctrl == CON_UseAltDelayed);
|
||||
if (use)
|
||||
|
@ -568,12 +569,12 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
|
|||
}
|
||||
// Release commands are always forwarded even if contents is 0, in case we
|
||||
// need to cancel use of an object that left inventory
|
||||
if ((contents || (release && using)) && ctrl == CON_Use || ctrl == CON_UseDelayed )
|
||||
if ((contents || (release && using)) && (ctrl == CON_Use || ctrl == CON_UseDelayed))
|
||||
{
|
||||
if (ControlUse2Script(ctrl, x, y, strength, repeat, release, contents))
|
||||
return true;
|
||||
}
|
||||
else if ((contents2 || (release && using)) && ctrl == CON_UseAlt || ctrl == CON_UseAltDelayed)
|
||||
else if ((contents2 || (release && using)) && (ctrl == CON_UseAlt || ctrl == CON_UseAltDelayed))
|
||||
{
|
||||
if (ControlUse2Script(ctrl, x, y, strength, repeat, release, contents2))
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue