Skip to content

Commit fe470e4

Browse files
NtscNtsc
authored andcommitted
* NEW SQL: sql/Updates/r448_scriptdev2.sql for use on SD2 database.
* Rename: db_version to sd2_db_version. * Attempt: Allow generating of svn revision on unix based systems. * Added: Error output for EVENT_T_HP and EVENT_T_MANA where Min > 100 resulting in never occurring event. git-svn-id: https://scriptdev2.svn.sourceforge.net/svnroot/scriptdev2@448 5f9c896b-1e26-0410-94da-f77f675e2462
1 parent 5b0cc2c commit fe470e4

8 files changed

Lines changed: 77 additions & 36 deletions

File tree

Makefile.am

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
## Sub-directories to parse
2020
SUBDIRS = sql
2121

22+
BUILT_SOURCES = svn_revision.h
23+
CLEANFILES = svn_revision.h
2224
## CPP flags for includes, defines, etc.
2325
AM_CPPFLAGS = $(MYSQL_INCLUDES) -I$(srcdir) -I$(srcdir)/../../../dep/include -I$(srcdir)/../../shared/ -I$(srcdir)/../../framework/ -I$(srcdir)/../../game/ -I$(srcdir)/include/
2426

@@ -392,9 +394,15 @@ scripts/zone/zulgurub/boss_wushoolay.cpp \
392394
scripts/zone/zulgurub/def_zulgurub.h \
393395
scripts/zone/zulgurub/instance_zulgurub.cpp \
394396
scripts/zone/zulgurub/mobs_zulgurub.cpp \
397+
svn_revision.h \
395398
system.cpp
396399

397400

401+
## magic to include SVN revision number in SD2 version string
402+
svn_revision.h: FORCE tools/gensvnrevision/gensvnrevision
403+
+ tools/gensvnrevision/gensvnrevision
404+
+FORCE:
405+
398406
## libtool settings
399407
# API versioning
400408
# Link against dependencies

ScriptMgr.cpp

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ void LoadDatabase()
592592

593593
//Get Version information
594594
result = ScriptDev2DB.PQuery("SELECT `version`"
595-
"FROM `db_version`");
595+
"FROM `sd2_db_version`");
596596

597597
if (result)
598598
{
@@ -602,7 +602,7 @@ void LoadDatabase()
602602
outstring_log(" ");
603603
delete result;
604604

605-
}else error_log("SD2: Missing db_version information.");
605+
}else error_log("SD2: Missing sd2_db_version information.");
606606

607607
//Drop existing Localized Text has map
608608
Localized_Text_Map.clear();
@@ -725,12 +725,33 @@ void LoadDatabase()
725725
if (temp.event_chance == 0)
726726
error_log("SD2: Event %d has 0 percent chance. Event will never trigger!", i);
727727

728-
//Special check for EVENT_T_FRIENDLY_HP
729-
if (temp.event_type == EVENT_T_FRIENDLY_HP && temp.event_param3 < 2000)
728+
//Individual event checks
729+
switch (temp.event_type)
730730
{
731-
temp.event_param3 = 2000;
732-
error_log("SD2: Event %d has EVENT_T_FRIENDLY_HP with param3 (TimeUntilRepeat) < 2000 ms. Defaulted to 2000 ms to prevent lag. ", i);
733-
}
731+
case EVENT_T_HP:
732+
{
733+
if (temp.event_param2 > 100)
734+
error_log("SD2: Event %d has EVENT_T_HP with param2 (HpMinPercent) > 100. Event will never trigger! ", i);
735+
}
736+
break;
737+
738+
case EVENT_T_MANA:
739+
{
740+
if (temp.event_param2 > 100)
741+
error_log("SD2: Event %d has EVENT_T_MANA with param2 (ManaMinPercent) > 100. Event will never trigger! ", i);
742+
}
743+
break;
744+
745+
case EVENT_T_FRIENDLY_HP:
746+
{
747+
if (temp.event_param3 < 1000)
748+
{
749+
error_log("SD2 WARNING: Event %d has EVENT_T_FRIENDLY_HP with param3 (TimeUntilRepeat) < 1000 ms. Defaulted to 1000 ms to prevent possible lag. ", i);
750+
temp.event_param3 = 1000;
751+
}
752+
}
753+
break;
754+
};
734755

735756
for (uint32 j = 0; j < MAX_ACTIONS; j++)
736757
{
@@ -774,8 +795,8 @@ void LoadDatabase()
774795
SpellEntry const* pSpell = GetSpellStore()->LookupEntry(temp.action[j].param1);
775796
if (!pSpell)
776797
{
777-
error_log("SD2: Event %u Action %u uses non-existant SpellID %u", i, j, temp.action[j].param1);
778-
error_log("Spell Store Size = %u", GetSpellStore()->GetNumRows());
798+
error_log("SD2: Event %u Action %u uses non-existant SpellID %u.", i, j, temp.action[j].param1);
799+
error_log("Spell Store Size = %u.", GetSpellStore()->GetNumRows());
779800
}
780801
}
781802

VCProjToLinuxMake.exe

0 Bytes
Binary file not shown.

config.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@
2020
#define SC_CONFIG_H
2121

2222
#include "../../framework/Platform/CompilerDefs.h"
23-
24-
#ifdef WIN32
25-
#include "svn_revision.h"
26-
#else
27-
#define SVN_REVISION "246"
28-
#endif
23+
#include "svn_revision.h"
2924

3025
// Format is YYYYMMDDRR where RR is the change in the conf file
3126
// for that day.
@@ -40,11 +35,7 @@
4035
#endif
4136

4237
#ifndef _VERSION
43-
#if PLATFORM == PLATFORM_WIN32
44-
#define _VERSION "(Revision " SVN_REVISION ")"
45-
#else
46-
#define _VERSION "(Revision " SVN_REVISION ")"
47-
#endif
38+
#define _VERSION "(Revision [" SVN_REVISION "] " SVN_DATE ")"
4839
#endif
4940

5041
#if PLATFORM == PLATFORM_WINDOWS

sql/Updates/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,5 @@ pkgdata_DATA = \
153153
r431_mangos.sql \
154154
r444_mangos.sql \
155155
r445_mangos.sql \
156-
r446_mangos.sql
156+
r446_mangos.sql \
157+
r448_scriptdev2.sqp

sql/Updates/r448_scriptdev2.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
DROP TABLE IF EXISTS `db_version`;
2+
DROP TABLE IF EXISTS `sd2_db_version`;
3+
CREATE TABLE `sd2_db_version` (
4+
`version` varchar(255) NOT NULL default '' COMMENT 'Database version string'
5+
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

sql/scriptdev2_structure.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ CREATE TABLE `eventai_summons` (
5858
PRIMARY KEY (`id`)
5959
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Summoning Locations';
6060

61-
DROP TABLE IF EXISTS `db_version`;
62-
CREATE TABLE `db_version` (
61+
DROP TABLE IF EXISTS `sd2_db_version`;
62+
CREATE TABLE `sd2_db_version` (
6363
`version` varchar(255) NOT NULL default '' COMMENT 'Database version string'
6464
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

tools/gensvnrevision/gensvnrevision.cpp

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,43 @@
2323

2424
int main(int argc, char **argv)
2525
{
26-
FILE* EntriesFile = fopen(".svn\\entries", "r");
26+
FILE* EntriesFile = fopen(".svn/entries", "r");
2727
if(!EntriesFile)
28-
{
29-
fclose(EntriesFile);
3028
return 1;
31-
}
3229

3330
char buf[200];
3431
int revision;
3532
char date_str[200];
3633
char time_str[200];
3734

3835
fgets(buf,200,EntriesFile);
39-
fgets(buf,200,EntriesFile);
40-
fgets(buf,200,EntriesFile);
41-
fscanf(EntriesFile,"%i",&revision);
42-
fgets(buf,200,EntriesFile);
43-
fgets(buf,200,EntriesFile);
44-
fgets(buf,200,EntriesFile);
45-
fgets(buf,200,EntriesFile);
46-
fgets(buf,200,EntriesFile);
47-
fscanf(EntriesFile,"%10sT%8s",date_str,time_str);
36+
if (strstr(buf,"xml") > 0)
37+
{ // svn 1.3.x
38+
fgets(buf,200,EntriesFile);
39+
fgets(buf,200,EntriesFile);
40+
fgets(buf,200,EntriesFile);
41+
fgets(buf,200,EntriesFile);
42+
fgets(buf,200,EntriesFile);
43+
fscanf(EntriesFile," committed-date=\"%10sT%8s",date_str,time_str);
44+
fgets(buf,200,EntriesFile);
45+
fgets(buf,200,EntriesFile);
46+
fgets(buf,200,EntriesFile);
47+
fgets(buf,200,EntriesFile);
48+
fgets(buf,200,EntriesFile);
49+
fgets(buf,200,EntriesFile);
50+
fscanf(EntriesFile," revision=\"%i",&revision);
51+
} else
52+
{ // svn 1.4.x
53+
fgets(buf,200,EntriesFile);
54+
fgets(buf,200,EntriesFile);
55+
fscanf(EntriesFile,"%i",&revision);
56+
fgets(buf,200,EntriesFile);
57+
fgets(buf,200,EntriesFile);
58+
fgets(buf,200,EntriesFile);
59+
fgets(buf,200,EntriesFile);
60+
fgets(buf,200,EntriesFile);
61+
fscanf(EntriesFile,"%10sT%8s",date_str,time_str);
62+
}
4863

4964
std::ostringstream newData;
5065

0 commit comments

Comments
 (0)