From c999af595f4a8f7d30b6d7c822e2a1caf3298389 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Tue, 15 Jul 2014 21:22:19 -0700 Subject: Revert bounds checks and go back to signed integers --- src/char/char.cpp | 8 ++-- src/ints/little.hpp | 70 +++++++++++++++++++++++++++ src/map/atcommand.cpp | 22 +++++---- src/map/clif.cpp | 2 + src/map/mob.cpp | 3 -- src/map/pc.cpp | 94 +++++++++++++++++-------------------- src/mmo/extract.cpp | 7 --- src/proto2/include_cstdint_test.cpp | 4 ++ src/proto2/types.hpp | 90 +++++++++++++++++------------------ tools/protocol.py | 78 ++++++++++++++++-------------- 10 files changed, 225 insertions(+), 153 deletions(-) diff --git a/src/char/char.cpp b/src/char/char.cpp index 80ad697..1e31af9 100644 --- a/src/char/char.cpp +++ b/src/char/char.cpp @@ -1034,10 +1034,10 @@ int mmo_char_send006b(Session *s, struct char_session_data *sd) sel.manner = p->manner; sel.status_point = p->status_point; - sel.hp = std::min(p->hp, 0x7fffu); - sel.max_hp = std::min(p->max_hp, 0x7fffu); - sel.sp = std::min(p->sp, 0x7fffu); - sel.max_sp = std::min(p->max_sp, 0x7fffu); + sel.hp = std::min(p->hp, 0x7fff); + sel.max_hp = std::min(p->max_hp, 0x7fff); + sel.sp = std::min(p->sp, 0x7fff); + sel.max_sp = std::min(p->max_sp, 0x7fff); sel.speed = static_cast(DEFAULT_WALK_SPEED.count()); // p->speed; sel.species = p->species; sel.hair_style = p->hair; diff --git a/src/ints/little.hpp b/src/ints/little.hpp index 0dbbb61..b3046f7 100644 --- a/src/ints/little.hpp +++ b/src/ints/little.hpp @@ -64,6 +64,7 @@ namespace ints uint8_t data[8]; }; + inline __attribute__((warn_unused_result)) bool native_to_network(Byte *net, uint8_t nat) { @@ -131,6 +132,75 @@ namespace ints *nat = tmp; return true; } + + + inline __attribute__((warn_unused_result)) + bool native_to_network(Byte *net, int8_t nat) + { + net->value = nat; + return true; + } + inline __attribute__((warn_unused_result)) + bool native_to_network(Little16 *net, int16_t nat) + { + if (__BYTE_ORDER == __BIG_ENDIAN) + nat = bswap16(nat); + __builtin_memcpy(net, &nat, 2); + return true; + } + inline __attribute__((warn_unused_result)) + bool native_to_network(Little32 *net, int32_t nat) + { + if (__BYTE_ORDER == __BIG_ENDIAN) + nat = __builtin_bswap32(nat); + __builtin_memcpy(net, &nat, 4); + return true; + } + inline __attribute__((warn_unused_result)) + bool native_to_network(Little64 *net, int64_t nat) + { + if (__BYTE_ORDER == __BIG_ENDIAN) + nat = __builtin_bswap64(nat); + __builtin_memcpy(net, &nat, 8); + return true; + } + + inline __attribute__((warn_unused_result)) + bool network_to_native(int8_t *nat, Byte net) + { + *nat = net.value; + return true; + } + inline __attribute__((warn_unused_result)) + bool network_to_native(int16_t *nat, Little16 net) + { + int16_t tmp; + __builtin_memcpy(&tmp, &net, 2); + if (__BYTE_ORDER == __BIG_ENDIAN) + tmp = bswap16(tmp); + *nat = tmp; + return true; + } + inline __attribute__((warn_unused_result)) + bool network_to_native(int32_t *nat, Little32 net) + { + int32_t tmp; + __builtin_memcpy(&tmp, &net, 4); + if (__BYTE_ORDER == __BIG_ENDIAN) + tmp = __builtin_bswap32(tmp); + *nat = tmp; + return true; + } + inline __attribute__((warn_unused_result)) + bool network_to_native(int64_t *nat, Little64 net) + { + int64_t tmp; + __builtin_memcpy(&tmp, &net, 8); + if (__BYTE_ORDER == __BIG_ENDIAN) + tmp = __builtin_bswap64(tmp); + *nat = tmp; + return true; + } } // namespace ints using ints::Byte; diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index a17838f..11f6eb1 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -1457,9 +1457,10 @@ ATCE atcommand_baselevelup(Session *s, dumb_ptr sd, if (sd->status.status_point > 0) { for (i = 0; i > level; i--) - sd->status.status_point -= std::min( - static_cast(sd->status.status_point), - (sd->status.base_level + i + 14) / 4); + sd->status.status_point -= + (sd->status.base_level + i + 14) / 4; + if (sd->status.status_point < 0) + sd->status.status_point = 0; clif_updatestatus(sd, SP::STATUSPOINT); } // to add: remove status points from stats @@ -1520,7 +1521,9 @@ ATCE atcommand_joblevelup(Session *s, dumb_ptr sd, clif_updatestatus(sd, SP::NEXTJOBEXP); if (sd->status.skill_point > 0) { - sd->status.skill_point += std::max(level, -sd->status.skill_point); + sd->status.skill_point += level; + if (sd->status.skill_point < 0) + sd->status.skill_point = 0; clif_updatestatus(sd, SP::SKILLPOINT); } // to add: remove status points from skills @@ -2585,9 +2588,10 @@ ATCE atcommand_character_baselevel(Session *s, dumb_ptr sd, if (pl_sd->status.status_point > 0) { for (i = 0; i > level; i--) - pl_sd->status.status_point -= std::min( - static_cast(pl_sd->status.status_point), - (pl_sd->status.base_level + i + 14) / 4); + pl_sd->status.status_point -= + (pl_sd->status.base_level + i + 14) / 4; + if (pl_sd->status.status_point < 0) + pl_sd->status.status_point = 0; clif_updatestatus(pl_sd, SP::STATUSPOINT); } // to add: remove status points from stats @@ -2668,7 +2672,9 @@ ATCE atcommand_character_joblevel(Session *s, dumb_ptr sd, clif_updatestatus(pl_sd, SP::NEXTJOBEXP); if (pl_sd->status.skill_point > 0) { - pl_sd->status.skill_point += std::max(level, -pl_sd->status.skill_point); + pl_sd->status.skill_point += level; + if (pl_sd->status.skill_point < 0) + pl_sd->status.skill_point = 0; clif_updatestatus(pl_sd, SP::SKILLPOINT); } // to add: remove status points from skills diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 5de3a82..e7557c8 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -1703,6 +1703,8 @@ not_b0: { case SP::ZENY: trade_verifyzeny(sd); + if (sd->status.zeny < 0) + sd->status.zeny = 0; fixed_b1.value = sd->status.zeny; break; diff --git a/src/map/mob.cpp b/src/map/mob.cpp index f73dc89..1fd8cf3 100644 --- a/src/map/mob.cpp +++ b/src/map/mob.cpp @@ -2461,9 +2461,6 @@ int mob_damage(dumb_ptr src, dumb_ptr md, int damage, } } - if (damage > md->hp) - damage = md->hp; - md->hp -= damage; if (md->hp > 0) diff --git a/src/map/pc.cpp b/src/map/pc.cpp index d726df8..03e2e76 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -1341,7 +1341,7 @@ int pc_calcstatus(dumb_ptr sd, int first) if (sd->sprate != 100) sd->status.max_sp = sd->status.max_sp * sd->sprate / 100; - if (sd->status.max_sp > battle_config.max_sp) + if (sd->status.max_sp < 0 || sd->status.max_sp > battle_config.max_sp) sd->status.max_sp = battle_config.max_sp; //自然回復HP @@ -3016,8 +3016,6 @@ int pc_gainexp_reason(dumb_ptr sd, int base_exp, int job_exp, } } - if (base_exp < 0 && -base_exp > sd->status.base_exp) - base_exp = -sd->status.base_exp; sd->status.base_exp += base_exp; // [Fate] Adjust experience points that healers can extract from this character @@ -3031,6 +3029,9 @@ int pc_gainexp_reason(dumb_ptr sd, int base_exp, int job_exp, sd->heal_xp = max_heal_xp; } + if (sd->status.base_exp < 0) + sd->status.base_exp = 0; + while (pc_checkbaselevelup(sd)) {} @@ -3045,9 +3046,9 @@ int pc_gainexp_reason(dumb_ptr sd, int base_exp, int job_exp, } } - if (job_exp < 0 && -job_exp > sd->status.job_exp) - job_exp = -sd->status.job_exp; sd->status.job_exp += job_exp; + if (sd->status.job_exp < 0) + sd->status.job_exp = 0; while (pc_checkjoblevelup(sd)) {} @@ -3422,8 +3423,6 @@ int pc_damage(dumb_ptr src, dumb_ptr sd, if (damage > sd->status.max_hp >> 2) skill_stop_dancing(sd, 0); - if (damage > sd->status.hp) - damage = sd->status.hp; sd->status.hp -= damage; if (sd->status.hp > 0) @@ -3473,48 +3472,52 @@ int pc_damage(dumb_ptr src, dumb_ptr sd, { if (battle_config.death_penalty_type == 1 && battle_config.death_penalty_base > 0) - sd->status.base_exp -= std::min(sd->status.base_exp, - static_cast(static_cast(pc_nextbaseexp(sd)) * - static_cast(battle_config.death_penalty_base) / 10000)); + sd->status.base_exp -= + static_cast(pc_nextbaseexp(sd)) * + static_cast(battle_config.death_penalty_base) / 10000; if (battle_config.pk_mode && src && src->bl_type == BL::PC) - sd->status.base_exp -= std::min(sd->status.base_exp, - static_cast(static_cast(pc_nextbaseexp(sd)) * - static_cast(battle_config.death_penalty_base) / 10000)); + sd->status.base_exp -= + static_cast(pc_nextbaseexp(sd)) * + static_cast(battle_config.death_penalty_base) / 10000; else if (battle_config.death_penalty_type == 2 && battle_config.death_penalty_base > 0) { if (pc_nextbaseexp(sd) > 0) - sd->status.base_exp -= std::min(sd->status.base_exp, - static_cast(static_cast(sd->status.base_exp) * - static_cast(battle_config.death_penalty_base) / 10000)); + sd->status.base_exp -= + static_cast(sd->status.base_exp) * + static_cast(battle_config.death_penalty_base) / 10000; if (battle_config.pk_mode && src && src->bl_type == BL::PC) - sd->status.base_exp -= std::min(sd->status.base_exp, - static_cast(static_cast(sd->status.base_exp) * - static_cast(battle_config.death_penalty_base) / 10000)); + sd->status.base_exp -= + static_cast(sd->status.base_exp) * + static_cast(battle_config.death_penalty_base) / 10000; } + if (sd->status.base_exp < 0) + sd->status.base_exp = 0; clif_updatestatus(sd, SP::BASEEXP); if (battle_config.death_penalty_type == 1 && battle_config.death_penalty_job > 0) - sd->status.job_exp -= std::min(sd->status.job_exp, - static_cast(static_cast(pc_nextjobexp(sd)) * - static_cast(battle_config.death_penalty_job) / 10000)); + sd->status.job_exp -= + static_cast(pc_nextjobexp(sd)) * + static_cast(battle_config.death_penalty_job) / 10000; if (battle_config.pk_mode && src && src->bl_type == BL::PC) - sd->status.job_exp -= std::min(sd->status.job_exp, - static_cast(static_cast(pc_nextjobexp(sd)) * - static_cast(battle_config.death_penalty_job) / 10000)); + sd->status.job_exp -= + static_cast(pc_nextjobexp(sd)) * + static_cast(battle_config.death_penalty_job) / 10000; else if (battle_config.death_penalty_type == 2 && battle_config.death_penalty_job > 0) { if (pc_nextjobexp(sd) > 0) - sd->status.job_exp -= std::min(sd->status.job_exp, - static_cast(static_cast(sd->status.job_exp) * - static_cast(battle_config.death_penalty_job) / 10000)); + sd->status.job_exp -= + static_cast(sd->status.job_exp) * + static_cast(battle_config.death_penalty_job) / 10000; if (battle_config.pk_mode && src && src->bl_type == BL::PC) - sd->status.job_exp -= std::min(sd->status.job_exp, - static_cast(static_cast(sd->status.job_exp) * - static_cast(battle_config.death_penalty_job) / 10000)); + sd->status.job_exp -= + static_cast(sd->status.job_exp) * + static_cast(battle_config.death_penalty_job) / 10000; } + if (sd->status.job_exp < 0) + sd->status.job_exp = 0; clif_updatestatus(sd, SP::JOBEXP); } } @@ -3707,18 +3710,18 @@ int pc_setparam(dumb_ptr sd, SP type, int val) case SP::BASEEXP: if (pc_nextbaseexp(sd) > 0) { - if (val < 0) - val = 0; sd->status.base_exp = val; + if (sd->status.base_exp < 0) + sd->status.base_exp = 0; pc_checkbaselevelup(sd); } break; case SP::JOBEXP: if (pc_nextjobexp(sd) > 0) { - if (val < 0) - val = 0; sd->status.job_exp = val; + if (sd->status.job_exp < 0) + sd->status.job_exp = 0; pc_checkjoblevelup(sd); } break; @@ -3781,8 +3784,6 @@ int pc_heal(dumb_ptr sd, int hp, int sp) hp = sd->status.max_hp - sd->status.hp; if (sp + sd->status.sp > sd->status.max_sp) sp = sd->status.max_sp - sd->status.sp; - if (-hp >= sd->status.hp) - hp = -sd->status.hp; sd->status.hp += hp; if (sd->status.hp <= 0) { @@ -3790,8 +3791,6 @@ int pc_heal(dumb_ptr sd, int hp, int sp) pc_damage(nullptr, sd, 1); hp = 0; } - if (-sp >= sd->status.sp) - sp = sd->status.sp; sd->status.sp += sp; if (sd->status.sp <= 0) sd->status.sp = 0; @@ -3913,8 +3912,6 @@ int pc_itemheal_effect(dumb_ptr sd, int hp, int sp) hp = sd->status.max_hp - sd->status.hp; if (sp + sd->status.sp > sd->status.max_sp) sp = sd->status.max_sp - sd->status.sp; - if (-hp > sd->status.hp) - hp = -sd->status.hp; sd->status.hp += hp; if (sd->status.hp <= 0) { @@ -3987,16 +3984,11 @@ int pc_percentheal(dumb_ptr sd, int hp, int sp) } else { - if (sp > 0) - { - sd->status.sp += sd->status.max_sp * sp / 100; - if (sd->status.sp > sd->status.max_sp) - sd->status.sp = sd->status.max_sp; - } - if (sp < 0) - { - sd->status.sp -= std::min(sd->status.sp, sd->status.max_sp * -sp / 100); - } + sd->status.sp += sd->status.max_sp * sp / 100; + if (sd->status.sp > sd->status.max_sp) + sd->status.sp = sd->status.max_sp; + if (sd->status.sp < 0) + sd->status.sp = 0; } } if (hp) diff --git a/src/mmo/extract.cpp b/src/mmo/extract.cpp index 7a00c71..d486ed5 100644 --- a/src/mmo/extract.cpp +++ b/src/mmo/extract.cpp @@ -45,13 +45,6 @@ bool extract(XString str, AString *rv) bool extract(XString str, GlobalReg *var) { - // vars used to be stored signed - int compat_value; - if (extract(str, record<','>(&var->str, &compat_value))) - { - var->value = compat_value; - return true; - } return extract(str, record<','>(&var->str, &var->value)); } diff --git a/src/proto2/include_cstdint_test.cpp b/src/proto2/include_cstdint_test.cpp index 917a325..85bab61 100644 --- a/src/proto2/include_cstdint_test.cpp +++ b/src/proto2/include_cstdint_test.cpp @@ -26,4 +26,8 @@ using Test_uint8_t = uint8_t; using Test_uint16_t = uint16_t; using Test_uint32_t = uint32_t; using Test_uint64_t = uint64_t; +using Test_int8_t = int8_t; +using Test_int16_t = int16_t; +using Test_int32_t = int32_t; +using Test_int64_t = int64_t; } // namespace tmwa diff --git a/src/proto2/types.hpp b/src/proto2/types.hpp index c6581d8..516889a 100644 --- a/src/proto2/types.hpp +++ b/src/proto2/types.hpp @@ -595,24 +595,24 @@ inline __attribute__((warn_unused_result)) bool native_to_network(NetHumanTimeDiff *network, HumanTimeDiff native) { bool rv = true; - uint16_t year = native.year; rv &= native_to_network(&network->year, year); - uint16_t month = native.month; rv &= native_to_network(&network->month, month); - uint16_t day = native.day; rv &= native_to_network(&network->day, day); - uint16_t hour = native.hour; rv &= native_to_network(&network->hour, hour); - uint16_t minute = native.minute; rv &= native_to_network(&network->minute, minute); - uint16_t second = native.second; rv &= native_to_network(&network->second, second); + int16_t year = native.year; rv &= native_to_network(&network->year, year); + int16_t month = native.month; rv &= native_to_network(&network->month, month); + int16_t day = native.day; rv &= native_to_network(&network->day, day); + int16_t hour = native.hour; rv &= native_to_network(&network->hour, hour); + int16_t minute = native.minute; rv &= native_to_network(&network->minute, minute); + int16_t second = native.second; rv &= native_to_network(&network->second, second); return rv; } inline __attribute__((warn_unused_result)) bool network_to_native(HumanTimeDiff *native, NetHumanTimeDiff network) { bool rv = true; - uint16_t year; rv &= network_to_native(&year, network.year); native->year = year; - uint16_t month; rv &= network_to_native(&month, network.month); native->month = month; - uint16_t day; rv &= network_to_native(&day, network.day); native->day = day; - uint16_t hour; rv &= network_to_native(&hour, network.hour); native->hour = hour; - uint16_t minute; rv &= network_to_native(&minute, network.minute); native->minute = minute; - uint16_t second; rv &= network_to_native(&second, network.second); native->second = second; + int16_t year; rv &= network_to_native(&year, network.year); native->year = year; + int16_t month; rv &= network_to_native(&month, network.month); native->month = month; + int16_t day; rv &= network_to_native(&day, network.day); native->day = day; + int16_t hour; rv &= network_to_native(&hour, network.hour); native->hour = hour; + int16_t minute; rv &= network_to_native(&minute, network.minute); native->minute = minute; + int16_t second; rv &= network_to_native(&second, network.second); native->second = second; return rv; } @@ -977,7 +977,7 @@ bool network_to_native(SkillInfo *native, NetSkillInfo network) struct Item { ItemNameId nameid = {}; - uint16_t amount = {}; + int16_t amount = {}; EPOS equip = {}; }; struct NetItem @@ -1009,10 +1009,10 @@ bool network_to_native(Item *native, NetItem network) struct Point { MapName map_ = {}; - uint16_t x = {}; - uint16_t y = {}; + int16_t x = {}; + int16_t y = {}; Point() = default; - Point(MapName _map_, uint16_t _x, uint16_t _y) : map_(_map_), x(_x), y(_y) {} + Point(MapName _map_, int16_t _x, int16_t _y) : map_(_map_), x(_x), y(_y) {} }; struct NetPoint { @@ -1071,7 +1071,7 @@ bool network_to_native(SkillValue *native, NetSkillValue network) struct GlobalReg { VarName str = {}; - uint32_t value = {}; + int32_t value = {}; }; struct NetGlobalReg { @@ -1135,22 +1135,22 @@ bool network_to_native(CharKey *native, NetCharKey network) struct CharData { CharId partner_id = {}; - uint32_t base_exp = {}; - uint32_t job_exp = {}; - uint32_t zeny = {}; + int32_t base_exp = {}; + int32_t job_exp = {}; + int32_t zeny = {}; Species species = {}; - uint16_t status_point = {}; - uint16_t skill_point = {}; - uint32_t hp = {}; - uint32_t max_hp = {}; - uint32_t sp = {}; - uint32_t max_sp = {}; + int16_t status_point = {}; + int16_t skill_point = {}; + int32_t hp = {}; + int32_t max_hp = {}; + int32_t sp = {}; + int32_t max_sp = {}; Option option = {}; - uint16_t karma = {}; - uint16_t manner = {}; - uint16_t hair = {}; - uint16_t hair_color = {}; - uint16_t clothes_color = {}; + int16_t karma = {}; + int16_t manner = {}; + int16_t hair = {}; + int16_t hair_color = {}; + int16_t clothes_color = {}; PartyId party_id = {}; ItemLook weapon = {}; ItemNameId shield = {}; @@ -1159,7 +1159,7 @@ struct CharData ItemNameId head_bottom = {}; uint8_t base_level = {}; uint8_t job_level = {}; - earray attrs = {}; + earray attrs = {}; SEX sex = {}; IP4Address mapip = {}; uint16_t mapport = {}; @@ -1167,11 +1167,11 @@ struct CharData Point save_point = {}; GenericArray> inventory = {}; earray skill = {}; - uint32_t global_reg_num = {}; + int32_t global_reg_num = {}; Array global_reg = {}; - uint32_t account_reg_num = {}; + int32_t account_reg_num = {}; Array account_reg = {}; - uint32_t account_reg2_num = {}; + int32_t account_reg2_num = {}; Array account_reg2 = {}; }; struct NetCharData @@ -1324,9 +1324,9 @@ bool native_to_network(NetPartyMember *network, PartyMember native) AccountId account_id = native.account_id; rv &= native_to_network(&network->account_id, account_id); CharName name = native.name; rv &= native_to_network(&network->name, name); MapName map = native.map; rv &= native_to_network(&network->map, map); - uint32_t leader = native.leader; rv &= native_to_network(&network->leader, leader); - uint32_t online = native.online; rv &= native_to_network(&network->online, online); - uint32_t lv = native.lv; rv &= native_to_network(&network->lv, lv); + int32_t leader = native.leader; rv &= native_to_network(&network->leader, leader); + int32_t online = native.online; rv &= native_to_network(&network->online, online); + int32_t lv = native.lv; rv &= native_to_network(&network->lv, lv); return rv; } inline __attribute__((warn_unused_result)) @@ -1336,17 +1336,17 @@ bool network_to_native(PartyMember *native, NetPartyMember network) AccountId account_id; rv &= network_to_native(&account_id, network.account_id); native->account_id = account_id; CharName name; rv &= network_to_native(&name, network.name); native->name = name; MapName map; rv &= network_to_native(&map, network.map); native->map = map; - uint32_t leader; rv &= network_to_native(&leader, network.leader); native->leader = leader; - uint32_t online; rv &= network_to_native(&online, network.online); native->online = online; - uint32_t lv; rv &= network_to_native(&lv, network.lv); native->lv = lv; + int32_t leader; rv &= network_to_native(&leader, network.leader); native->leader = leader; + int32_t online; rv &= network_to_native(&online, network.online); native->online = online; + int32_t lv; rv &= network_to_native(&lv, network.lv); native->lv = lv; return rv; } struct PartyMost { PartyName name = {}; - uint32_t exp = {}; - uint32_t item = {}; + int32_t exp = {}; + int32_t item = {}; Array member = {}; }; struct NetPartyMost @@ -1382,8 +1382,8 @@ struct Storage { bool dirty = {}; AccountId account_id = {}; - uint16_t storage_status = {}; - uint16_t storage_amount = {}; + int16_t storage_status = {}; + int16_t storage_amount = {}; GenericArray> storage_ = {}; }; struct NetStorage diff --git a/tools/protocol.py b/tools/protocol.py index a5701a6..91dbc81 100755 --- a/tools/protocol.py +++ b/tools/protocol.py @@ -874,6 +874,10 @@ def main(): uint16_t = cstdint.native('uint16_t') uint32_t = cstdint.native('uint32_t') uint64_t = cstdint.native('uint64_t') + int8_t = cstdint.native('int8_t') + int16_t = cstdint.native('int16_t') + int32_t = cstdint.native('int32_t') + int64_t = cstdint.native('int64_t') Byte = endians_h.neutral('Byte') Little16 = endians_h.network('Little16') @@ -962,6 +966,10 @@ def main(): u16 = ctx.provided(uint16_t, Little16) u32 = ctx.provided(uint32_t, Little32) u64 = ctx.provided(uint64_t, Little64) + i8 = ctx.provided(int8_t, Byte) + i16 = ctx.provided(int16_t, Little16) + i32 = ctx.provided(int32_t, Little32) + i64 = ctx.provided(int64_t, Little64) sex_char = ctx.provided(SEX, char) @@ -1029,12 +1037,12 @@ def main(): human_time_diff = ctx.partial_struct( HumanTimeDiff, [ - ('year', u16), - ('month', u16), - ('day', u16), - ('hour', u16), - ('minute', u16), - ('second', u16), + ('year', i16), + ('month', i16), + ('day', i16), + ('hour', i16), + ('minute', i16), + ('second', i16), ] ) @@ -1129,7 +1137,7 @@ def main(): 'Item', [ at(None, item_name_id, 'nameid'), - at(None, u16, 'amount'), + at(None, i16, 'amount'), at(None, epos, 'equip'), ], size=None, @@ -1139,8 +1147,8 @@ def main(): 'Point', [ at(None, map_name, 'map_'), - at(None, u16, 'x'), - at(None, u16, 'y'), + at(None, i16, 'x'), + at(None, i16, 'y'), ], size=None, ctor=True, @@ -1159,7 +1167,7 @@ def main(): 'GlobalReg', [ at(None, var_name, 'str'), - at(None, u32, 'value'), + at(None, i32, 'value'), ], size=None, ) @@ -1178,22 +1186,22 @@ def main(): 'CharData', [ at(None, char_id, 'partner id'), - at(None, u32, 'base exp'), - at(None, u32, 'job exp'), - at(None, u32, 'zeny'), + at(None, i32, 'base exp'), + at(None, i32, 'job exp'), + at(None, i32, 'zeny'), at(None, species, 'species'), - at(None, u16, 'status point'), - at(None, u16, 'skill point'), - at(None, u32, 'hp'), - at(None, u32, 'max hp'), - at(None, u32, 'sp'), - at(None, u32, 'max sp'), + at(None, i16, 'status point'), + at(None, i16, 'skill point'), + at(None, i32, 'hp'), + at(None, i32, 'max hp'), + at(None, i32, 'sp'), + at(None, i32, 'max sp'), at(None, option, 'option'), - at(None, u16, 'karma'), - at(None, u16, 'manner'), - at(None, u16, 'hair'), - at(None, u16, 'hair color'), - at(None, u16, 'clothes color'), + at(None, i16, 'karma'), + at(None, i16, 'manner'), + at(None, i16, 'hair'), + at(None, i16, 'hair color'), + at(None, i16, 'clothes color'), at(None, party_id, 'party id'), at(None, item_look, 'weapon'), at(None, item_name_id, 'shield'), @@ -1202,7 +1210,7 @@ def main(): at(None, item_name_id, 'head bottom'), at(None, u8, 'base level'), at(None, u8, 'job level'), - at(None, ctx.earray(u16, 'ATTR'), 'attrs'), + at(None, ctx.earray(i16, 'ATTR'), 'attrs'), at(None, sex, 'sex'), at(None, ip4, 'mapip'), at(None, u16, 'mapport'), @@ -1210,11 +1218,11 @@ def main(): at(None, point, 'save point'), at(None, ctx.invarray(item, 'IOff0', 'MAX_INVENTORY'), 'inventory'), at(None, ctx.earray(skill_value, 'SkillID', 'MAX_SKILL'), 'skill'), - at(None, u32, 'global reg num'), + at(None, i32, 'global reg num'), at(None, ctx.array(global_reg, 'GLOBAL_REG_NUM'), 'global reg'), - at(None, u32, 'account reg num'), + at(None, i32, 'account reg num'), at(None, ctx.array(global_reg, 'ACCOUNT_REG_NUM'), 'account reg'), - at(None, u32, 'account reg2 num'), + at(None, i32, 'account reg2 num'), at(None, ctx.array(global_reg, 'ACCOUNT_REG2_NUM'), 'account reg2'), ], size=None, @@ -1226,9 +1234,9 @@ def main(): ('account_id', account_id), ('name', char_name), ('map', map_name), - ('leader', u32), - ('online', u32), - ('lv', u32), + ('leader', i32), + ('online', i32), + ('lv', i32), ] ) @@ -1236,8 +1244,8 @@ def main(): 'PartyMost', [ at(None, party_name, 'name'), - at(None, u32, 'exp'), - at(None, u32, 'item'), + at(None, i32, 'exp'), + at(None, i32, 'item'), at(None, ctx.array(party_member, 'MAX_PARTY'), 'member'), ], size=None, @@ -1248,8 +1256,8 @@ def main(): [ at(None, bit, 'dirty'), at(None, account_id, 'account id'), - at(None, u16, 'storage status'), - at(None, u16, 'storage amount'), + at(None, i16, 'storage status'), + at(None, i16, 'storage amount'), at(None, ctx.invarray(item, 'SOff0', 'MAX_STORAGE'), 'storage_'), ], size=None, -- cgit v1.2.3-60-g2f50