Core/SmartAI:

- Drop useless actions SMART_ACTION_ENTER_VEHICLE, SMART_ACTION_LEAVE_VEHICLE and SMART_ACTION_REMOVE_PASSENGERS.
(Vehicles are aura-driven, just remove or add the proper aura to achieve the same as these actions did)
- Fixed possible crash in SMART_ACTION_SEND_GOSSIP_MENU
- Areatriggers should not be triggered by dead players
This commit is contained in:
kaelima
2011-10-31 02:01:17 +01:00
parent e16e18da23
commit 3d4d147196
4 changed files with 10 additions and 81 deletions

View File

@@ -1472,75 +1472,6 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
case SMART_ACTION_CALL_SCRIPT_RESET:
OnReset();
break;
case SMART_ACTION_ENTER_VEHICLE:
{
if (!me)
return;
ObjectList* targets = GetTargets(e, unit);
if (!targets)
return;
for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
if (Unit* target = (*itr)->ToUnit())
{
if (target->GetVehicleKit())
{
me->EnterVehicle(target, e.action.enterVehicle.seat);
delete targets;
return;
}
}
}
delete targets;
break;
}
case SMART_ACTION_LEAVE_VEHICLE:
{
ObjectList* targets = GetTargets(e, unit);
if (!targets)
return;
for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
if (Unit* target = (*itr)->ToUnit())
{
if (!target->GetVehicle())
continue;
target->ExitVehicle();
delete targets;
return;
}
}
delete targets;
break;
}
case SMART_ACTION_REMOVE_PASSENGERS:
{
ObjectList* targets = GetTargets(e, unit);
if (!targets)
return;
for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
if (!IsUnit(*itr))
continue;
if (Vehicle* veh = (*itr)->ToUnit()->GetVehicle())
{
veh->RemoveAllPassengers();
delete targets;
return;
}
}
delete targets;
break;
}
case SMART_ACTION_CALL_TIMED_ACTIONLIST:
{
if (e.GetTargetType() == SMART_TARGET_NONE)
@@ -1852,6 +1783,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_SEND_GOSSIP_MENU:
{
if (!GetBaseObject())
return;
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SEND_GOSSIP_MENU: gossipMenuId %d, gossip_option_id %d",
e.action.sendGossipMenu.gossipMenuId, e.action.sendGossipMenu.gossipOptionId);