Changeset 50 for trunk/src/game/GameEvent.cpp
- Timestamp:
- 11/19/08 13:29:16 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/GameEvent.cpp
r44 r50 29 29 #include "GossipDef.h" 30 30 #include "Player.h" 31 #include "BattleGroundMgr.h" 31 32 32 33 INSTANTIATE_SINGLETON_1(GameEvent); … … 866 867 sLog.outString(); 867 868 sLog.outString( ">> Loaded %u npc gossip textids in game events", count ); 869 870 delete result; 871 } 872 873 // set all flags to 0 874 mGameEventBattleGroundHolidays.resize(mGameEvent.size(),0); 875 // load game event battleground flags 876 // 0 1 877 result = WorldDatabase.Query("SELECT event, bgflag FROM game_event_battleground_holiday"); 878 879 count = 0; 880 if( !result ) 881 { 882 barGoLink bar3(1); 883 bar3.step(); 884 885 sLog.outString(); 886 sLog.outString(">> Loaded %u battleground holidays in game events", count ); 887 } 888 else 889 { 890 891 barGoLink bar3( result->GetRowCount() ); 892 do 893 { 894 Field *fields = result->Fetch(); 895 896 bar3.step(); 897 898 uint16 event_id = fields[0].GetUInt16(); 899 900 if(event_id >= mGameEvent.size()) 901 { 902 sLog.outErrorDb("`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`",event_id); 903 continue; 904 } 905 906 ++count; 907 908 mGameEventBattleGroundHolidays[event_id] = fields[1].GetUInt32(); 909 910 } while( result->NextRow() ); 911 sLog.outString(); 912 sLog.outString( ">> Loaded %u battleground holidays in game events", count ); 868 913 869 914 delete result; … … 992 1037 // remove vendor items 993 1038 UpdateEventNPCVendor(event_id, false); 1039 // update bg holiday 1040 UpdateBattleGroundSettings(); 994 1041 } 995 1042 … … 1020 1067 // add vendor items 1021 1068 UpdateEventNPCVendor(event_id, true); 1069 // update bg holiday 1070 UpdateBattleGroundSettings(); 1022 1071 } 1023 1072 … … 1046 1095 } 1047 1096 } 1097 } 1098 1099 void GameEvent::UpdateBattleGroundSettings() 1100 { 1101 uint32 mask = 0; 1102 for(ActiveEvents::const_iterator itr = m_ActiveEvents.begin(); itr != m_ActiveEvents.end(); ++itr ) 1103 mask |= mGameEventBattleGroundHolidays[*itr]; 1104 sBattleGroundMgr.SetHolidayWeekends(mask); 1048 1105 } 1049 1106