From abb8b0a2cd5577cce954f638dca5fa3f371391fb Mon Sep 17 00:00:00 2001
From: Chuck Miller <shadowmil@gmail.com>
Date: Wed, 13 May 2009 17:14:05 -0400
Subject: Cleans up the net code for effects

Removes the 0x1f3 packet since its the same as 0x19b packet, and our
client doesn't handle 0x1f3.
---
 src/map/atcommand.c |  2 +-
 src/map/clif.c      | 24 ++++--------------------
 src/map/clif.h      |  1 -
 src/map/script.c    |  4 ++--
 4 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 374db77..c96b8d7 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -6740,7 +6740,7 @@ int atcommand_summon(const int fd, struct map_session_data* sd, const char* comm
 		md->state.special_mob_ai=1;
 		md->mode=mob_db[md->class].mode|0x04;
 		md->deletetimer=add_timer(tick+60000,mob_timer_delete,id,0);
-		clif_misceffect2(&md->bl,344);
+		clif_misceffect(&md->bl,344);
 	}
 	clif_skill_poseffect(&sd->bl,AM_CALLHOMUN,1,x,y,tick);
 
diff --git a/src/map/clif.c b/src/map/clif.c
index e053357..aa0fff9 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -2564,22 +2564,6 @@ int clif_misceffect(struct block_list* bl,int type)
 
 	return 0;
 }
-int clif_misceffect2(struct block_list *bl, int type) {
-	unsigned char buf[24];
-
-	nullpo_retr(0, bl);
-
-	memset(buf, 0, packet_len_table[0x1f3]);
-
-	WBUFW(buf,0) = 0x1f3;
-	WBUFL(buf,2) = bl->id;
-	WBUFL(buf,6) = type;
-
-	clif_send(buf, packet_len_table[0x1f3], bl, AREA);
-
-	return 0;
-
-}
 /*==========================================
  * �\���I�v�V�����ύX
  *------------------------------------------
@@ -6082,9 +6066,9 @@ int clif_specialeffect(struct block_list *bl, int type, int flag) {
 
 	nullpo_retr(0, bl);
 
-	memset(buf, 0, packet_len_table[0x1f3]);
+	memset(buf, 0, packet_len_table[0x19b]);
 
-	WBUFW(buf,0) = 0x1f3;
+	WBUFW(buf,0) = 0x19b;
 	WBUFL(buf,2) = bl->id;
 	WBUFL(buf,6) = type;
 
@@ -6098,9 +6082,9 @@ int clif_specialeffect(struct block_list *bl, int type, int flag) {
 	}
 	
 	else if (flag==1)
-		clif_send(buf, packet_len_table[0x1f3], bl, SELF);
+		clif_send(buf, packet_len_table[0x19b], bl, SELF);
 	else if (!flag)
-		clif_send(buf, packet_len_table[0x1f3], bl, AREA);
+		clif_send(buf, packet_len_table[0x19b], bl, AREA);
 
 	return 0;
 
diff --git a/src/map/clif.h b/src/map/clif.h
index 078d1a6..198bbff 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -70,7 +70,6 @@ int clif_statusupack(struct map_session_data *,int,int,int);	// self
 int clif_equipitemack(struct map_session_data *,int,int,int);	// self
 int clif_unequipitemack(struct map_session_data *,int,int,int);	// self
 int clif_misceffect(struct block_list*,int);	// area
-int clif_misceffect2(struct block_list *bl,int type);
 int clif_changeoption(struct block_list*);	// area
 int clif_useitemack(struct map_session_data*,int,int,int);	// self
 
diff --git a/src/map/script.c b/src/map/script.c
index d731b3f..5c3528e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5523,11 +5523,11 @@ int buildin_misceffect(struct script_state *st)
 
 	type=conv_num(st,& (st->stack->stack_data[st->start+2]));
 	if(st->oid)
-		clif_misceffect2(map_id2bl(st->oid),type);
+		clif_misceffect(map_id2bl(st->oid),type);
 	else{
 		struct map_session_data *sd=script_rid2sd(st);
 		if(sd)
-			clif_misceffect2(&sd->bl,type);
+			clif_misceffect(&sd->bl,type);
 	}
 	return 0;
 }
-- 
cgit v1.2.3-70-g09d2


From 94a8a08118ecd9e358d794d430945ada248d0959 Mon Sep 17 00:00:00 2001
From: MadCamel <madcamel@gmail.com>
Date: Wed, 13 May 2009 15:41:18 -0400
Subject: Fixed all compiler warnings and several small bugs in the process

---
 src/char/char.c     |  1 -
 src/map/atcommand.c |  4 ++--
 src/map/battle.c    |  2 ++
 src/map/chrif.h     |  1 +
 src/map/clif.c      | 16 ++++++++--------
 src/map/itemdb.c    |  3 ++-
 src/map/pc.c        |  2 +-
 src/map/script.c    |  9 ++++++---
 src/map/skill.c     |  4 ++--
 src/map/tmw.c       |  2 --
 10 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/src/char/char.c b/src/char/char.c
index e82c955..4717479 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -1491,7 +1491,6 @@ int disconnect_player(int accound_id) {
 
 // �L�����폜�ɔ����f�[�^�폜
 static int char_delete(struct mmo_charstatus *cs) {
-	int j;
 
 	// �M���h�E��
 	if (cs->guild_id)
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index c96b8d7..85ff15c 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -574,7 +574,7 @@ void log_atcommand(struct map_session_data *sd, const char *fmt, ...)
 		sprintf(fullname, "%s.%04d-%02d", gm_logfile_name, year, month);
 
 		if (gm_logfile)
-			close(gm_logfile);
+			fclose(gm_logfile);
 
 		gm_logfile = fopen(fullname, "a");
 		free(fullname);
@@ -7011,7 +7011,7 @@ int atcommand_jump_iterate(
 
 	memset(output, '\0', sizeof(output));
 
-        pl_sd = map_id2bl(sd->followtarget);
+        pl_sd = (struct map_session_data*)map_id2bl(sd->followtarget);
 
         if (pl_sd)
                 pl_sd = get_next(pl_sd);
diff --git a/src/map/battle.c b/src/map/battle.c
index f822c10..45524e5 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3792,6 +3792,8 @@ struct Damage battle_calc_attack(	int attack_type,
 	struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int flag)
 {
 	struct Damage d;
+	memset(&d, 0, sizeof(d));
+
 	switch(attack_type){
 	case BF_WEAPON:
 		return battle_calc_weapon_attack(bl,target,skill_num,skill_lv,flag);
diff --git a/src/map/chrif.h b/src/map/chrif.h
index 19d725d..2a7b35e 100644
--- a/src/map/chrif.h
+++ b/src/map/chrif.h
@@ -23,6 +23,7 @@ int chrif_saveaccountreg2(struct map_session_data *sd);
 int chrif_reloadGMdb(void);
 int chrif_ragsrvinfo(int base_rate,int job_rate, int drop_rate);
 int chrif_char_offline(struct map_session_data *sd);
+int chrif_send_divorce(int char_id);
 
 int do_init_chrif(void);
 
diff --git a/src/map/clif.c b/src/map/clif.c
index aa0fff9..e5fa002 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -676,6 +676,7 @@ int clif_clearchar_id(int id, int type, int fd) {
 	return 0;
 }
 
+/*
 static int current_weapon(struct map_session_data *sd)
 {
         if (sd->attack_spell_override)
@@ -684,6 +685,7 @@ static int current_weapon(struct map_session_data *sd)
                 return sd->status.weapon;
         }
 }
+*/
 
 /*==========================================
  *
@@ -3048,7 +3050,7 @@ int clif_updatestorageamount(struct map_session_data *sd,struct storage *stor)
  */
 int clif_storageitemadded(struct map_session_data *sd,struct storage *stor,int index,int amount)
 {
-	int view,fd,j;
+	int fd,j;
 
 	nullpo_retr(0, sd);
 	nullpo_retr(0, stor);
@@ -3256,8 +3258,8 @@ void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* ds
 	if(sd->status.manner < 0)
 		clif_changestatus(&sd->bl,SP_MANNER,sd->status.manner);
 
-        clif_changelook_accessories(sd, dstsd);
-        clif_changelook_accessories(dstsd, sd);
+        clif_changelook_accessories(&sd->bl, dstsd);
+        clif_changelook_accessories(&dstsd->bl, sd);
 }
 
 /*==========================================
@@ -3343,7 +3345,7 @@ int clif_fixpcpos(struct map_session_data *sd)
 		len = clif_set0078(sd,buf);
 		clif_send(buf,len,&sd->bl,AREA);
 	}
-        clif_changelook_accessories(sd, NULL);
+        clif_changelook_accessories(&sd->bl, NULL);
 
 	return 0;
 }
@@ -6413,9 +6415,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) {
 		WFIFOSET(fd,packet_len_table[0x95]);
 		if (ssd->special_state.heal_effect)
 		{
-			unsigned char buf[16];
-
-			nullpo_retr(0, bl);
+			nullpo_retv(bl);
 
 			WFIFOW(fd,0)=0x0196;
 			WFIFOW(fd,2)=SC_HEALING;
@@ -6584,7 +6584,7 @@ void clif_parse_ChangeDir(int fd, struct map_session_data *sd) {
 
 	nullpo_retv(sd);
 
-	RFIFOW(fd,2); //skip
+//	RFIFOW(fd,2); // Apparently does nothing?
 	dir = RFIFOB(fd,4);
 
 	pc_setdir(sd, dir);
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index d9f77d3..0acf181 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -383,7 +383,8 @@ static int itemdb_read_randomitem()
 		struct random_item_data *pd=data[i].pdata;
 		int *pc=data[i].pcount;
 		int *pdefault=data[i].pdefault;
-		char *fn=data[i].filename;
+		const char *fn=data[i].filename;
+
 
 		*pdefault = 0;
 		if( (fp=fopen(fn,"r"))==NULL ){
diff --git a/src/map/pc.c b/src/map/pc.c
index cf1e101..9703ee0 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -17,6 +17,7 @@
 #include "chat.h"
 #include "chrif.h"
 #include "clif.h"
+#include "guild.h"
 #include "intif.h"
 #include "itemdb.h"
 #include "map.h"
@@ -1069,7 +1070,6 @@ int pc_calcstatus(struct map_session_data* sd,int first)
 	struct skill b_skill[MAX_SKILL];
 	int i,bl,index;
 	int skill,aspd_rate,wele,wele_,def_ele,refinedef=0;
-	int pele=0,pdef_ele=0;
 	int str,dstr,dex;
 	struct pc_base_job s_class;
 
diff --git a/src/map/script.c b/src/map/script.c
index 5c3528e..cbbb13f 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -13,6 +13,7 @@
 #endif
 
 #include <time.h>
+#include <math.h>
 
 #include "socket.h"
 #include "timer.h"
@@ -25,6 +26,7 @@
 #include "chrif.h"
 #include "clif.h"
 #include "db.h"
+#include "guild.h"
 #include "intif.h"
 #include "itemdb.h"
 #include "lock.h"
@@ -3163,7 +3165,7 @@ int buildin_skill(struct script_state *st)
  */
 int buildin_setskill(struct script_state *st)
 {
-	int id,level,flag=1;
+	int id,level;
 	struct map_session_data *sd;
 
 	id=conv_num(st,& (st->stack->stack_data[st->start+2]));
@@ -3174,6 +3176,7 @@ int buildin_setskill(struct script_state *st)
         sd->status.skill[id].lv = level;
         sd->status.skill[id].flag = 0;
         clif_skillinfoblock(sd);
+	return 0;
 }
 
 /*==========================================
@@ -5879,7 +5882,6 @@ int buildin_shop(struct script_state *st)
 {
 	struct map_session_data *sd=script_rid2sd(st);
 	struct npc_data *nd;
-	char *str;
 
 	if (!sd)
 		return 1;
@@ -5902,6 +5904,7 @@ int buildin_isdead(struct script_state *st)
 	struct map_session_data *sd=script_rid2sd(st);
 
         push_val(st->stack, C_INT, pc_isdead(sd));
+	return 0;
 }
 
 //
@@ -6387,7 +6390,7 @@ int run_script_main(unsigned char *script,int pos,int rid,int oid,struct script_
  */
 int run_script(unsigned char *script,int pos,int rid,int oid)
 {
-        run_script_l(script, pos, rid, oid, 0, NULL);
+        return run_script_l(script, pos, rid, oid, 0, NULL);
 }
 
 int run_script_l(unsigned char *script,int pos,int rid,int oid, int args_nr, argrec_t *args)
diff --git a/src/map/skill.c b/src/map/skill.c
index 4e5f9de..40eaeaa 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -8156,7 +8156,7 @@ int skill_encchant_eremental_end(struct block_list *bl,int type)
  */
 int skill_status_change_start(struct block_list *bl, int type, int val1, int val2, int val3, int val4, int tick, int flag) 
 {
-        skill_status_effect(bl, type, val1, val2, val3, val4, tick, flag, 0);
+        return skill_status_effect(bl, type, val1, val2, val3, val4, tick, flag, 0);
 }
 
 
@@ -9817,7 +9817,7 @@ int skill_unit_move_unit_group( struct skill_unit_group *group, int m,int dx,int
  */
 int skill_readdb(void)
 {
-	int i,j,k,l,m;
+	int i,j,k,l;
 	FILE *fp;
 	char line[1024],*p;
 
diff --git a/src/map/tmw.c b/src/map/tmw.c
index 6a2df32..ba02189 100644
--- a/src/map/tmw.c
+++ b/src/map/tmw.c
@@ -106,8 +106,6 @@ void tmw_GmHackMsg(const char *fmt, ...) {
 	char buf[512];
 	va_list ap;
 
-	buf[512] = 0;
-
 	va_start(ap, fmt);
 	vsnprintf(buf, 511, fmt, ap);
 	va_end(ap);
-- 
cgit v1.2.3-70-g09d2