mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[11963] Add additional check for game_events, invalid occurence
Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
parent
110c16de13
commit
f3b5e1e4bc
2 changed files with 12 additions and 6 deletions
|
|
@ -146,17 +146,23 @@ void GameEventMgr::LoadFromDB()
|
||||||
pGameEvent.holiday_id = HolidayIds(fields[5].GetUInt32());
|
pGameEvent.holiday_id = HolidayIds(fields[5].GetUInt32());
|
||||||
|
|
||||||
|
|
||||||
if(pGameEvent.length==0) // length>0 is validity check
|
if (pGameEvent.length == 0) // length>0 is validity check
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("`game_event` game event id (%i) have length 0 and can't be used.",event_id);
|
sLog.outErrorDb("`game_event` game event id (%i) have length 0 and can't be used.", event_id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pGameEvent.holiday_id != HOLIDAY_NONE)
|
if (pGameEvent.occurence < pGameEvent.length) // occurence < length is useless. This also asserts that occurence > 0!
|
||||||
{
|
{
|
||||||
if(!sHolidaysStore.LookupEntry(pGameEvent.holiday_id))
|
sLog.outErrorDb("`game_event` game event id (%i) has occurence %u < length %u and can't be used.", event_id, pGameEvent.occurence, pGameEvent.length);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pGameEvent.holiday_id != HOLIDAY_NONE)
|
||||||
|
{
|
||||||
|
if (!sHolidaysStore.LookupEntry(pGameEvent.holiday_id))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("`game_event` game event id (%i) have nonexistent holiday id %u.",event_id,pGameEvent.holiday_id);
|
sLog.outErrorDb("`game_event` game event id (%i) have nonexistent holiday id %u.", event_id, pGameEvent.holiday_id);
|
||||||
pGameEvent.holiday_id = HOLIDAY_NONE;
|
pGameEvent.holiday_id = HOLIDAY_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11962"
|
#define REVISION_NR "11963"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue