diff --git a/src/hooks/misc/format_int.cpp b/src/hooks/misc/format_int.cpp index e4c98aaf..772ed103 100644 --- a/src/hooks/misc/format_int.cpp +++ b/src/hooks/misc/format_int.cpp @@ -2,14 +2,14 @@ namespace big { - static inline std::string format_money(int64_t amount) + /*static inline std::string format_money(int64_t amount) { std::stringstream ss; ss.imbue(std::locale("en_US.UTF-8")); ss << "$" << std::put_money(static_cast(amount) * 100, false); std::string money = ss.str(); return money.substr(0, money.size() - 3); - } + }*/ void hooks::format_int(int64_t integer_to_format, char* format_string, size_t size_always_64, bool use_commas) { @@ -17,12 +17,8 @@ namespace big auto return_bytes = static_cast(return_address); if (g.window.gui.format_money && return_bytes[0] == 0x48 && return_bytes[1] == 0x8D && return_bytes[2] == 0x15) //lea rdx, aHcGreenlightFo ; "~HC_GREENLIGHT~ " { - auto money_format = format_money(integer_to_format); - std::strncpy(format_string, money_format.c_str(), size_always_64); - } - else - { - g_hooking->get_original()(integer_to_format, format_string, size_always_64, use_commas); + use_commas = true; } + g_hooking->get_original()(integer_to_format, format_string, size_always_64, use_commas); } } \ No newline at end of file diff --git a/src/native_hooks/shop_controller.hpp b/src/native_hooks/shop_controller.hpp index e90df4b0..347d3596 100644 --- a/src/native_hooks/shop_controller.hpp +++ b/src/native_hooks/shop_controller.hpp @@ -6,13 +6,14 @@ namespace big { namespace shop_controller { - static inline std::string format_money(int64_t amount) + inline std::string format_chips(int value) { - std::stringstream ss; - ss.imbue(std::locale("en_US.UTF-8")); - ss << std::put_money(static_cast(amount) * 100, false); - std::string money = ss.str(); - return money.substr(0, money.size() - 3); + std::string formatted = std::to_string(value); + for (int i = formatted.size() - 3; i > 0; i -= 3) + { + formatted.insert(i, ","); + } + return formatted; } void SET_WARNING_MESSAGE_WITH_HEADER(rage::scrNativeCallContext* src) @@ -43,7 +44,7 @@ namespace big STATS::STAT_GET_INT(casino_chips, &player_chips, -1); if (arg0 == player_chips && player_chips >= 1000) { - auto chips_format = format_money(player_chips); + auto chips_format = format_chips(player_chips); return GRAPHICS::SCALEFORM_MOVIE_METHOD_ADD_PARAM_PLAYER_NAME_STRING(chips_format.c_str()); } }