summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-17 08:31:32 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-17 08:31:32 +0000
commit6b1b1974a10bb5ad8f69d9f84d7babcc370f9264 (patch)
treebad024738cb1a318420df132ac8b4fa9dc212a5f /src
parentcf21db7985cfaf093cca2a1d4bc3e43e7f145ff3 (diff)
downloadhercules-6b1b1974a10bb5ad8f69d9f84d7babcc370f9264.tar.gz
hercules-6b1b1974a10bb5ad8f69d9f84d7babcc370f9264.tar.bz2
hercules-6b1b1974a10bb5ad8f69d9f84d7babcc370f9264.tar.xz
hercules-6b1b1974a10bb5ad8f69d9f84d7babcc370f9264.zip
* Changes to Dissonance -- don't increment the timer again if the target has died
* Changed some nullpo checks back to normal null checks * Changed some nullpo checks to print some debug information * Added some sd checks before calling pc_blockskill * Added fix for SQL char's friend list updating * Fixed a crash if the player invited to join a guild is not online * Find the guild invitation sender first before clearing it git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1124 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/char_sql/char.c41
-rw-r--r--src/map/guild.c17
-rw-r--r--src/map/pc.c2
-rw-r--r--src/map/skill.c15
-rw-r--r--src/map/status.c14
5 files changed, 58 insertions, 31 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index 2f1979eb6..133d78296 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -622,24 +622,41 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
// Friends list
// account_id, friend_id0, name0, ...
+ #if 0
+ tmp_p += sprintf(tmp_p, "REPLACE INTO `%s` (`id`, `account_id`",friend_db);
- tmp_p += sprintf(tmp_p, "REPLACE INTO `%s` (`id`, `account_id`",friend_db);
+ diff = 0;
- diff = 0;
+ for (i=0;i<20;i++)
+ tmp_p += sprintf(tmp_p, ", `friend_id%d`, `name%d`", i, i);
- for (i=0;i<20;i++)
- tmp_p += sprintf(tmp_p, ", `friend_id%d`, `name%d`", i, i);
+ tmp_p += sprintf(tmp_p, ") VALUES (NULL, '%d'", char_id);
- tmp_p += sprintf(tmp_p, ") VALUES (NULL, '%d'", char_id);
+ for (i=0;i<20;i++) {
+ tmp_p += sprintf(tmp_p, ", '%d', '%s'", p->friend_id[i], p->friend_name[i]);
+ if ((p->friend_id[i] != cp->friend_id[i]) ||
+ strcmp(p->friend_name[i], cp->friend_name[i]))
+ diff = 1;
+ }
- for (i=0;i<20;i++) {
- tmp_p += sprintf(tmp_p, ", '%d', '%s'", p->friend_id[i], p->friend_name[i]);
- if ((p->friend_id[i] != cp->friend_id[i]) ||
- strcmp(p->friend_name[i], cp->friend_name[i]))
- diff = 1;
- }
+ tmp_p += sprintf(tmp_p, ")");
+ #else // [Dino9021]
+ tmp_p += sprintf(tmp_p, "UPDATE `%s` SET ",friend_db);
- tmp_p += sprintf(tmp_p, ")");
+ diff = 0;
+
+ for (i=0;i<20;i++) {
+ if (i>0)
+ tmp_p += sprintf(tmp_p, ", ");
+
+ tmp_p += sprintf(tmp_p, "`friend_id%d`='%d', `name%d`='%s'", i, p->friend_id[i], i, p->friend_name[i]);
+
+ if ((p->friend_id[i] != cp->friend_id[i]) || strcmp(p->friend_name[i], cp->friend_name[i]))
+ diff = 1;
+ }
+
+ tmp_p += sprintf(tmp_p, " where account_id='%d';", char_id);
+ #endif
if (diff)
mysql_query(&mysql_handle, tmp_sql);
diff --git a/src/map/guild.c b/src/map/guild.c
index 72bf302f0..ed3eda3ba 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -581,17 +581,18 @@ int guild_member_added(int guild_id,int account_id,int char_id,int flag)
if( (g=guild_search(guild_id))==NULL )
return 0;
- if((sd==NULL || sd->guild_invite==0) && flag==0){
+ if(sd==NULL || sd->guild_invite==0){
// キャラ側に登録できなかったため脱退要求を出す
- if(battle_config.error_log)
- printf("guild: member added error %d is not online\n",account_id);
- intif_guild_leave(guild_id,account_id,char_id,0,"**登録失敗**");
+ if (flag == 0) {
+ if(battle_config.error_log)
+ printf("guild: member added error %d is not online\n",account_id);
+ intif_guild_leave(guild_id,account_id,char_id,0,"**登録失敗**");
+ }
return 0;
}
- sd->guild_invite=0;
- sd->guild_invite_account=0;
-
- sd2=map_id2sd(sd->guild_invite_account);
+ sd2 = map_id2sd(sd->guild_invite_account);
+ sd->guild_invite = 0;
+ sd->guild_invite_account = 0;
if(flag==1){ // 失敗
if( sd2!=NULL )
diff --git a/src/map/pc.c b/src/map/pc.c
index 3d40da95a..87ad099ac 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -3114,7 +3114,7 @@ static int pc_walk(int tid,unsigned int tick,int id,int data)
int moveblock;
int x,y,dx,dy;
- nullpo_retr(0, (sd=map_id2sd(id)));
+ nullpo_retr_f(0, (sd=map_id2sd(id)), "id=%d", id);
if(sd->walktimer != tid){
if(battle_config.error_log)
diff --git a/src/map/skill.c b/src/map/skill.c
index e4b171636..61cd89ebd 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2823,7 +2823,8 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s
clif_updatestatus(sd,SP_SP);
}
}
- pc_blockskill_start (sd, skillid, (skilllv < 5 ? 10000: 15000));
+ if (sd)
+ pc_blockskill_start (sd, skillid, (skilllv < 5 ? 10000: 15000));
}
break;
@@ -3305,7 +3306,8 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
case SM_ENDURE: /* インデュア */
clif_skill_nodamage(src,bl,skillid,skilllv,1);
status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 );
- pc_blockskill_start (sd, skillid, 10000);
+ if (sd)
+ pc_blockskill_start (sd, skillid, 10000);
break;
case SM_AUTOBERSERK: // Celest
@@ -5039,7 +5041,8 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil
pc_movepos(sd,x,y);
}else if( src->type==BL_MOB )
mob_warp((struct mob_data *)src,-1,x,y,0);
- pc_blockskill_start (sd, MO_EXTREMITYFIST, 2000);
+ if (sd)
+ pc_blockskill_start (sd, MO_EXTREMITYFIST, 2000);
break;
case AM_CANNIBALIZE: // バイオプラント
if(sd){
@@ -7718,10 +7721,12 @@ int skill_use_id( struct map_session_data *sd, int target_id,
case WE_FEMALE:
{
struct map_session_data *p_sd = pc_get_partner(sd);
- nullpo_retr (0, p_sd)
+ if (p_sd == NULL) // it's possible to get null if we're not married ^^;
+ return 0;
+ // nullpo_retr (0, p_sd)
if(skill_num == WE_MALE && sd->status.hp <= ((15*sd->status.max_hp)/100)) // Requires more than 15% of Max HP for WE_MALE
return 0;
- if(skill_num == WE_FEMALE && sd->status.sp <= ((15*sd->status.max_sp)/100)) // Requires more than 15% of Max SP for WE_FEMALE
+ else if(skill_num == WE_FEMALE && sd->status.sp <= ((15*sd->status.max_sp)/100)) // Requires more than 15% of Max SP for WE_FEMALE
return 0;
target_id = p_sd->bl.id;
//rangeをもう1回?査
diff --git a/src/map/status.c b/src/map/status.c
index 55f4326f9..412308f59 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -3997,13 +3997,13 @@ int status_change_end( struct block_list* bl , int type,int tid )
*/
int status_change_timer(int tid, unsigned int tick, int id, int data)
{
- int type=data;
+ int type = data;
struct block_list *bl;
struct map_session_data *sd=NULL;
struct status_change *sc_data;
//short *sc_count; //使ってない?
- nullpo_retr(0, bl=map_id2bl(id));
+ nullpo_retr_f(0, bl=map_id2bl(id), "id=%d data=%d",id,data);
nullpo_retr(0, sc_data=status_get_sc_data(bl));
if(bl->type==BL_PC)
@@ -4104,8 +4104,10 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
case SC_WATERBALL: /* ウォ?タ?ボ?ル */
{
struct block_list *target=map_id2bl(sc_data[type].val2);
- nullpo_retb(target);
- nullpo_retb(target->prev);
+ if (!target || !target->prev)
+ break; // target has been killed in previous hits, no need to raise an alarm ^^;
+ // nullpo_retb(target);
+ // nullpo_retb(target->prev);
skill_attack(BF_MAGIC,bl,bl,target,WZ_WATERBALL,sc_data[type].val1,tick,0);
if((--sc_data[type].val3)>0) {
sc_data[type].timer=add_timer( 150+tick,status_change_timer, bl->id, data );
@@ -4139,8 +4141,10 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
break;*/
nullpo_retb(unit);
nullpo_retb(unit->group);
- nullpo_retr(0, src=map_id2bl(unit->group->src_id));
+ nullpo_retb(src=map_id2bl(unit->group->src_id));
skill_attack(BF_MISC,src,&unit->bl,bl,unit->group->skill_id,sc_data[type].val1,tick,0);
+ if( (bl->type==BL_MOB) && (MS_DEAD==((struct mob_data *)bl)->state.state) )
+ break;
sc_data[type].timer=add_timer(skill_get_time2(unit->group->skill_id,unit->group->skill_lv)+tick,
status_change_timer, bl->id, data );
return 0;