Commit Graph

11 Commits

Author SHA1 Message Date
Anubisss
5c596f32d4 Generate an error message when forgot to allocate memory for a script.
This message is useful to find don't allocated scripts, like in rev r5915a3a871.

--HG--
branch : trunk
2010-05-14 20:07:45 +02:00
Anubisss
10bf921a65 Generate an error message when core tries to assign a script's ScriptName which is already assigned.
This means if that happened the core override the older script.
As a result, the earlier one doesn't work and can't deallocate so generates memory leak.

This commit also fixes memory leaks caused by that.

Valgrind log:

==4753== 354 (312 direct, 42 indirect) bytes in 1 blocks are definitely lost in loss record 1,194 of 1,218
==4753==    at 0x4C2626C: operator new(unsigned long) (vg_replace_malloc.c:230)
==4753==    by 0x1039D85: AddSC_go_scripts() (go_scripts.cpp:1015)
==4753==    by 0xDC196F: AddScripts() (ScriptLoader.cpp:534)
==4753==    by 0xC19943: ScriptMgr::ScriptsInit() (ScriptMgr.cpp:70)
==4753==    by 0xD1CCAE: World::SetInitialWorldSettings() (World.cpp:1608)
==4753==    by 0x9100A6: Master::Run() (Master.cpp:234)
==4753==    by 0x90F5D6: main (Main.cpp:146)

--HG--
branch : trunk
2010-05-13 14:15:11 +02:00
Anubisss
8223af6576 Delete ALL scripts which not assigned instead of delete scripts which not assigned AND its ScriptName not contains the word "example", in Script::RegisterSelf().
So fixes memleaks in scripts which scriptname contains the "example" word AND not assigned(ScriptName column in DB) to an object.

This ones fixed: example_creature, example_escort, example_areatrigger, example_item, example_go_teleporter, example_gossip_codebox.

Some valgrind log: :)

==31592== 353 (312 direct, 41 indirect) bytes in 1 blocks are definitely lost in loss record 280 of 1,232
==31592==    at 0x4C2626C: operator new(unsigned long) (vg_replace_malloc.c:230)
==31592==    by 0xEFAC8A: AddSC_example_creature() (example_creature.cpp:286)
==31592==    by 0xDC047A: AddScripts() (ScriptLoader.cpp:523)
==31592==    by 0xC183F3: ScriptMgr::ScriptsInit() (ScriptMgr.cpp:70)
==31592==    by 0xD1B75F: World::SetInitialWorldSettings() (World.cpp:1608)
==31592==    by 0x90F34E: Master::Run() (Master.cpp:234)
==31592==    by 0x90E87E: main (Main.cpp:146)
==31592==
==31592==
==31592== 351 (312 direct, 39 indirect) bytes in 1 blocks are definitely lost in loss record 281 of 1,232
==31592==    at 0x4C2626C: operator new(unsigned long) (vg_replace_malloc.c:230)
==31592==    by 0xEFB426: AddSC_example_escort() (example_escort.cpp:223)
==31592==    by 0xDC047F: AddScripts() (ScriptLoader.cpp:524)
==31592==    by 0xC183F3: ScriptMgr::ScriptsInit() (ScriptMgr.cpp:70)
==31592==    by 0xD1B75F: World::SetInitialWorldSettings() (World.cpp:1608)
==31592==    by 0x90F34E: Master::Run() (Master.cpp:234)
==31592==    by 0x90E87E: main (Main.cpp:146)
==31592==
==31592==
==31592== 359 (312 direct, 47 indirect) bytes in 1 blocks are definitely lost in loss record 282 of 1,232
==31592==    at 0x4C2626C: operator new(unsigned long) (vg_replace_malloc.c:230)
==31592==    by 0xEFBCB6: AddSC_example_gossip_codebox() (example_gossip_codebox.cpp:93)
==31592==    by 0xDC0484: AddScripts() (ScriptLoader.cpp:525)
==31592==    by 0xC183F3: ScriptMgr::ScriptsInit() (ScriptMgr.cpp:70)
==31592==    by 0xD1B75F: World::SetInitialWorldSettings() (World.cpp:1608)
==31592==    by 0x90F34E: Master::Run() (Master.cpp:234)
==31592==    by 0x90E87E: main (Main.cpp:146)
==31592==
==31592==
==31592== 358 (312 direct, 46 indirect) bytes in 1 blocks are definitely lost in loss record 283 of 1,232
==31592==    at 0x4C2626C: operator new(unsigned long) (vg_replace_malloc.c:230)
==31592==    by 0xEFC04B: AddSC_example_misc() (example_misc.cpp:65)
==31592==    by 0xDC0489: AddScripts() (ScriptLoader.cpp:526)
==31592==    by 0xC183F3: ScriptMgr::ScriptsInit() (ScriptMgr.cpp:70)
==31592==    by 0xD1B75F: World::SetInitialWorldSettings() (World.cpp:1608)
==31592==    by 0x90F34E: Master::Run() (Master.cpp:234)
==31592==    by 0x90E87E: main (Main.cpp:146)
==31592==
==31592==
==31592== 356 (312 direct, 44 indirect) bytes in 1 blocks are definitely lost in loss record 501 of 1,232
==31592==    at 0x4C2626C: operator new(unsigned long) (vg_replace_malloc.c:230)
==31592==    by 0xEFBF96: AddSC_example_misc() (example_misc.cpp:55)
==31592==    by 0xDC0489: AddScripts() (ScriptLoader.cpp:526)
==31592==    by 0xC183F3: ScriptMgr::ScriptsInit() (ScriptMgr.cpp:70)
==31592==    by 0xD1B75F: World::SetInitialWorldSettings() (World.cpp:1608)
==31592==    by 0x90F34E: Master::Run() (Master.cpp:234)
==31592==    by 0x90E87E: main (Main.cpp:146)
==31592==
==31592==
==31592== 349 (312 direct, 37 indirect) bytes in 1 blocks are definitely lost in loss record 1,209 of 1,232
==31592==    at 0x4C2626C: operator new(unsigned long) (vg_replace_malloc.c:230)
==31592==    by 0xEFBFDB: AddSC_example_misc() (example_misc.cpp:60)
==31592==    by 0xDC0489: AddScripts() (ScriptLoader.cpp:526)
==31592==    by 0xC183F3: ScriptMgr::ScriptsInit() (ScriptMgr.cpp:70)
==31592==    by 0xD1B75F: World::SetInitialWorldSettings() (World.cpp:1608)
==31592==    by 0x90F34E: Master::Run() (Master.cpp:234)
==31592==    by 0x90E87E: main (Main.cpp:146)

--HG--
branch : trunk
2010-05-12 23:30:41 +02:00
Spp
d19e127080 Code style (game + scripts only):
"if(" --> "if ("

--HG--
branch : trunk
2010-04-07 19:14:10 +02:00
Spp
b27ce42704 Code Style: Remove trailing spaces
--HG--
branch : trunk
2010-04-07 18:09:10 +02:00
Xanadu
f8d1920fa5 Yet more cleanup, mostly in the script system. This should conclude the script integration into core.
--HG--
branch : trunk
2010-02-05 13:01:32 +01:00
Rat
f10cb92298 *merge ScriptMgr::LoadOverridenDBCData to SpellMgrLoadSpellCustomAttr, patch by Azuritus, closes issue #444
--HG--
branch : trunk
2010-01-24 11:45:50 +01:00
XTZGZoReX
fe07518baf * Partly revert [7173]. The log call is useful - "CRASH ALERT" part removed.
--HG--
branch : trunk
2010-01-23 20:08:44 +01:00
arcanzic
c827f58d93 Remove useless spam at core boot. I have never seen, nor heard of a script not assigned to a npc, crashing the core.
--HG--
branch : trunk
2010-01-23 13:00:06 -06:00
Rat
ac6ef84ac4 *cleanup #1 after script merge
--HG--
branch : trunk
2010-01-19 15:55:31 +01:00
Rat
0cc053ea4d *Integrate Script system to Core
-added ScriptMgr for loading scripts
-removed bindings
-moved script system to src/game
-moved scripts to src/scripts
-VC project files updated
-cmakes updated (not 100% done yet)

NOTE to Devs:
-file locations changed
-precompiled renamed to ScriptedPch
-ecsort_ai renamed to ScriptedEscortAI
-follower_ai renamed to ScriptedFollowerAI
-guard_ai renamed to ScriptedGuardAI
-simple_ai renamed to ScriptedSimpleAI
-sc_creature renamed to ScriptedCreature
-sc_gossip renamed to ScriptedGossip
-sc_instance  renamed to ScriptedInstance

*use the new headers in scripts, thank you

NOTE to ALL:
cmake not fully tested, please report any errors with it
could make creashes, incompability
USE AT YOUR OWN RISK before further tests!!

--HG--
branch : trunk
2010-01-19 11:36:05 +01:00