Issue information

Issue ID
#2697
Status
Fixed
Severity
Medium
Started
Hercules Elf Bot
Jan 23, 2009 4:47
Last Post
Hercules Elf Bot
Jan 23, 2009 4:47
Confirmation
N/A

Hercules Elf Bot - Jan 23, 2009 4:47

Originally posted by [b]kamitsu[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=2697

Sorry, i'm French, my english isn't good..

There is one forgets to "break", which causes an error in updating the status luk.
The "default" from "switch" is read and returned -1; ", causing a constant update to 0 for the status luk.

Bug:
CODE
/// Sets the specified stat to the specified value.
/// Returns the new value.
static int pc_setstat(struct map_session_data* sd, int type, int val)
{
    nullpo_retr(-1, sd);

    switch( type ) {
    case SP_STR: sd->status.str = val; break;
    case SP_AGI: sd->status.agi = val; break;
    case SP_VIT: sd->status.vit = val; break;
    case SP_INT: sd->status.int_ = val; break;
    case SP_DEX: sd->status.dex = val; break;
    case SP_LUK: sd->status.luk = val;
    default:
        return -1;
    }

    return val;
}


Correction:
CODE
/// Sets the specified stat to the specified value.
/// Returns the new value.
static int pc_setstat(struct map_session_data* sd, int type, int val)
{
    nullpo_retr(-1, sd);

    switch( type ) {
    case SP_STR: sd->status.str = val; break;
    case SP_AGI: sd->status.agi = val; break;
    case SP_VIT: sd->status.vit = val; break;
    case SP_INT: sd->status.int_ = val; break;
    case SP_DEX: sd->status.dex = val; break;
    case SP_LUK: sd->status.luk = val; break;
    default:
        return -1;
    }

    return val;
}


This post has been edited by kamitsu: Jan 22 2009, 08:48 PM