Browse Source

* Moved AFM map check to map_mapname2mapid
* Added USE_AFM and USE_AF2 to be used later
* Modified sc_data check in pc_damage

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

celest 20 years ago
parent
commit
5c6dba32a8
3 changed files with 34 additions and 10 deletions
  1. 6 1
      Changelog.txt
  2. 23 1
      src/map/map.c
  3. 5 8
      src/map/pc.c

+ 6 - 1
Changelog.txt

@@ -1,7 +1,12 @@
 Date	Added
 Date	Added
-12/9
+12/10
         * Fixed players unable to move in AFM maps [celest]
         * Fixed players unable to move in AFM maps [celest]
         * Added error message if a player's last map couldn't be found [celest]
         * Added error message if a player's last map couldn't be found [celest]
+        * Moved AFM map check to map_mapname2mapid [celest]
+        * Added USE_AFM and USE_AF2 to be used later [celest]
+        * Modified sc_data check in pc_damage [celest]
+
+12/9
 	* Moved a map_freeblock_unlock() around to eliminate a 
 	* Moved a map_freeblock_unlock() around to eliminate a 
 	  crash [MouseJstr]
 	  crash [MouseJstr]
 	* Fixed how players are cleaned up when they disconnected
 	* Fixed how players are cleaned up when they disconnected

+ 23 - 1
src/map/map.c

@@ -105,6 +105,10 @@ int CHECK_INTERVAL = 3600000; // [Valaris]
 int check_online_timer=0; // [Valaris]
 int check_online_timer=0; // [Valaris]
 
 
 #endif /* not TXT_ONLY */
 #endif /* not TXT_ONLY */
+
+#define USE_AFM
+#define USE_AF2
+
 // 極力 staticでローカルに収める
 // 極力 staticでローカルに収める
 static struct dbt * id_db=NULL;
 static struct dbt * id_db=NULL;
 static struct dbt * map_db=NULL;
 static struct dbt * map_db=NULL;
@@ -1215,6 +1219,17 @@ int map_mapname2mapid(char *name) {
 	struct map_data *md=NULL;
 	struct map_data *md=NULL;
 
 
 	md=strdb_search(map_db,name);
 	md=strdb_search(map_db,name);
+
+	#ifdef USE_AFM
+		// If we can't find the .gat map try .afm instead [celest]
+		if(md==NULL && strstr(name,".gat")) {
+			char afm_name[16] = "";
+			strncpy(afm_name, name, strlen(name) - 4);
+			strcat(afm_name, ".afm");
+			md = strdb_search(map_db,afm_name);
+		}
+	#endif
+	
 	if(md==NULL || md->gat==NULL)
 	if(md==NULL || md->gat==NULL)
 		return -1;
 		return -1;
 	return md->m;
 	return md->m;
@@ -1416,7 +1431,7 @@ static void map_readwater(char *watertxt) {
 	fclose(fp);
 	fclose(fp);
 }
 }
 
 
-
+#ifdef USE_AFM
 static int map_readafm(int m,char *fn) {
 static int map_readafm(int m,char *fn) {
 	
 	
 	/*
 	/*
@@ -1559,6 +1574,7 @@ static int map_readafm(int m,char *fn) {
 
 
 	return 0;
 	return 0;
 }
 }
+#endif
 
 
 /*==========================================
 /*==========================================
  * マップ1枚読み込み
  * マップ1枚読み込み
@@ -1629,10 +1645,13 @@ static int map_readmap(int m,char *fn, char *alias) {
 int map_readallmap(void) {
 int map_readallmap(void) {
 	int i,maps_removed=0;
 	int i,maps_removed=0;
 	char fn[256];
 	char fn[256];
+#ifdef USE_AFM
 	FILE *afm_file;
 	FILE *afm_file;
+#endif
 
 
 	// 先に全部のャbプの存在を確認
 	// 先に全部のャbプの存在を確認
 	for(i=0;i<map_num;i++){
 	for(i=0;i<map_num;i++){
+#ifdef USE_AFM
 		char afm_name[256] = "";
 		char afm_name[256] = "";
 		strncpy(afm_name, map[i].name, strlen(map[i].name) - 4);
 		strncpy(afm_name, map[i].name, strlen(map[i].name) - 4);
 		strcat(afm_name, ".afm");
 		strcat(afm_name, ".afm");
@@ -1644,6 +1663,9 @@ int map_readallmap(void) {
 			fclose(afm_file);
 			fclose(afm_file);
 		}
 		}
 		else if(strstr(map[i].name,".gat")!=NULL) {
 		else if(strstr(map[i].name,".gat")!=NULL) {
+#else
+		if(strstr(map[i].name,".gat")!=NULL) {
+#endif
 			char *p = strstr(map[i].name, "<"); // [MouseJstr]
 			char *p = strstr(map[i].name, "<"); // [MouseJstr]
 			if (p != NULL) {
 			if (p != NULL) {
 				char buf[64];
 				char buf[64];

+ 5 - 8
src/map/pc.c

@@ -3775,13 +3775,8 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt
 		strcat(mapname,".gat");
 		strcat(mapname,".gat");
 	}
 	}
 
 
-	// If we can't find the .gat map try .afm instead [celest]
-	if ((m=map_mapname2mapid(mapname))<0) {
-		char afm_name[16] = "";
-		strncpy(afm_name, mapname, strlen(mapname) - 4);
-		strcat(afm_name, ".afm");
-		m=map_mapname2mapid(afm_name);
-	}
+	m=map_mapname2mapid(mapname);
+
 	if(m<0){
 	if(m<0){
 		if(sd->mapname[0]){
 		if(sd->mapname[0]){
 			int ip,port;
 			int ip,port;
@@ -5382,7 +5377,9 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage)
 			pc_stop_walking(sd,3);
 			pc_stop_walking(sd,3);
 		else if(sd->sc_data[SC_ENDURE].timer != -1 && src->type==BL_MOB && (--sd->sc_data[SC_ENDURE].val2) <= 0)
 		else if(sd->sc_data[SC_ENDURE].timer != -1 && src->type==BL_MOB && (--sd->sc_data[SC_ENDURE].val2) <= 0)
 			skill_status_change_end(&sd->bl, SC_ENDURE, -1);
 			skill_status_change_end(&sd->bl, SC_ENDURE, -1);
-	}
+	} else
+		pc_stop_walking(sd,3);
+
 	// ‰‰‘t/ƒ_ƒ“ƒX‚Ì’†?
 	// ‰‰‘t/ƒ_ƒ“ƒX‚Ì’†?
 	if(damage > sd->status.max_hp>>2)
 	if(damage > sd->status.max_hp>>2)
 		skill_stop_dancing(&sd->bl,0);
 		skill_stop_dancing(&sd->bl,0);