summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-23 19:08:34 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-23 19:08:34 +0000
commit1fc61a4c982792d5d8b82568d5b8b93db267bc24 (patch)
treef285adbee49dc69597cb5177bd193ce7f31becf1 /src/map/pc.c
parente2ccee4d1aba838b8fc42a2c658a689b161751b1 (diff)
downloadhercules-1fc61a4c982792d5d8b82568d5b8b93db267bc24.tar.gz
hercules-1fc61a4c982792d5d8b82568d5b8b93db267bc24.tar.bz2
hercules-1fc61a4c982792d5d8b82568d5b8b93db267bc24.tar.xz
hercules-1fc61a4c982792d5d8b82568d5b8b93db267bc24.zip
- Updated the skill_db, some mob skills seem to be better to a range of -9 than 9.
- Corrected the pet_db information for Xmas Goblin and Rice Cake. - Replaced all struct map_session_data to TBL_PC in script.c - Pressure no longer vaporizes plants. - Corrected pc_setregstr to handle a null str argument. - Corrected @reloadbattleconf causing a add_timer_func "already existing function" error. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10326 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 16134845a..caf1a8944 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -6018,17 +6018,25 @@ int pc_setregstr(struct map_session_data *sd,int reg,char *str)
nullpo_retr(0, sd);
- if(strlen(str)+1 >= sizeof(sd->regstr[0].data)){
+ if(str && strlen(str)+1 >= sizeof(sd->regstr[0].data)){
ShowWarning("pc_setregstr: string too long !\n");
return 0;
}
for(i=0;i<sd->regstr_num;i++)
if(sd->regstr[i].index==reg){
- strcpy(sd->regstr[i].data,str);
+ if (str && strcmp(str,"")!=0)
+ strcpy(sd->regstr[i].data,str);
+ else { //Delete last entry.
+ sd->regstr_num--;
+ memcpy(&sd->regstr[i], &sd->regstr[sd->regstr_num], sizeof(sd->regstr[0]));
+ sd->regstr = (struct script_regstr *) aRealloc(sd->regstr, sizeof(sd->regstr[0]) * sd->regstr_num);
+ }
return 1;
}
+ if (!str) return 1;
+
sd->regstr_num++;
sd->regstr = (struct script_regstr *) aRealloc(sd->regstr, sizeof(sd->regstr[0]) * sd->regstr_num);
if(sd->regstr==NULL){
@@ -6233,7 +6241,7 @@ int pc_setregistry_str(struct map_session_data *sd,char *reg,char *val,int type)
}
// delete reg
- if (strcmp(val,"")==0) {
+ if (!val || strcmp(val,"")==0) {
for(i = 0; i < *max; i++) {
if (strcmp(sd_reg[i].str, reg) == 0) {
if (i != *max - 1)