summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt3
-rw-r--r--src/map/pc.c10
-rw-r--r--src/map/script.c4
3 files changed, 13 insertions, 4 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index b186aed0d..4fe7ec17d 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,9 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+2007/07/07
+ * Fixed typo in 'deletearray' messing up the script engine
+ * Added a check to pc_skill() to prevent crashes on unknown skill ids
2007/07/06
* Cleaned up some nasty code related to skill_blown
- split 'direction' value from flags
diff --git a/src/map/pc.c b/src/map/pc.c
index 79a898cff..49d880767 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2494,11 +2494,17 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag)
{
nullpo_retr(0, sd);
- if( level > MAX_SKILL_LEVEL ){
+ if( id <= 0 || id >= MAX_SKILL || skill_db[id].name == NULL) {
if( battle_config.error_log )
- ShowError("pc_skill: Skill level %d too high. Max lv supported is MAX_SKILL_LEVEL (%d)\n", level, MAX_SKILL_LEVEL);
+ ShowError("pc_skill: Skill with id %d does not exist in the skill database\n", id);
return 0;
}
+ if( level > MAX_SKILL_LEVEL ) {
+ if( battle_config.error_log )
+ ShowError("pc_skill: Skill level %d too high. Max lv supported is %d\n", level, MAX_SKILL_LEVEL);
+ return 0;
+ }
+
switch( flag ){
case 0: //Set skill data overwriting whatever was there before.
sd->status.skill[id].id = id;
diff --git a/src/map/script.c b/src/map/script.c
index cfe0ce1b0..a4e348083 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5758,12 +5758,12 @@ BUILDIN_FUNC(deletearray)
if( is_string_variable(name) )
{
for( ; start < end; ++start )
- set_reg(st, sd, reference_uid(id, start), name, (void*)0, reference_getref(data));
+ set_reg(st, sd, reference_uid(id, start), name, (void *)"", reference_getref(data));
}
else
{
for( ; start < end; ++start )
- set_reg(st, sd, reference_uid(id, start), name, (void *)"", reference_getref(data));
+ set_reg(st, sd, reference_uid(id, start), name, (void*)0, reference_getref(data));
}
return 0;
}