mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[10950] Check for scripting lib that it build with exactly same mangos rev.
This prevent use outdated script DLL with hidden possible incompatibilities in used from core inline functions or defines.
This commit is contained in:
parent
0da3463758
commit
9ae7104251
10 changed files with 79 additions and 52 deletions
|
|
@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
|
||||||
`version` varchar(120) default NULL,
|
`version` varchar(120) default NULL,
|
||||||
`creature_ai_version` varchar(120) default NULL,
|
`creature_ai_version` varchar(120) default NULL,
|
||||||
`cache_id` int(10) default '0',
|
`cache_id` int(10) default '0',
|
||||||
`required_10949_01_mangos_mangos_string` bit(1) default NULL
|
`required_10950_01_mangos_mangos_string` bit(1) default NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
@ -3799,6 +3799,7 @@ INSERT INTO `mangos_string` VALUES
|
||||||
(1166,'Scripting library not found or not accessable.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(1166,'Scripting library not found or not accessable.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(1167,'Scripting library has wrong list functions (outdated?).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(1167,'Scripting library has wrong list functions (outdated?).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(1168,'Scripting library reloaded.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(1168,'Scripting library reloaded.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
(1169,'Scripting library build for different mangosd revision.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(1200,'You try to view cinemitic %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(1200,'You try to view cinemitic %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(1201,'You try to view movie %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
(1201,'You try to view movie %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||||
/*!40000 ALTER TABLE `mangos_string` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `mangos_string` ENABLE KEYS */;
|
||||||
|
|
|
||||||
6
sql/updates/10950_01_mangos_mangos_string.sql
Normal file
6
sql/updates/10950_01_mangos_mangos_string.sql
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
ALTER TABLE db_version CHANGE COLUMN required_10949_01_mangos_mangos_string required_10950_01_mangos_mangos_string bit;
|
||||||
|
|
||||||
|
DELETE FROM mangos_string WHERE entry IN (1169);
|
||||||
|
|
||||||
|
INSERT INTO mangos_string VALUES
|
||||||
|
(1169,'Scripting library build for different mangosd revision.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
|
# Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -142,6 +142,7 @@ pkgdata_DATA = \
|
||||||
10945_01_mangos_mangos_string.sql \
|
10945_01_mangos_mangos_string.sql \
|
||||||
10946_01_mangos_spell_proc_event.sql \
|
10946_01_mangos_spell_proc_event.sql \
|
||||||
10949_01_mangos_mangos_string.sql \
|
10949_01_mangos_mangos_string.sql \
|
||||||
|
10950_01_mangos_mangos_string.sql \
|
||||||
README
|
README
|
||||||
|
|
||||||
## Additional files to include when running 'make dist'
|
## Additional files to include when running 'make dist'
|
||||||
|
|
@ -264,4 +265,5 @@ EXTRA_DIST = \
|
||||||
10945_01_mangos_mangos_string.sql \
|
10945_01_mangos_mangos_string.sql \
|
||||||
10946_01_mangos_spell_proc_event.sql \
|
10946_01_mangos_spell_proc_event.sql \
|
||||||
10949_01_mangos_mangos_string.sql \
|
10949_01_mangos_mangos_string.sql \
|
||||||
|
10950_01_mangos_mangos_string.sql \
|
||||||
README
|
README
|
||||||
|
|
|
||||||
|
|
@ -888,7 +888,8 @@ enum MangosStrings
|
||||||
LANG_SCRIPTS_NOT_FOUND = 1166,
|
LANG_SCRIPTS_NOT_FOUND = 1166,
|
||||||
LANG_SCRIPTS_WRONG_API = 1167,
|
LANG_SCRIPTS_WRONG_API = 1167,
|
||||||
LANG_SCRIPTS_RELOADED_OK = 1168,
|
LANG_SCRIPTS_RELOADED_OK = 1168,
|
||||||
// Room for more level 3 1169-1199 not used
|
LANG_SCRIPTS_OUTDATED = 1169,
|
||||||
|
// Room for more level 3 1170-1199 not used
|
||||||
|
|
||||||
// Debug commands
|
// Debug commands
|
||||||
LANG_CINEMATIC_NOT_EXIST = 1200,
|
LANG_CINEMATIC_NOT_EXIST = 1200,
|
||||||
|
|
|
||||||
|
|
@ -940,16 +940,19 @@ bool ChatHandler::HandleLoadScriptsCommand(char* args)
|
||||||
|
|
||||||
switch(sScriptMgr.LoadScriptLibrary(args))
|
switch(sScriptMgr.LoadScriptLibrary(args))
|
||||||
{
|
{
|
||||||
case SCRIPT_LOAD_OK:
|
case SCRIPT_LOAD_OK:
|
||||||
sWorld.SendWorldText(LANG_SCRIPTS_RELOADED_ANNOUNCE);
|
sWorld.SendWorldText(LANG_SCRIPTS_RELOADED_ANNOUNCE);
|
||||||
SendSysMessage(LANG_SCRIPTS_RELOADED_OK);
|
SendSysMessage(LANG_SCRIPTS_RELOADED_OK);
|
||||||
break;
|
break;
|
||||||
case SCRIPT_LOAD_ERR_NOT_FOUND:
|
case SCRIPT_LOAD_ERR_NOT_FOUND:
|
||||||
SendSysMessage(LANG_SCRIPTS_NOT_FOUND);
|
SendSysMessage(LANG_SCRIPTS_NOT_FOUND);
|
||||||
break;
|
break;
|
||||||
case SCRIPT_LOAD_ERR_WRONG_API:
|
case SCRIPT_LOAD_ERR_WRONG_API:
|
||||||
SendSysMessage(LANG_SCRIPTS_WRONG_API);
|
SendSysMessage(LANG_SCRIPTS_WRONG_API);
|
||||||
break;
|
break;
|
||||||
|
case SCRIPT_LOAD_ERR_OUTDATED:
|
||||||
|
SendSysMessage(LANG_SCRIPTS_OUTDATED);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@
|
||||||
#include "WaypointManager.h"
|
#include "WaypointManager.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
|
#include "revision_nr.h"
|
||||||
|
|
||||||
ScriptMapMap sQuestEndScripts;
|
ScriptMapMap sQuestEndScripts;
|
||||||
ScriptMapMap sQuestStartScripts;
|
ScriptMapMap sQuestStartScripts;
|
||||||
ScriptMapMap sSpellScripts;
|
ScriptMapMap sSpellScripts;
|
||||||
|
|
@ -1044,45 +1046,53 @@ ScriptLoadResult ScriptMgr::LoadScriptLibrary(const char* libName)
|
||||||
if (!m_hScriptLib)
|
if (!m_hScriptLib)
|
||||||
return SCRIPT_LOAD_ERR_NOT_FOUND;
|
return SCRIPT_LOAD_ERR_NOT_FOUND;
|
||||||
|
|
||||||
GetScriptHookPtr(m_pOnInitScriptLibrary, "InitScriptLibrary");
|
# define GET_SCRIPT_HOOK_PTR(P,N) \
|
||||||
GetScriptHookPtr(m_pOnFreeScriptLibrary, "FreeScriptLibrary");
|
GetScriptHookPtr((P), (N)); \
|
||||||
GetScriptHookPtr(m_pGetScriptLibraryVersion, "GetScriptLibraryVersion");
|
if (!(P)) \
|
||||||
|
{ \
|
||||||
|
MANGOS_CLOSE_LIBRARY(m_hScriptLib); \
|
||||||
|
m_hScriptLib = NULL; \
|
||||||
|
return SCRIPT_LOAD_ERR_WRONG_API; \
|
||||||
|
}
|
||||||
|
|
||||||
GetScriptHookPtr(m_pGetCreatureAI, "GetCreatureAI");
|
// let check used mangosd revision for build library (unsafe use with different revision because changes in inline functions, define and etc)
|
||||||
GetScriptHookPtr(m_pCreateInstanceData, "CreateInstanceData");
|
char const* (MANGOS_IMPORT* pGetMangosRevStr) ();
|
||||||
|
|
||||||
GetScriptHookPtr(m_pOnGossipHello, "GossipHello");
|
GET_SCRIPT_HOOK_PTR(pGetMangosRevStr, "GetMangosRevStr");
|
||||||
GetScriptHookPtr(m_pOnGOGossipHello, "GOGossipHello");
|
|
||||||
GetScriptHookPtr(m_pOnGossipSelect, "GossipSelect");
|
|
||||||
GetScriptHookPtr(m_pOnGOGossipSelect, "GOGossipSelect");
|
|
||||||
GetScriptHookPtr(m_pOnGossipSelectWithCode, "GossipSelectWithCode");
|
|
||||||
GetScriptHookPtr(m_pOnGOGossipSelectWithCode, "GOGossipSelectWithCode");
|
|
||||||
GetScriptHookPtr(m_pOnQuestAccept, "QuestAccept");
|
|
||||||
GetScriptHookPtr(m_pOnGOQuestAccept, "GOQuestAccept");
|
|
||||||
GetScriptHookPtr(m_pOnItemQuestAccept, "ItemQuestAccept");
|
|
||||||
GetScriptHookPtr(m_pOnQuestRewarded, "QuestRewarded");
|
|
||||||
GetScriptHookPtr(m_pOnGOQuestRewarded, "GOQuestRewarded");
|
|
||||||
GetScriptHookPtr(m_pGetNPCDialogStatus, "GetNPCDialogStatus");
|
|
||||||
GetScriptHookPtr(m_pGetGODialogStatus, "GetGODialogStatus");
|
|
||||||
GetScriptHookPtr(m_pOnGOUse, "GOUse");
|
|
||||||
GetScriptHookPtr(m_pOnItemUse, "ItemUse");
|
|
||||||
GetScriptHookPtr(m_pOnAreaTrigger, "AreaTrigger");
|
|
||||||
GetScriptHookPtr(m_pOnProcessEvent, "ProcessEvent");
|
|
||||||
GetScriptHookPtr(m_pOnEffectDummyCreature, "EffectDummyCreature");
|
|
||||||
GetScriptHookPtr(m_pOnEffectDummyGO, "EffectDummyGameObject");
|
|
||||||
GetScriptHookPtr(m_pOnEffectDummyItem, "EffectDummyItem");
|
|
||||||
GetScriptHookPtr(m_pOnAuraDummy, "AuraDummy");
|
|
||||||
|
|
||||||
if (!m_pOnInitScriptLibrary || !m_pOnFreeScriptLibrary || !m_pGetScriptLibraryVersion ||
|
GET_SCRIPT_HOOK_PTR(m_pOnInitScriptLibrary, "InitScriptLibrary");
|
||||||
!m_pGetCreatureAI || !m_pCreateInstanceData ||
|
GET_SCRIPT_HOOK_PTR(m_pOnFreeScriptLibrary, "FreeScriptLibrary");
|
||||||
!m_pOnGossipHello || !m_pOnGOGossipHello || !m_pOnGossipSelect ||
|
GET_SCRIPT_HOOK_PTR(m_pGetScriptLibraryVersion, "GetScriptLibraryVersion");
|
||||||
!m_pOnGOGossipSelect || !m_pOnGossipSelectWithCode || !m_pOnGOGossipSelectWithCode ||
|
|
||||||
!m_pOnQuestAccept || !m_pOnGOQuestAccept || !m_pOnItemQuestAccept ||
|
GET_SCRIPT_HOOK_PTR(m_pGetCreatureAI, "GetCreatureAI");
|
||||||
!m_pOnQuestRewarded || !m_pOnGOQuestRewarded || !m_pGetNPCDialogStatus ||
|
GET_SCRIPT_HOOK_PTR(m_pCreateInstanceData, "CreateInstanceData");
|
||||||
!m_pGetGODialogStatus || !m_pOnGOUse || !m_pOnItemUse ||
|
|
||||||
!m_pOnAreaTrigger || !m_pOnProcessEvent || !m_pOnEffectDummyCreature ||
|
GET_SCRIPT_HOOK_PTR(m_pOnGossipHello, "GossipHello");
|
||||||
!m_pOnEffectDummyGO || !m_pOnEffectDummyItem || !m_pOnAuraDummy)
|
GET_SCRIPT_HOOK_PTR(m_pOnGOGossipHello, "GOGossipHello");
|
||||||
return SCRIPT_LOAD_ERR_WRONG_API;
|
GET_SCRIPT_HOOK_PTR(m_pOnGossipSelect, "GossipSelect");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnGOGossipSelect, "GOGossipSelect");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnGossipSelectWithCode, "GossipSelectWithCode");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnGOGossipSelectWithCode, "GOGossipSelectWithCode");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnQuestAccept, "QuestAccept");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnGOQuestAccept, "GOQuestAccept");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnItemQuestAccept, "ItemQuestAccept");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnQuestRewarded, "QuestRewarded");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnGOQuestRewarded, "GOQuestRewarded");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pGetNPCDialogStatus, "GetNPCDialogStatus");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pGetGODialogStatus, "GetGODialogStatus");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnGOUse, "GOUse");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnItemUse, "ItemUse");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnAreaTrigger, "AreaTrigger");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnProcessEvent, "ProcessEvent");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnEffectDummyCreature, "EffectDummyCreature");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnEffectDummyGO, "EffectDummyGameObject");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnEffectDummyItem, "EffectDummyItem");
|
||||||
|
GET_SCRIPT_HOOK_PTR(m_pOnAuraDummy, "AuraDummy");
|
||||||
|
|
||||||
|
# undef GET_SCRIPT_HOOK_PTR
|
||||||
|
|
||||||
|
if (strcmp(pGetMangosRevStr(), REVISION_NR) != 0)
|
||||||
|
return SCRIPT_LOAD_ERR_OUTDATED;
|
||||||
|
|
||||||
if (m_pOnInitScriptLibrary)
|
if (m_pOnInitScriptLibrary)
|
||||||
m_pOnInitScriptLibrary();
|
m_pOnInitScriptLibrary();
|
||||||
|
|
|
||||||
|
|
@ -308,7 +308,8 @@ enum ScriptLoadResult
|
||||||
{
|
{
|
||||||
SCRIPT_LOAD_OK,
|
SCRIPT_LOAD_OK,
|
||||||
SCRIPT_LOAD_ERR_NOT_FOUND,
|
SCRIPT_LOAD_ERR_NOT_FOUND,
|
||||||
SCRIPT_LOAD_ERR_WRONG_API
|
SCRIPT_LOAD_ERR_WRONG_API,
|
||||||
|
SCRIPT_LOAD_ERR_OUTDATED,
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScriptMgr
|
class ScriptMgr
|
||||||
|
|
|
||||||
|
|
@ -1261,6 +1261,9 @@ void World::SetInitialWorldSettings()
|
||||||
case SCRIPT_LOAD_ERR_WRONG_API:
|
case SCRIPT_LOAD_ERR_WRONG_API:
|
||||||
sLog.outError("Scripting library has wrong list functions (outdated?).");
|
sLog.outError("Scripting library has wrong list functions (outdated?).");
|
||||||
break;
|
break;
|
||||||
|
case SCRIPT_LOAD_ERR_OUTDATED:
|
||||||
|
sLog.outError("Scripting library build for old mangosd revision. You need rebuild it.");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
///- Initialize game time and timers
|
///- Initialize game time and timers
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10949"
|
#define REVISION_NR "10950"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef __REVISION_SQL_H__
|
#ifndef __REVISION_SQL_H__
|
||||||
#define __REVISION_SQL_H__
|
#define __REVISION_SQL_H__
|
||||||
#define REVISION_DB_CHARACTERS "required_10862_01_characters_mail"
|
#define REVISION_DB_CHARACTERS "required_10862_01_characters_mail"
|
||||||
#define REVISION_DB_MANGOS "required_10949_01_mangos_mangos_string"
|
#define REVISION_DB_MANGOS "required_10950_01_mangos_mangos_string"
|
||||||
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
|
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
|
||||||
#endif // __REVISION_SQL_H__
|
#endif // __REVISION_SQL_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue