소스 검색

* Fixed bugreport:7052, npcs with monster sprite now work.
* Follow up to r17052, now it properly resets the x and y coordinate for every npc and checks it after the map.

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

momacabu 12 년 전
부모
커밋
06ebeaf3e8
2개의 변경된 파일17개의 추가작업 그리고 4개의 파일을 삭제
  1. 15 2
      src/map/npc.c
  2. 2 2
      src/map/status.c

+ 15 - 2
src/map/npc.c

@@ -3487,10 +3487,11 @@ void npc_parsesrcfile(const char* filepath, bool runOnInit)
 		if( strcmp(w1,"-") !=0 && strcasecmp(w1,"function") != 0 )
 		{// w1 = <map name>,<x>,<y>,<facing>
 			char mapname[MAP_NAME_LENGTH*2];
+			x = y = 0;
 			sscanf(w1,"%23[^,],%d,%d[^,]",mapname,&x,&y);
-			if( !mapindex_name2id(mapname) || (x < 0 || x >= map[map_mapname2mapid(mapname)].xs || y < 0 || y >= map[map_mapname2mapid(mapname)].ys) )
+			if( !mapindex_name2id(mapname) )
 			{// Incorrect map, we must skip the script info...
-				ShowError("npc_parsesrcfile: Unknown map '%s' or coordinates ('%d', '%d') in file '%s', line '%d'. Skipping line...\n", mapname, x, y, filepath, strline(buffer,p-buffer));
+				ShowError("npc_parsesrcfile: Unknown map '%s' in file '%s', line '%d'. Skipping line...\n", mapname, filepath, strline(buffer,p-buffer));
 				if( strcasecmp(w2,"script") == 0 && count > 3 )
 				{
 					if((p = npc_skip_script(p,buffer,filepath)) == NULL)
@@ -3514,6 +3515,18 @@ void npc_parsesrcfile(const char* filepath, bool runOnInit)
 				p = strchr(p,'\n');// next line
 				continue;
 			}
+			if (x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys) {
+				ShowError("npc_parsesrcfile: Unknown coordinates ('%d', '%d') for map '%s' in file '%s', line '%d'. Skipping line...\n", x, y, mapname, filepath, strline(buffer,p-buffer));
+				if( strcasecmp(w2,"script") == 0 && count > 3 )
+				{
+					if((p = npc_skip_script(p,buffer,filepath)) == NULL)
+					{
+						break;
+					}
+				}
+				p = strchr(p,'\n');// next line
+				continue;
+			}
 		}
 
 		if( strcasecmp(w2,"warp") == 0 && count > 3 )

+ 2 - 2
src/map/status.c

@@ -5805,7 +5805,7 @@ struct status_data *status_get_status_data(struct block_list *bl)
 		case BL_HOM: return &((TBL_HOM*)bl)->battle_status;
 		case BL_MER: return &((TBL_MER*)bl)->battle_status;
 		case BL_ELEM: return &((TBL_ELEM*)bl)->battle_status;
-		case BL_NPC: return &((TBL_NPC*)bl)->status;
+		case BL_NPC: return ((mobdb_checkid(((TBL_NPC*)bl)->class_) == 0) ? &((TBL_NPC*)bl)->status : &dummy_status);
 		default:
 			return &dummy_status;
 	}
@@ -5821,7 +5821,7 @@ struct status_data *status_get_base_status(struct block_list *bl)
 		case BL_HOM: return &((TBL_HOM*)bl)->base_status;
 		case BL_MER: return &((TBL_MER*)bl)->base_status;
 		case BL_ELEM: return &((TBL_ELEM*)bl)->base_status;
-		case BL_NPC: return &((TBL_NPC*)bl)->status;
+		case BL_NPC: return ((mobdb_checkid(((TBL_NPC*)bl)->class_) == 0) ? &((TBL_NPC*)bl)->status : NULL);
 		default:
 			return NULL;
 	}