Prevented an endless loop crash related to EVENT_TASK_STAGE_COMPLETE.

This commit is contained in:
Trevius 2014-03-31 22:03:11 -05:00
parent 955f164efb
commit 174cb1876a
2 changed files with 10 additions and 9 deletions

View File

@ -5,8 +5,8 @@ Uleat: Fix for unconscious skillups.
Uleat: Fix for crash issue with nullptr reference in recent Client::SummonItem() work.
Uleat: Added rule for GM Status check code in Client::SummonItem().
Note: Rule default is set to 250..but, implementation is on hold until load item code handles the database 'minstatus' field.
Uleat: Added RuleB(Bots, BotLevelsWithOwner). Bots will auto-update as their owner levels/de-levels. Appearance packets are sent to show the 'leveling effect' as well as updating client entities.
Trevius: Prevented an endless loop crash related to EVENT_TASK_STAGE_COMPLETE.
Optional Bot SQL: utils/sql/git/bot/optional/2014_03_31_BotLevelsWithOwnerRule.sql
Note: This sql is required to activate the optional behavior.

View File

@ -1972,14 +1972,6 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T
Task->Activity[ActivityID].GoalCount,
ActivityID);
if(Task->Activity[ActivityID].GoalMethod != METHODQUEST)
{
char buf[24];
snprintf(buf, 23, "%d %d", ActiveTasks[TaskIndex].TaskID, ActiveTasks[TaskIndex].Activity[ActivityID].ActivityID);
buf[23] = '\0';
parse->EventPlayer(EVENT_TASK_STAGE_COMPLETE, c, buf, 0);
}
// Flag the activity as complete
ActiveTasks[TaskIndex].Activity[ActivityID].State = ActivityCompleted;
// Unlock subsequent activities for this task
@ -1991,6 +1983,15 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T
taskmanager->SendSingleActiveTaskToClient(c, TaskIndex, TaskComplete, false);
// Inform the client the task has been updated, both by a chat message
c->Message(0, "Your task '%s' has been updated.", Task->Title);
if(Task->Activity[ActivityID].GoalMethod != METHODQUEST)
{
char buf[24];
snprintf(buf, 23, "%d %d", ActiveTasks[TaskIndex].TaskID, ActiveTasks[TaskIndex].Activity[ActivityID].ActivityID);
buf[23] = '\0';
parse->EventPlayer(EVENT_TASK_STAGE_COMPLETE, c, buf, 0);
}
// If this task is now complete, the Completed tasks will have been
// updated in UnlockActivities. Send the completed task list to the
// client. This is the same sequence the packets are sent on live.