summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c8
-rw-r--r--src/map/map.c2
-rw-r--r--src/map/pc.h1
-rw-r--r--src/map/script.c2
-rw-r--r--src/map/status.c6
5 files changed, 16 insertions, 3 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index d9c01b0fb..777d777a2 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -850,7 +850,13 @@ ACMD_FUNC(speed)
return -1;
}
- sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED);
+ if (speed < 0) {
+ sd->base_status.speed = DEFAULT_WALK_SPEED;
+ sd->state.permanent_speed = 0; // Remove lock when set back to default speed.
+ } else {
+ sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED);
+ sd->state.permanent_speed = 1; // Set lock when set to non-default speed.
+ }
status_calc_bl(&sd->bl, SCB_SPEED);
clif->message(fd, msg_txt(8)); // Speed changed.
return 0;
diff --git a/src/map/map.c b/src/map/map.c
index dbff42fa3..03ed08f8b 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1692,6 +1692,8 @@ int map_quit(struct map_session_data *sd) {
if( sd->state.storage_flag == 1 ) sd->state.storage_flag = 0; // No need to Double Save Storage on Quit.
+ if (sd->state.permanent_speed == 1) sd->state.permanent_speed = 0; // Remove lock so speed is set back to normal at login.
+
if( sd->ed ) {
elemental_clean_effect(sd->ed);
unit_remove_map(&sd->ed->bl,CLR_TELEPORT);
diff --git a/src/map/pc.h b/src/map/pc.h
index 809822e78..2ebd5ad22 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -165,6 +165,7 @@ struct map_session_data {
struct guild *gmaster_flag;
unsigned int prevend : 1;//used to flag wheather you've spent 40sp to open the vending or not.
unsigned int warping : 1;//states whether you're in the middle of a warp processing
+ unsigned int permanent_speed : 1; // When 1, speed cannot be changed through status_calc_pc().
} state;
struct {
unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
diff --git a/src/map/script.c b/src/map/script.c
index c65ce5c24..ce312e894 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -10152,7 +10152,7 @@ BUILDIN_FUNC(homunculus_mutate)
TBL_PC *sd;
sd = script_rid2sd(st);
- if( sd == NULL )
+ if( sd == NULL || sd->hd == NULL )
return 0;
if(script_hasdata(st,2))
diff --git a/src/map/status.c b/src/map/status.c
index 72643e3c8..482a9890d 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2335,7 +2335,8 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
memset(&status->max_hp, 0, sizeof(struct status_data)-(sizeof(status->hp)+sizeof(status->sp)));
//FIXME: Most of these stuff should be calculated once, but how do I fix the memset above to do that? [Skotlex]
- status->speed = DEFAULT_WALK_SPEED;
+ if (!pc->state.permanent_speed)
+ status->speed = DEFAULT_WALK_SPEED;
//Give them all modes except these (useful for clones)
status->mode = MD_MASK&~(MD_BOSS|MD_PLANT|MD_DETECTOR|MD_ANGRY|MD_TARGETWEAK);
@@ -4988,6 +4989,9 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha
if( sc == NULL )
return cap_value(speed,10,USHRT_MAX);
+ if (sd && sd->state.permanent_speed)
+ return (short)cap_value(speed,10,USHRT_MAX);
+
if( sd && sd->ud.skilltimer != INVALID_TIMER && (pc_checkskill(sd,SA_FREECAST) > 0 || sd->ud.skill_id == LG_EXEEDBREAK) )
{
if( sd->ud.skill_id == LG_EXEEDBREAK )