added sanity check for killing mission mobs

This commit is contained in:
kamilprzyb 2020-09-22 10:18:29 +02:00
parent adf017b07c
commit 00f64ce992

View File

@ -328,7 +328,13 @@ void MissionManager::mobKilled(CNSocket *sock, int mobid) {
if (task["m_iCSUNumToKill"][j] != 0) if (task["m_iCSUNumToKill"][j] != 0)
{ {
missionmob = true; missionmob = true;
plr->RemainingNPCCount[i][j]--; //sanity check
if (plr->RemainingNPCCount[i][j] == 0) {
std::cout << "[WARN] RemainingNPCCount tries to go below 0?!" << std::endl;
}
else {
plr->RemainingNPCCount[i][j]--;
}
} }
// drop quest item // drop quest item
if (task["m_iCSUItemNumNeeded"][j] != 0 && !isQuestItemFull(sock, task["m_iCSUItemID"][j], task["m_iCSUItemNumNeeded"][j]) ) { if (task["m_iCSUItemNumNeeded"][j] != 0 && !isQuestItemFull(sock, task["m_iCSUItemID"][j], task["m_iCSUItemNumNeeded"][j]) ) {