Преглед изворни кода

- Updated battle_switch to use strncmpi instead of strcmpi, it makes it so using "yessir" will match "yes", this is actually needed because if you set a config setting to "yes " (notice the trailing space), then the map config engine fails to read it right, and will set the config setting to 0 (no).
- Added function pc_resethate to more easily handle Angel trigger
- Made feel_var and hate_var static variables to pc.c to simplify things and avoid errors due to redundancy.
- Updated the show_mob_info setting to add another space to the separating pipes, so that each field is separated by " | " instead of " |".


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

skotlex пре 18 година
родитељ
комит
34683f252f
6 измењених фајлова са 40 додато и 13 уклоњено
  1. 8 0
      Changelog-Trunk.txt
  2. 10 2
      src/map/battle.c
  3. 4 4
      src/map/clif.c
  4. 16 3
      src/map/pc.c
  5. 1 0
      src/map/pc.h
  6. 1 4
      src/map/status.c

+ 8 - 0
Changelog-Trunk.txt

@@ -4,6 +4,14 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/09/12
+	* Updated battle_switch to use strncmpi instead of strcmpi, it makes it so
+	  using "yessir" will match "yes", this is actually needed because if you set
+	  a config setting to "yes " (notice the trailing space), then the map config
+	  engine fails to read it right, and will set the config setting to 0 (no).
+	  [Skotlex]
+	* Some corrections to hate_mob cleanup when triggering the Angel stuff. [Skotlex]
+	* Updated the show_mob_info setting to add another space to the separating
+	  pipes, so that each field is separated by " | " instead of " |". [Skotlex]
 	* Homunculus intimacy will go back to 500 on evolution. [Skotlex]
 	* Baphomet splash damage will now hit nearby enemies regardless of flee
 	  (but the initial attack still has to connect for the splash to trigger)

+ 10 - 2
src/map/battle.c

@@ -3429,10 +3429,18 @@ int battle_check_range(struct block_list *src,struct block_list *bl,int range)
  *------------------------------------------
  */
 int battle_config_switch(const char *str) {
-	if (strcmpi(str, "on") == 0 || strcmpi(str, "yes") == 0 || strcmpi(str, "oui") == 0 || strcmpi(str, "ja") == 0 || strcmpi(str, "si") == 0)
+	if(strncmpi(str, "on",2) == 0 ||
+		strncmpi(str, "yes",3) == 0 ||
+		strncmpi(str, "oui",3) == 0 ||
+		strncmpi(str, "ja",2) == 0 ||
+		strncmpi(str, "si",2) == 0)
 		return 1;
-	if (strcmpi(str, "off") == 0 || strcmpi(str, "no") == 0 || strcmpi(str, "non") == 0 || strcmpi(str, "nein") == 0)
+	if(strncmpi(str, "off",3) == 0 ||
+		strncmpi(str, "no",2) == 0 ||
+		strncmpi(str, "non",3) == 0 ||
+		strncmpi(str, "nein",4) == 0)
 		return 0;
+
 	return atoi(str);
 }
 

+ 4 - 4
src/map/clif.c

@@ -7857,15 +7857,15 @@ int clif_charnameack (int fd, struct block_list *bl)
 
 				WBUFW(buf, 0) = cmd = 0x195;
 				if (battle_config.show_mob_info&4)
-					str_p += sprintf(str_p, "Lv. %d |", md->level);
+					str_p += sprintf(str_p, "Lv. %d | ", md->level);
 				if (battle_config.show_mob_info&1)
-					str_p += sprintf(str_p, "HP: %u/%u |", md->status.hp, md->status.max_hp);
+					str_p += sprintf(str_p, "HP: %u/%u | ", md->status.hp, md->status.max_hp);
 				if (battle_config.show_mob_info&2)
-					str_p += sprintf(str_p, "HP: %d%% |", 100*md->status.hp/md->status.max_hp);
+					str_p += sprintf(str_p, "HP: %d%% | ", 100*md->status.hp/md->status.max_hp);
 				//Even thought mobhp ain't a name, we send it as one so the client
 				//can parse it. [Skotlex]
 				if (str_p != mobhp) {
-					*(str_p-2) = '\0'; //Remove trailing space + pipe.
+					*(str_p-3) = '\0'; //Remove trailing space + pipe.
 					memcpy(WBUFP(buf,30), mobhp, NAME_LENGTH);
 					WBUFB(buf,54) = 0;
 					memcpy(WBUFP(buf,78), mobhp, NAME_LENGTH);

+ 16 - 3
src/map/pc.c

@@ -66,6 +66,9 @@ static int GM_num = 0;
 #define MOTD_LINE_SIZE 128
 char motd_text[MOTD_LINE_SIZE][256]; // Message of the day buffer [Valaris]
 
+static const char feel_var[3][NAME_LENGTH] = {"PC_FEEL_SUN","PC_FEEL_MOON","PC_FEEL_STAR"};
+static const char hate_var[3][NAME_LENGTH] = {"PC_HATE_MOB_SUN","PC_HATE_MOB_MOON","PC_HATE_MOB_STAR"};
+
 int pc_isGM(struct map_session_data *sd) {
 	int i;
 
@@ -796,8 +799,6 @@ int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl)
 int pc_reg_received(struct map_session_data *sd)
 {
 	int i,j;
-	const char feel_var[3][NAME_LENGTH] = {"PC_FEEL_SUN","PC_FEEL_MOON","PC_FEEL_STAR"};
-	const char hate_var[3][NAME_LENGTH] = {"PC_HATE_MOB_SUN","PC_HATE_MOB_MOON","PC_HATE_MOB_STAR"};
 	
 	sd->change_level = pc_readglobalreg(sd,"jobchange_level");
 	sd->die_counter = pc_readglobalreg(sd,"PC_DIE_COUNTER");
@@ -4732,7 +4733,6 @@ int pc_resetskill(struct map_session_data* sd, int flag)
 int pc_resetfeel(struct map_session_data* sd)
 {
 	int i;
-	char feel_var[3][NAME_LENGTH] = {"PC_FEEL_SUN","PC_FEEL_MOON","PC_FEEL_STAR"};
 	nullpo_retr(0, sd);
 
 	for (i=0; i<3; i++)
@@ -4745,6 +4745,19 @@ int pc_resetfeel(struct map_session_data* sd)
 	return 0;
 }
 
+int pc_resethate(struct map_session_data* sd)
+{
+	int i;
+	nullpo_retr(0, sd);
+
+	for (i=0; i<3; i++)
+	{
+		sd->hate_mob[i] = -1;
+		pc_setglobalreg(sd,hate_var[i],0);
+	}
+	return 0;
+}
+
 static int pc_respawn(int tid,unsigned int tick,int id,int data)
 {
 	struct map_session_data *sd = map_id2sd(id);

+ 1 - 0
src/map/pc.h

@@ -196,6 +196,7 @@ int pc_resetlvl(struct map_session_data*,int type);
 int pc_resetstate(struct map_session_data*);
 int pc_resetskill(struct map_session_data*, int);
 int pc_resetfeel(struct map_session_data*);
+int pc_resethate(struct map_session_data*);
 int pc_equipitem(struct map_session_data*,int,int);
 int pc_unequipitem(struct map_session_data*,int,int);
 int pc_checkitem(struct map_session_data*);

+ 1 - 4
src/map/status.c

@@ -7022,10 +7022,7 @@ static int status_natural_heal(DBKey key,void * data,va_list app)
 					(sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR &&
 					rand()%10000 < battle_config.sg_angel_skill_ratio
 				) { //Angel of the Sun/Moon/Star
-					malloc_set(sd->hate_mob, 0, sizeof(sd->hate_mob));
-					pc_setglobalreg(sd,"PC_HATE_MOB_STAR", 0);
-					pc_setglobalreg(sd,"PC_HATE_MOB_SUN", 0);
-					pc_setglobalreg(sd,"PC_HATE_MOB_MOON", 0);
+					pc_resethate(sd);
 					pc_resetfeel(sd);
 					//TODO: Figure out how to make the client-side msg show up.
 				}