diff options
author | Bardur Arantsson <bardur@scientician.net> | 2010-01-10 19:30:28 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2010-01-10 19:32:02 +0100 |
commit | 20087ac085b472a1238ac0ca78a2cd9d4e24c18d (patch) | |
tree | 5df1ecde8d61a979e58c329a3eab711581620aca /src/status.c | |
parent | d324d9c0ac98e74db26e5dd5c6e379c1fc18cff3 (diff) |
Fixes for 64 bit compatibility.
- Fix skill value display in character dump on 64 bit machines.
- Fix format strings and add casts to *printf() invocations.
Diffstat (limited to 'src/status.c')
-rw-r--r-- | src/status.c | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/src/status.c b/src/status.c index de531593..37b683c5 100644 --- a/src/status.c +++ b/src/status.c @@ -492,31 +492,26 @@ static void status_bival(s32b val, byte ypos, byte xpos) static void status_numeric(s32b val, byte ypos, byte xpos) { - if (val == 0) - c_put_str(TERM_WHITE, ".", ypos, xpos); - else if (val < 0) - { - val *= -1; - if (val > 9) - c_put_str(TERM_RED, "*", ypos, xpos); - else - { - char strnum[2]; - sprintf(strnum, "%lu", val); - c_put_str(TERM_RED, strnum, ypos, xpos); - } - } - else if (val > 0) - { - if (val > 9) - c_put_str(TERM_GREEN, "*", ypos, xpos); - else - { - char strnum[2]; - sprintf(strnum, "%lu", val); - c_put_str(TERM_GREEN, strnum, ypos, xpos); - } + u32b magnitude = ABS(val); + int color = TERM_WHITE; /* default */ + char strnum[2]; + + if (val<0) { + color = TERM_RED; + }; + if (val>0) { + color = TERM_GREEN; + }; + + if (magnitude == 0) { + sprintf(strnum, "."); + } if (magnitude > 9) { + sprintf(strnum, "*"); + } else { + sprintf(strnum, "%lu", (unsigned long int) magnitude); } + + c_put_str(color, strnum, ypos, xpos); } static void status_count(s32b val1, int v1, s32b val2, int v2, s32b val3, int v3, s32b val4, int v4, byte ypos, byte xpos) @@ -746,11 +741,11 @@ static void status_companion(void) fprintf(fff, "#####BCompanion: %s\n", m_name); - fprintf(fff, " Lev/Exp : [[[[[G%d / %ld]\n", m_ptr->level, m_ptr->exp); - if (m_ptr->level < MONSTER_LEVEL_MAX) fprintf(fff, " Next lvl: [[[[[G%ld]\n", MONSTER_EXP((s32b)m_ptr->level + 1)); + fprintf(fff, " Lev/Exp : [[[[[G%d / %ld]\n", m_ptr->level, (long int) m_ptr->exp); + if (m_ptr->level < MONSTER_LEVEL_MAX) fprintf(fff, " Next lvl: [[[[[G%ld]\n", (long int) MONSTER_EXP((s32b)m_ptr->level + 1)); else fprintf(fff, " Next lvl: [[[[[G****]\n"); - fprintf(fff, " HP : [[[[[G%ld / %ld]\n", m_ptr->hp, m_ptr->maxhp); + fprintf(fff, " HP : [[[[[G%ld / %ld]\n", (long int) m_ptr->hp, (long int) m_ptr->maxhp); fprintf(fff, " AC : [[[[[G%d]\n", m_ptr->ac); fprintf(fff, " Speed : [[[[[G%d]\n", m_ptr->mspeed - 110); |