aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/World
diff options
context:
space:
mode:
authorNaios <naios-dev@live.de>2016-02-22 16:23:41 +0100
committerNaios <naios-dev@live.de>2016-02-22 16:25:54 +0100
commit9e43365b3d7817b128ecfc6bfd74f4b2b6fc7c69 (patch)
tree1f25c2b89aae6550ec7645211cd7903bcf346776 /src/server/scripts/World
parentb5369b7d874c337f49051f79dba9508f21a218de (diff)
Core/Scripts: Split the huge scriptloader into smaller pieces
* Each subdirectory contains it's own translation unit now which is responsible for loading it's directory * Improves merging & decoupling between 3.3.5 <-> 6.x * Removes unused Battleground loader * Ref #15671 (cherry picked from commit 5534915f743c707c07cb977bca67c2ff15487597)
Diffstat (limited to 'src/server/scripts/World')
-rw-r--r--src/server/scripts/World/CMakeLists.txt18
-rw-r--r--src/server/scripts/World/world_script_loader.cpp59
2 files changed, 59 insertions, 18 deletions
diff --git a/src/server/scripts/World/CMakeLists.txt b/src/server/scripts/World/CMakeLists.txt
deleted file mode 100644
index 17b3f2d8492..00000000000
--- a/src/server/scripts/World/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
-#
-# This file is free software; as a special exception the author gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-file(GLOB_RECURSE sources_World World/*.cpp World/*.h)
-
-set(scripts_STAT_SRCS
- ${scripts_STAT_SRCS}
- ${sources_World}
-)
-
-message(" -> Prepared: World")
diff --git a/src/server/scripts/World/world_script_loader.cpp b/src/server/scripts/World/world_script_loader.cpp
new file mode 100644
index 00000000000..0167024799f
--- /dev/null
+++ b/src/server/scripts/World/world_script_loader.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "World.h"
+
+// This is where scripts' loading functions should be declared:
+// world
+void AddSC_areatrigger_scripts();
+void AddSC_emerald_dragons();
+void AddSC_generic_creature();
+void AddSC_go_scripts();
+void AddSC_guards();
+void AddSC_item_scripts();
+void AddSC_npc_professions();
+void AddSC_npc_innkeeper();
+void AddSC_npcs_special();
+void AddSC_achievement_scripts();
+void AddSC_action_ip_logger();
+void AddSC_duel_reset();
+// player
+void AddSC_chat_log();
+void AddSC_action_ip_logger();
+
+// The name of this function should match:
+// void Add${NameOfDirectory}Scripts()
+void AddWorldScripts()
+{
+ AddSC_areatrigger_scripts();
+ AddSC_emerald_dragons();
+ AddSC_generic_creature();
+ AddSC_go_scripts();
+ AddSC_guards();
+ AddSC_item_scripts();
+ AddSC_npc_professions();
+ AddSC_npc_innkeeper();
+ AddSC_npcs_special();
+ AddSC_achievement_scripts();
+ AddSC_chat_log(); // location: scripts\World\chat_log.cpp
+
+ // FIXME: This should be moved in a script validation hook.
+ // To avoid duplicate code, we check once /*ONLY*/ if logging is permitted or not.
+ if (sWorld->getBoolConfig(CONFIG_IP_BASED_ACTION_LOGGING))
+ AddSC_action_ip_logger(); // location: scripts\World\action_ip_logger.cpp
+ AddSC_duel_reset();
+}