summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-12-18 12:48:56 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-12-18 12:48:56 +0000
commit2ce4ea3324da64930c77076194e2e8b2b8ab2e49 (patch)
treeceaf8c62f7e8a47f5e94f5cdad91455b1f33eb0f /src/map/pc.c
parentf53dd3e3e3ae847c0871050464fc25f3f5863101 (diff)
downloadhercules-2ce4ea3324da64930c77076194e2e8b2b8ab2e49.tar.gz
hercules-2ce4ea3324da64930c77076194e2e8b2b8ab2e49.tar.bz2
hercules-2ce4ea3324da64930c77076194e2e8b2b8ab2e49.tar.xz
hercules-2ce4ea3324da64930c77076194e2e8b2b8ab2e49.zip
* Updates to handling of hair color/style and cloth color of characters.
- Moved limit shortcut defines from mmo.h to battle.h, as they are only required in files, which include battle.h (since pre-svn 2004/10/15). - Moved hair style/color validation from char-server to map-server. This enables use of non-default limits as specified in battle config, rather than being restricted to hard-coded ones (bugreport:150). - Cleaned up related capping of values in pc_changelook (related r1708). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14604 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c35
1 files changed, 23 insertions, 12 deletions
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: