mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-29 06:07:57 +03:00
Continue using entities even when attached to a turret, in 1.11 and below for backwards compatibility!
Fixes #140 where the MG42 objective in m1l1 would not trigger
This commit is contained in:
parent
7ddee0100e
commit
40e3977664
1 changed files with 33 additions and 9 deletions
|
@ -3438,6 +3438,12 @@ void Player::DoUse(Event *ev)
|
||||||
|
|
||||||
num = getUseableEntities(touch, MAX_GENTITIES, true);
|
num = getUseableEntities(touch, MAX_GENTITIES, true);
|
||||||
|
|
||||||
|
if (g_protocol >= protocol_e::PROTOCOL_MOHTA_MIN) {
|
||||||
|
// Fixed in 2.0
|
||||||
|
// Since 2.0, the loop stops when the player
|
||||||
|
// uses a turret, this prevents the turret from being deleted
|
||||||
|
// after being attached to the player
|
||||||
|
//
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
hit = &g_entities[touch[i]];
|
hit = &g_entities[touch[i]];
|
||||||
|
|
||||||
|
@ -3445,7 +3451,7 @@ void Player::DoUse(Event *ev)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Event *event = new Event(EV_Use);
|
Event* event = new Event(EV_Use);
|
||||||
event->AddListener(this);
|
event->AddListener(this);
|
||||||
|
|
||||||
hit->entity->ProcessEvent(event);
|
hit->entity->ProcessEvent(event);
|
||||||
|
@ -3454,6 +3460,24 @@ void Player::DoUse(Event *ev)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// Backward compatibility
|
||||||
|
// It still allows 1.11 SP to work properly
|
||||||
|
// Such as in m1l1 when the player must man the mounted machine gun
|
||||||
|
for (i = 0; i < num; i++) {
|
||||||
|
hit = &g_entities[touch[i]];
|
||||||
|
|
||||||
|
if (!hit->inuse) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Event* event = new Event(EV_Use);
|
||||||
|
event->AddListener(this);
|
||||||
|
|
||||||
|
hit->entity->ProcessEvent(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (i < num && m_pVehicle) {
|
if (i < num && m_pVehicle) {
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue