Commit Graph

139 Commits

Author SHA1 Message Date
Praetonus
f296095191 Fix various warnings. The core, the scripts and the tools now compile without warnings with -Wall -Wextra -pedantic.
-Fix warnings from -Woverflow on implicit constant conversion.
-Fix warnings from -pedantic.
-Fix warnings from -pedantic.
-Fix warnings from -Wformat.

Two minor changes in addition :

-Replace a defined value equal to 2^31 - 1 by std::numeric_limits<int>::max().
-Remove useless null-check on pointer returned by new. New doesn't returns nullptr on failure, it throws std::bad_alloc.
2014-05-15 21:32:47 +02:00
Dehravor
cbd36d5a4e Core/Misc: Remove remaining COMPILER_HAS_CPP11_SUPPORT related macros 2014-05-01 11:19:32 +02:00
jackpoz
d78e69cdc6 Core/Instances: Fix memory leak in InstanceSaveMgr
Fix memory leak in InstanceSaveMgr added in 1f170c99ef .
Make InstanceSave::SetToDelete() private since it's not supposed to be used by anything other than InstanceSave or its friend class InstanceSaveMgr .
2014-01-13 22:52:35 +01:00
jackpoz
1f170c99ef Core/Instances: Fix Instance binding
Fix players not being bound to instance if the group was disbanded before killing any boss.
Fixes #437
2014-01-03 18:56:11 +01:00
Vincent_Michael
20004050bc Update copyright note for 2014.
Happy new year.
2014-01-01 00:07:53 +01:00
jackpoz
3744c14184 Scripts/Misc: Ensure Creatures are in instances when required
Create ScriptedAIs that require a InstanceScript reference only if the InstanceScript exists, so if these Creatures are in an instance. ScriptedAIs that don't require a InstanceScript reference have not been modified.
This fixes many possible NULL dereference crashes happening when spawning a scripted Creature outside of an instance.
Fixed a GetOwner() and a ToPlayer() NULL dereference crashes too.
2013-12-29 01:19:52 +01:00
Spp
94e2b9332a Core/Logging: Remove LOG_FILTER_XXX defines with it's value (remember logger names are case-sensitive) 2013-11-08 10:50:51 +01:00
leguybrush
0a308144a8 Core/Code: Unify [more] codestyle for brackets: )\n{\n} to ) { }. 2013-10-28 14:36:07 -04:00
Ascathor
2607738990 Core/Code: Unify codestyle for brackets: {} to { }.
Also added missing copyright to some files.
2013-10-27 23:46:02 +01:00
Ellie
1fae858645 Whitespace between string literals and user-defined literals is now mandatory for concatenation in C++11 2013-10-01 01:13:13 -07:00
Vincent-Michael
a917461762 DB/Misc: Fix startup errors 2013-08-28 19:06:20 +02:00
jackpoz
a3bdf90b0a Core/Instances: Fix mutex released after being deleted
Modify how InstanceSave is deleted so the local mutex can be released before deleting the class itself.

Valgrind log:
 Invalid read of size 4
  at 0x662662B: __pthread_mutex_unlock_usercnt (pthread_mutex_unlock.c:52)
  by 0x55D3C55: ACE_OS::mutex_unlock(pthread_mutex_t*) (OS_NS_Thread.cpp:2335)
  by 0xB20057: Player::CleanupsBeforeDelete(bool) (OS_NS_Thread.inl:3519)
  by 0xD0E2FA: WorldSession::LogoutPlayer(bool) (WorldSession.cpp:527)
  by 0xC66D34: WorldSession::HandleLogoutRequestOpcode(WorldPacket&) (MiscHandler.cpp:403)
  by 0xD0EA82: WorldSession::Update(unsigned int, PacketFilter&) (WorldSession.cpp:312)
  by 0xD9AD66: World::UpdateSessions(unsigned int) (World.cpp:2615)
  by 0xD9BEC4: World::Update(unsigned int) (World.cpp:1978)
  by 0xA035E5: WorldRunnable::run() (WorldRunnable.cpp:60)
  by 0xEC8D39: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:183)
  by 0x55D7555: ACE_OS_Thread_Adapter::invoke() (OS_Thread_Adapter.cpp:103)
  by 0x6622B4F: start_thread (pthread_create.c:304)
Address 0x1884bb08 is 56 bytes inside a block of size 104 free'd
  at 0x4C279DC: operator delete(void*) (vg_replace_malloc.c:457)
  by 0xC9D533: InstanceSaveManager::RemoveInstanceSave(unsigned int) (InstanceSaveMgr.cpp:159)
  by 0xC9E826: InstanceSave::UnloadIfEmpty() (InstanceSaveMgr.cpp:238)
  by 0xB2003E: Player::CleanupsBeforeDelete(bool) (InstanceSaveMgr.h:84)
  by 0xD0E2FA: WorldSession::LogoutPlayer(bool) (WorldSession.cpp:527)
  by 0xC66D34: WorldSession::HandleLogoutRequestOpcode(WorldPacket&) (MiscHandler.cpp:403)
  by 0xD0EA82: WorldSession::Update(unsigned int, PacketFilter&) (WorldSession.cpp:312)
  by 0xD9AD66: World::UpdateSessions(unsigned int) (World.cpp:2615)
  by 0xD9BEC4: World::Update(unsigned int) (World.cpp:1978)
  by 0xA035E5: WorldRunnable::run() (WorldRunnable.cpp:60)
  by 0xEC8D39: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:183)
  by 0x55D7555: ACE_OS_Thread_Adapter::invoke() (OS_Thread_Adapter.cpp:103)
2013-08-25 19:08:22 +02:00
joschiwald
a383885f5c Scripts/AhnKahet: reworked InstanceScript 2013-08-21 19:43:46 +02:00
Malcrom
ec474a62e5 Core: More Function Renaming. 2013-06-11 21:25:12 -02:30
Malcrom
66978cfc3b Core: Some function renaming. 2013-06-11 19:54:27 -02:30
Spp
d1677b2db0 Core/Logging: Performance-related tweaks to logging system
All sLog->out* functions (except outCommand atm) are replaced with TC_LOG_* macros.
    Memleak fix
2013-05-13 15:07:36 +02:00
Spp
1a6a23ec96 Core/Misc: Minor optimizations (+code changes to reduce differences with 4.3.4 branch)
Core/Logging: Create new logger type "Cheat". Will be used to log all cheat attempts
2013-03-25 13:26:48 +01:00
Nefarion
49fd11ab5a First step of comment style refactoring to doxygen-style. 2013-03-08 21:55:37 +01:00
Ascathor
d6d066f014 Several todo corrections for documentation 2013-02-26 20:05:17 +01:00
Spp
677ed18080 Core/Dungeon Finder: Fix group (5) unable to do new dungeon after finished last dungeon
- Some optimizations here and there
- Drop unused columns related to dungeon rewards
- Simplify Group reward. All people inside the dungeon should get the reward, no matter how far it's from the boss
2013-01-09 15:15:42 +01:00
Spp
d36c4a91ba Core/Misc: Use equal_range instead of lower_bound/upper_bound calls where possible. 2013-01-02 09:53:43 +01:00
Vincent_Michael
cc65aba789 Update copyright note for 2013.
Happy new year.
2013-01-01 00:41:01 +01:00
Spp
2251d1bfae Core/Misc: Set mode 0644 for files 2012-11-27 13:03:12 +01:00
Spp
7bef4ce401 Core/Misc: Reduce header dependencies - Step III 2012-11-20 15:03:56 +01:00
Spp
b5c9ab8802 Core/Misc: Reduction of header dependencies - Step II 2012-11-20 12:30:30 +01:00
Spp
8c5f011e79 Core/Achievements: Force all calls to AchievementMgr be done through Player functions (Remove GetAchievementMgr)
Note: No real use in 3.3.5 but will be used in 4.3.4
2012-09-18 14:29:53 +02:00
Spp
358c6a26d6 Core: Warning fixes (Also some -pedantic under game folder) 2012-09-10 13:04:31 +02:00
Spp
8a1e7dd070 Core/Loading: Re-enable Server loading log 2012-08-16 00:23:44 +02:00
Spp
634776e0bc Fix compile under windows 2012-08-03 15:54:54 +02:00
Spp
55ce180f28 Core/Logging: Add Asyncronous logging with Loggers ("What to log") and Appenders ("Where to log") system. Will allow to select to full log some parts of core while others are not even logged.
- Logging System is asyncronous to improve performance.
- Each msg and Logger has a Log Type and Log Level assigned. Each msg is assigned the Logger of same Log Type or "root" Logger is selected if there is no Logger configured for the given Log Type
- Loggers have a list of Appenders to send the msg to. The Msg in the Logger is not sent to Appenders if the msg LogLevel is lower than Logger LogLevel.
- There are three (at the moment) types of Appenders: Console, File or DB (this is WIP, not working ATM). Msg is not written to the resource if msg LogLevel is lower than Appender LogLevel.
- Appender and Console Log levels can be changed while server is active with command '.set loglevel (a/l) name level'

Explanation of use with Sample config:

Appender.Console.Type=1       (1 = Console)
Appender.Console.Level=2      (2 = Debug)

Appender.Server.Type=2        (2 = File)
Appender.Server.Level=3       (3 = Info)
Appender.Server.File=Server.log

Appender.SQL.Type=2           (2 = File)
Appender.SQL.Level=1          (1 = Trace)
Appender.SQL.File=sql.log

Appenders=Console Server      (NOTE: SQL has not been included here... that will make core ignore the config for "SQL" as it's not in this list)

Logger.root.Type=0            (0 = Default - if it's not created by config, server will create it with LogLevel = DISABLED)
Logger.root.Level=5           (5 = Error)
Logger.root.Appenders=Console

Logger.SQL.Type=26            (26 = SQL)
Logger.SQL.Level=3            (2 = Debug)
Logger.SQL.Appenders=Console Server SQL

Logger.SomeRandomName.Type=24 (24 = Guild)
Logger.SomeRandomName.Level=5 (5 = Error)
Loggers=root SQL SomeRandomName

* At loading Appender SQL will be ignored, as it's not present on "Appenders"

* sLog->outDebug(LOG_FILTER_GUILD, "Some log msg related to Guilds")
  - Msg is sent to Logger of Type LOG_FILTER_GUILD (24). Logger with name SomeRandomName is found but it's LogLevel = 5 and Msg LogLevel=2... Msg is not logged

* sLog->outError(LOG_FILTER_GUILD, "Some error log msg related to Guilds")
  - Msg is sent to Logger of Type LOG_FILTER_GUILD (24). Logger with name SomeRandomeName is found with proper LogLevel but Logger does not have any Appenders assigned to that logger... Msg is not logged

* sLog->outDebug(LOG_FILTER_SQL, "Some msg related to SQLs")
  - Msg is sent to Logger SQL (matches type), as it matches LogLevel the msg is sent to Appenders Console, Server and SQL
    - Appender Console has lower Log Level: Msg is logged to Console
    - Appender Server has higher Log Level: Msg is not logged to file
    - Appender SQL has lower Log Level: Msg is logged to file sql.log

* sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Some msg related to Battelgrounds")
  - Msg is sent to Logger root (Type 0) as no Logger was found with Type LOG_FILTER_BATTLEGROUND (13). As Logger has higher LogLevel msg is not sent to any appender

* sLog->outError(LOG_FILTER_BATTLEGROUND, "Some error msg related to Battelgrounds")
  - Msg is sent to Logger root (Type 0) as no Logger was found with Type LOG_FILTER_BATTLEGROUND (13). Msg has lower LogLevel and is sent to Appender Console
    - Appender Console has lower LogLevel: Msg is logged to Console
2012-08-03 14:20:18 +02:00
Shauren
32aa983fe2 Core/Maps: Fixed possible crash when resetting instances 2012-06-08 14:52:52 +02:00
Shauren
c7775c8d72 Core/Maps: Moved object respawn time storage from global to map level. This removes unneccessary locking since all objects run within its map's thread. 2012-06-07 23:20:57 +02:00
Nay
5ebace6c7f Core/DBLayer: Fix issues in instance saving; spotted by Saring, thank you 2012-04-03 23:11:08 +01:00
Nay
f44e6834df Core/DBLayer: Fix remaining errors in loading world tables and a couple of them in characters database
Also removed World::LoadIp2nation(), it was not doing anything.
Closes #5897
2012-03-28 00:38:24 +01:00
leak
c6cbe4c77c Core/DBLayer: Convert PAppend() queries to prepared statements No.1 2012-03-25 16:25:06 +02:00
Elron103
7daf69f20c Core: Fix warnings 2012-03-24 18:25:24 +01:00
leak
178c658363 Core/DBLayer: Convert DirectExecute() queries that are not runtime relevant back to regular queries 2012-03-19 18:09:13 +01:00
kaelima
6d95e2408a Core/Protocol: And correct the struct of SMSG_UPDATE_INSTANCE_ENCOUNTER_UNIT... 2012-03-16 23:46:13 +01:00
kaelima
d810acdeea Core/InstanceScript: Encounterframe research - extended the EncounterFrameType enum 2012-03-16 23:16:49 +01:00
Spp
f1949b20a6 Some random cleanup here and there 2012-03-09 13:42:52 +01:00
Spp
03c34ee507 Fix a lot of warnings 2012-02-16 13:56:28 +01:00
leak
0fbb86f221 Core/DBLayer: Restore removal and cleanup of respawn times of expired instances 2012-01-30 00:31:06 +01:00
Shauren
e9b243991e Compile fix 2012-01-12 22:33:11 +01:00
Shauren
84c7eb5643 Core/Scripts: Fixed DoSendNotifyToInstance message formatting (that should only be done once) 2012-01-12 21:14:57 +01:00
leak
ced346076b Merge pull request #4567 from Kiperr/master
Happy new year!
2011-12-31 16:13:28 -08:00
leak
cdbeb42e0f Core/DBLayer: Refactor prepared statement defines to new format (char db) 2012-01-01 01:09:38 +01:00
kiper
8299627ed9 Update headers for 2012. HAPPY NEW YEAR!!! 2012-01-01 00:32:13 +01:00
leak
e646dbb3cd Core/DBLayer: Convert PExecute() queries to prepared statements No. 2 2011-12-27 00:29:48 +01:00
Shauren
358b33239a Core: Fixed remaining C6246: Local declaration of 'x' hides declaration of the same name in outer scope. from previous commit 2011-11-23 19:17:33 +01:00
megamage
5a0ffefecc Remove unnecessary const_cast<Map*>. 2011-11-23 12:51:20 -05:00