Added validation of immunity amount and cooldown settings. Cleaned up some comments in code and class config.

This commit is contained in:
Richard Helgeby
2013-01-06 00:25:57 +01:00
parent 666ac57836
commit d0d1de8197
4 changed files with 174 additions and 17 deletions

View File

@ -297,7 +297,26 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
}
// Immunity amount.
// TODO: Validate amount value. This depends on the immunity mode.
new immunityAmount = ClassData[classindex][Class_ImmunityAmount];
if (!ImmunityIsValidAmount(immunityMode, immunityAmount))
{
flags += ZR_CLASS_IMMUNITY_AMOUNT;
if (logErrors)
{
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid immunity_amount at index %d.", classindex);
}
}
// Immunity cooldown.
new immunityCooldown = ClassData[classindex][Class_ImmunityCooldown];
if (!ImmunityIsValidCooldown(immunityMode, immunityCooldown))
{
flags += ZR_CLASS_IMMUNITY_COOLDOWN;
if (logErrors)
{
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid immunity_cooldown at index %d.", classindex);
}
}
// Health.
new health = ClassData[classindex][Class_Health];