summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c2
-rw-r--r--src/char_sql/char.c2
-rw-r--r--src/common/mmo.h7
-rw-r--r--src/map/battle.h7
-rw-r--r--src/map/pc.c35
5 files changed, 30 insertions, 23 deletions
diff --git a/src/char/char.c b/src/char/char.c
index c61a84d29..31eb5c7dc 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -1194,8 +1194,6 @@ int make_new_char(struct char_session_data* sd, char* name_, int str, int agi, i
//check other inputs
if((slot >= MAX_CHARS) // slots
- || (hair_style >= 24) // hair style
- || (hair_color >= 9) // hair color
|| (str + agi + vit + int_ + dex + luk != 6*5 ) // stats
|| (str < 1 || str > 9 || agi < 1 || agi > 9 || vit < 1 || vit > 9 || int_ < 1 || int_ > 9 || dex < 1 || dex > 9 || luk < 1 || luk > 9) // individual stat values
|| (str + int_ != 10 || agi + luk != 10 || vit + dex != 10) ) // pairs
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index d33ba46bd..b96027490 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -1294,8 +1294,6 @@ int make_new_char_sql(struct char_session_data* sd, char* name_, int str, int ag
//check other inputs
if((slot >= MAX_CHARS) // slots
- || (hair_style >= 24) // hair style
- || (hair_color >= 9) // hair color
|| (str + agi + vit + int_ + dex + luk != 6*5 ) // stats
|| (str < 1 || str > 9 || agi < 1 || agi > 9 || vit < 1 || vit > 9 || int_ < 1 || int_ > 9 || dex < 1 || dex > 9 || luk < 1 || luk > 9) // individual stat values
|| (str + int_ != 10 || agi + luk != 10 || vit + dex != 10) ) // pairs
diff --git a/src/common/mmo.h b/src/common/mmo.h
index d2bc93a04..994a1d6a2 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -108,13 +108,6 @@
#define MAX_QUEST_DB 2000 //Max quests that the server will load
#define MAX_QUEST_OBJECTIVES 3 //Max quest objectives for a quest
-#define MIN_HAIR_STYLE battle_config.min_hair_style
-#define MAX_HAIR_STYLE battle_config.max_hair_style
-#define MIN_HAIR_COLOR battle_config.min_hair_color
-#define MAX_HAIR_COLOR battle_config.max_hair_color
-#define MIN_CLOTH_COLOR battle_config.min_cloth_color
-#define MAX_CLOTH_COLOR battle_config.max_cloth_color
-
// for produce
#define MIN_ATTRIBUTE 0
#define MAX_ATTRIBUTE 4
diff --git a/src/map/battle.h b/src/map/battle.h
index 79ea13b1c..1a879f5b5 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -96,6 +96,13 @@ bool battle_check_range(struct block_list *src,struct block_list *bl,int range);
void battle_consume_ammo(struct map_session_data* sd, int skill, int lv);
// Ý’è
+#define MIN_HAIR_STYLE battle_config.min_hair_style
+#define MAX_HAIR_STYLE battle_config.max_hair_style
+#define MIN_HAIR_COLOR battle_config.min_hair_color
+#define MAX_HAIR_COLOR battle_config.max_hair_color
+#define MIN_CLOTH_COLOR battle_config.min_cloth_color
+#define MAX_CLOTH_COLOR battle_config.max_cloth_color
+
extern struct Battle_Config
{
int warp_point_debug;
diff --git a/src/map/pc.c b/src/map/pc.c
index 018b392f1..45064794b 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -840,6 +840,23 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
sd->class_ = MAPID_NOVICE;
} else
sd->class_ = i;
+
+ // Checks and fixes to character status data, that are required
+ // in case of configuration change or stuff, which cannot be
+ // checked on char-server.
+ if( sd->status.hair < MIN_HAIR_STYLE || sd->status.hair > MAX_HAIR_STYLE )
+ {
+ sd->status.hair = MIN_HAIR_STYLE;
+ }
+ if( sd->status.hair_color < MIN_HAIR_COLOR || sd->status.hair_color > MAX_HAIR_COLOR )
+ {
+ sd->status.hair_color = MIN_HAIR_COLOR;
+ }
+ if( sd->status.clothes_color < MIN_CLOTH_COLOR || sd->status.clothes_color > MAX_CLOTH_COLOR )
+ {
+ sd->status.clothes_color = MIN_CLOTH_COLOR;
+ }
+
//Initializations to null/0 unneeded since map_session_data was filled with 0 upon allocation.
if(!sd->status.hp) pc_setdead(sd);
sd->state.connect_new = 1;
@@ -6334,10 +6351,8 @@ int pc_changelook(struct map_session_data *sd,int type,int val)
switch(type){
case LOOK_HAIR: //Use the battle_config limits! [Skotlex]
- if (val < battle_config.min_hair_style)
- val = battle_config.min_hair_style;
- else if (val > battle_config.max_hair_style)
- val = battle_config.max_hair_style;
+ val = cap_value(val, MIN_HAIR_STYLE, MAX_HAIR_STYLE);
+
if (sd->status.hair != val)
{
sd->status.hair=val;
@@ -6359,10 +6374,8 @@ int pc_changelook(struct map_session_data *sd,int type,int val)
sd->status.head_mid=val;
break;
case LOOK_HAIR_COLOR: //Use the battle_config limits! [Skotlex]
- if (val < battle_config.min_hair_color)
- val = battle_config.min_hair_color;
- else if (val > battle_config.max_hair_color)
- val = battle_config.max_hair_color;
+ val = cap_value(val, MIN_HAIR_COLOR, MAX_HAIR_COLOR);
+
if (sd->status.hair_color != val)
{
sd->status.hair_color=val;
@@ -6372,10 +6385,8 @@ int pc_changelook(struct map_session_data *sd,int type,int val)
}
break;
case LOOK_CLOTHES_COLOR: //Use the battle_config limits! [Skotlex]
- if (val < battle_config.min_cloth_color)
- val = battle_config.min_cloth_color;
- else if (val > battle_config.max_cloth_color)
- val = battle_config.max_cloth_color;
+ val = cap_value(val, MIN_CLOTH_COLOR, MAX_CLOTH_COLOR);
+
sd->status.clothes_color=val;
break;
case LOOK_SHIELD: