Permalink
Browse files

[11963] Add additional check for game_events, invalid occurence

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
  • Loading branch information...
1 parent b71a244 commit 641e7ce7b4ebc4eb02a71e0254225422da2f7e98 @Schmoozerd Schmoozerd committed Apr 15, 2012
Showing with 12 additions and 6 deletions.
  1. +11 −5 src/game/GameEventMgr.cpp
  2. +1 −1 src/shared/revision_nr.h
View
16 src/game/GameEventMgr.cpp
@@ -146,17 +146,23 @@ void GameEventMgr::LoadFromDB()
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;
}
- 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;
}
}
View
2 src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
- #define REVISION_NR "11962"
+ #define REVISION_NR "11963"
#endif // __REVISION_NR_H__

0 comments on commit 641e7ce

Please sign in to comment.