mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57: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,20 +3438,44 @@ void Player::DoUse(Event *ev)
|
|||
|
||||
num = getUseableEntities(touch, MAX_GENTITIES, true);
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
hit = &g_entities[touch[i]];
|
||||
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++) {
|
||||
hit = &g_entities[touch[i]];
|
||||
|
||||
if (!hit->inuse) {
|
||||
continue;
|
||||
if (!hit->inuse) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Event* event = new Event(EV_Use);
|
||||
event->AddListener(this);
|
||||
|
||||
hit->entity->ProcessEvent(event);
|
||||
|
||||
if (m_pVehicle || m_pTurret) {
|
||||
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]];
|
||||
|
||||
Event *event = new Event(EV_Use);
|
||||
event->AddListener(this);
|
||||
if (!hit->inuse) {
|
||||
continue;
|
||||
}
|
||||
|
||||
hit->entity->ProcessEvent(event);
|
||||
Event* event = new Event(EV_Use);
|
||||
event->AddListener(this);
|
||||
|
||||
if (m_pVehicle || m_pTurret) {
|
||||
break;
|
||||
hit->entity->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue