Browse Source

- Fixed warning about unused variable
- Made the kaahi heal timer function uncrashable.
- Fixed pc move item to cart function checking against the wrong max index.
- Fixed initialization of sd issue in map_addblock
- Removed redundant reinitialization when parsing item pickup.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11968 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 17 years ago
parent
commit
81e5c08f4f
5 changed files with 12 additions and 16 deletions
  1. 0 3
      src/map/clif.c
  2. 1 2
      src/map/map.c
  3. 1 1
      src/map/npc.c
  4. 1 1
      src/map/pc.c
  5. 9 9
      src/map/status.c

+ 0 - 3
src/map/clif.c

@@ -8547,9 +8547,6 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd)
 {
 {
 	int item_index = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0])-2;
 	int item_index = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0])-2;
 	int item_amount = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]);
 	int item_amount = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]);
-
-	item_index = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0])-2;
-	item_amount = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]);
 	do {
 	do {
 		if (pc_isdead(sd))
 		if (pc_isdead(sd))
 			break;
 			break;

+ 1 - 2
src/map/map.c

@@ -359,14 +359,13 @@ int map_addblock_sub (struct block_list *bl, int flag)
 	} else {
 	} else {
 		if (bl->type == BL_PC && flag)
 		if (bl->type == BL_PC && flag)
 		{
 		{
-			struct map_session_data* sd;
+			struct map_session_data* sd = (struct map_session_data*)bl;
 			if (!sd->state.auth) {
 			if (!sd->state.auth) {
 				ShowError("map_addblock: Attempted to add a non-authed player (%d:%d)!\n", sd->status.account_id, sd->status.char_id);
 				ShowError("map_addblock: Attempted to add a non-authed player (%d:%d)!\n", sd->status.account_id, sd->status.char_id);
 				return 1;
 				return 1;
 			}
 			}
 			if (map[m].users++ == 0 && battle_config.dynamic_mobs)	//Skotlex
 			if (map[m].users++ == 0 && battle_config.dynamic_mobs)	//Skotlex
 				map_spawnmobs(m);
 				map_spawnmobs(m);
-			sd = (struct map_session_data*)bl;
 			if (battle_config.pet_no_gvg && map_flag_gvg(m) && sd->pd)
 			if (battle_config.pet_no_gvg && map_flag_gvg(m) && sd->pd)
 			{	//Return the pet to egg. [Skotlex]
 			{	//Return the pet to egg. [Skotlex]
 				clif_displaymessage(sd->fd, "Pets are not allowed in Guild Wars.");
 				clif_displaymessage(sd->fd, "Pets are not allowed in Guild Wars.");

+ 1 - 1
src/map/npc.c

@@ -2137,7 +2137,7 @@ int npc_parse_mob2(struct spawn_data* mob, int index)
 
 
 static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
 static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
 {
 {
-	int level, num, class_, mode, x,y,xs,ys, temp;
+	int level, num, class_, mode, x,y,xs,ys;
 	char mapname[32];
 	char mapname[32];
 	char mobname[128];
 	char mobname[128];
 	struct spawn_data mob, *data;
 	struct spawn_data mob, *data;

+ 1 - 1
src/map/pc.c

@@ -3212,7 +3212,7 @@ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount) {
 
 
 	nullpo_retr(0, sd);
 	nullpo_retr(0, sd);
 
 
-	if (idx < 0 || idx >= MAX_CART) //Invalid index check [Skotlex]
+	if (idx < 0 || idx >= MAX_INVENTORY) //Invalid index check [Skotlex]
 		return 1;
 		return 1;
 	
 	
 	item_data = &sd->status.inventory[idx];
 	item_data = &sd->status.inventory[idx];

+ 9 - 9
src/map/status.c

@@ -3390,7 +3390,7 @@ static unsigned short status_calc_batk(struct block_list *bl, struct status_chan
 	if(sc->data[SC_CURSE])
 	if(sc->data[SC_CURSE])
 		batk -= batk * 25/100;
 		batk -= batk * 25/100;
 //Curse shouldn't effect on this?  <- Curse OR Bleeding??
 //Curse shouldn't effect on this?  <- Curse OR Bleeding??
-//	if(sc->data[SC_BLEEDING]->)
+//	if(sc->data[SC_BLEEDING])
 //		batk -= batk * 25/100;
 //		batk -= batk * 25/100;
 	if(sc->data[SC_FLEET])
 	if(sc->data[SC_FLEET])
 		batk += batk * sc->data[SC_FLEET]->val3/100;
 		batk += batk * sc->data[SC_FLEET]->val3/100;
@@ -3819,7 +3819,7 @@ static short status_calc_aspd_rate(struct block_list *bl, struct status_change *
 		}
 		}
 		aspd_rate -= max;
 		aspd_rate -= max;
 
 
-	  	//These stack with the rest of bonuses->
+	  	//These stack with the rest of bonuses.
 		if(sc->data[SC_BERSERK])
 		if(sc->data[SC_BERSERK])
 			aspd_rate -= 300;
 			aspd_rate -= 300;
 		else if(sc->data[SC_MADNESSCANCEL])
 		else if(sc->data[SC_MADNESSCANCEL])
@@ -6622,19 +6622,19 @@ int kaahi_heal_timer(int tid, unsigned int tick, int id, int data)
 	struct status_data *status;
 	struct status_data *status;
 	int hp;
 	int hp;
 
 
-	bl=map_id2bl(id);
-	sc=status_get_sc(bl);
-	status=status_get_status_data(bl);
-	
-	if (!(sc && status && data == SC_KAAHI && sc->data[data]))
+	;
+	if(!((bl=map_id2bl(id))&&
+		(sc=status_get_sc(bl)) &&
+		(sce = sc->data[SC_KAAHI])))
 		return 0;
 		return 0;
-	sce = sc->data[data];
+
 	if(sce->val4 != tid) {
 	if(sce->val4 != tid) {
 		ShowError("kaahi_heal_timer: Timer mismatch: %d != %d\n", tid, sce->val4);
 		ShowError("kaahi_heal_timer: Timer mismatch: %d != %d\n", tid, sce->val4);
 		sce->val4=-1;
 		sce->val4=-1;
 		return 0;
 		return 0;
 	}
 	}
-		
+
+	status=status_get_status_data(bl);
 	if(!status_charge(bl, 0, sce->val3)) {
 	if(!status_charge(bl, 0, sce->val3)) {
 		sce->val4=-1;
 		sce->val4=-1;
 		return 0;
 		return 0;