Bläddra i källkod

Corrected r12662 where a guild break would trigger the OnGuildBreak event for all castles (even of other guilds).
Corrected some x64 compilation warnings in ers/malloc files.
cleaned up a case of bad variable reuse.

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

ultramage 17 år sedan
förälder
incheckning
304565cc9b
7 ändrade filer med 15 tillägg och 15 borttagningar
  1. 1 1
      src/common/ers.c
  2. 2 2
      src/common/ers.h
  3. 2 2
      src/common/malloc.c
  4. 1 1
      src/common/malloc.h
  5. 1 1
      src/login/login.c
  6. 7 7
      src/map/battle.c
  7. 1 1
      src/map/guild.c

+ 1 - 1
src/common/ers.c

@@ -245,7 +245,7 @@ static void ers_obj_free_entry(ERS self, void *entry)
  * @see ERS_impl#size
  * @see ERS_impl::vtable#entry_size
  */
-static uint32 ers_obj_entry_size(ERS self)
+static size_t ers_obj_entry_size(ERS self)
 {
 	ERS_impl obj = (ERS_impl)self;
 

+ 2 - 2
src/common/ers.h

@@ -103,7 +103,7 @@ typedef struct eri {
 	 * @param self Interface of the entry manager
 	 * @return Size of the entries of this manager in bytes
 	 */
-	uint32 (*entry_size)(struct eri *self);
+	size_t (*entry_size)(struct eri *self);
 
 	/**
 	 * Destroy this instance of the manager.
@@ -120,7 +120,7 @@ typedef struct eri {
 // Use memory manager to allocate/free and disable other interface functions
 #	define ers_alloc(obj,type) (type *)aMalloc(sizeof(type))
 #	define ers_free(obj,entry) aFree(entry)
-#	define ers_entry_size(obj) (uint32)0
+#	define ers_entry_size(obj) (size_t)0
 #	define ers_destroy(obj)
 // Disable the public functions
 #	define ers_new(size) NULL

+ 2 - 2
src/common/malloc.c

@@ -509,7 +509,7 @@ static void block_free(struct block* p)
 	hash_unfill[0] = p;
 }
 
-unsigned int memmgr_usage (void)
+size_t memmgr_usage (void)
 {
 	return memmgr_usage_bytes / 1024;
 }
@@ -665,7 +665,7 @@ bool malloc_verify(void* ptr)
 #endif
 }
 
-unsigned int malloc_usage (void)
+size_t malloc_usage (void)
 {
 #ifdef USE_MEMMGR
 	return memmgr_usage ();

+ 1 - 1
src/common/malloc.h

@@ -156,7 +156,7 @@
 ////////////////////////////////////////////////
 
 bool malloc_verify(void* ptr);
-unsigned int malloc_usage (void);
+size_t malloc_usage (void);
 void malloc_init (void);
 void malloc_final (void);
 

+ 1 - 1
src/login/login.c

@@ -918,7 +918,7 @@ int mmo_auth(struct login_session_data* sd)
 	unsigned int i;
 	time_t raw_time;
 	char tmpstr[256];
-	int len;
+	size_t len;
 	char user_password[32+1]; // reserve for md5-ed pw
 
 	char ip[16];

+ 7 - 7
src/map/battle.c

@@ -2785,17 +2785,17 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
 	{
 		sd->state.arrow_atk = (sd->status.weapon == W_BOW || (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE));
 		if (sd->state.arrow_atk)
-		{	//Recycled damage variable to store index.
-			damage = sd->equip_index[EQI_AMMO];
-			if (damage<0) {
+		{
+			int index = sd->equip_index[EQI_AMMO];
+			if (index<0) {
 				clif_arrow_fail(sd,0);
 				return ATK_NONE;
 			}
 			//Ammo check by Ishizu-chan
-			if (sd->inventory_data[damage])
+			if (sd->inventory_data[index])
 			switch (sd->status.weapon) {
 			case W_BOW:
-				if (sd->inventory_data[damage]->look != A_ARROW) {
+				if (sd->inventory_data[index]->look != A_ARROW) {
 					clif_arrow_fail(sd,0);
 					return ATK_NONE;
 				}
@@ -2804,13 +2804,13 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
 			case W_RIFLE:
 			case W_GATLING:
 			case W_SHOTGUN:
-				if (sd->inventory_data[damage]->look != A_BULLET) {
+				if (sd->inventory_data[index]->look != A_BULLET) {
 					clif_arrow_fail(sd,0);
 					return ATK_NONE;
 				}
 			break;
 			case W_GRENADE:
-				if (sd->inventory_data[damage]->look != A_GRENADE) {
+				if (sd->inventory_data[index]->look != A_GRENADE) {
 					clif_arrow_fail(sd,0);
 					return ATK_NONE;
 				}

+ 1 - 1
src/map/guild.c

@@ -1594,7 +1594,7 @@ int guild_broken(int guild_id,int flag)
 		if( (gc=guild_castle_search(i)) != NULL ){
 			if(gc->guild_id == guild_id){
 				safestrncpy(name, gc->castle_event, 50);
-				npc_event_do("::OnGuildBreak");
+				npc_event_do(strcat(name,"::OnGuildBreak"));
 			}
 		}
 	}