mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Use localisation for speed and size information.
This commit is contained in:
@@ -3727,6 +3727,7 @@ STR_6276 :{RED}{STRINGID} has guests getting stuck, possibly due to invalid r
|
|||||||
STR_6277 :{WINDOW_COLOUR_2}Station index: {BLACK}{COMMA16}
|
STR_6277 :{WINDOW_COLOUR_2}Station index: {BLACK}{COMMA16}
|
||||||
STR_6278 :Autosave amount
|
STR_6278 :Autosave amount
|
||||||
STR_6279 :{SMALLFONT}{BLACK}Number of autosaves that should be kept
|
STR_6279 :{SMALLFONT}{BLACK}Number of autosaves that should be kept
|
||||||
|
<<<<<<< HEAD
|
||||||
STR_6280 :{SMALLFONT}{BLACK}Chat
|
STR_6280 :{SMALLFONT}{BLACK}Chat
|
||||||
STR_6281 :{SMALLFONT}{BLACK}Show a separate button for the Chat window in the toolbar
|
STR_6281 :{SMALLFONT}{BLACK}Show a separate button for the Chat window in the toolbar
|
||||||
STR_6282 :Chat
|
STR_6282 :Chat
|
||||||
@@ -3741,6 +3742,24 @@ STR_6290 :Base protocol
|
|||||||
STR_6291 :Commands
|
STR_6291 :Commands
|
||||||
STR_6292 :Map
|
STR_6292 :Map
|
||||||
|
|
||||||
|
=======
|
||||||
|
STR_6280 :Network
|
||||||
|
STR_6281 :Network Information
|
||||||
|
STR_6282 :Receive
|
||||||
|
STR_6283 :Send
|
||||||
|
STR_6284 :Total received
|
||||||
|
STR_6285 :Total sent
|
||||||
|
STR_6286 :Base protocol
|
||||||
|
STR_6287 :Commands
|
||||||
|
STR_6288 :Map
|
||||||
|
STR_6289 :B
|
||||||
|
STR_6290 :KB
|
||||||
|
STR_6291 :MB
|
||||||
|
STR_6292 :GB
|
||||||
|
STR_6293 :TB
|
||||||
|
STR_6294 :{STRING}/sec
|
||||||
|
|
||||||
|
>>>>>>> Use localisation for speed and size information.
|
||||||
#############
|
#############
|
||||||
# Scenarios #
|
# Scenarios #
|
||||||
################
|
################
|
||||||
|
|||||||
@@ -99,9 +99,9 @@ static constexpr int32_t NetworkTrafficGroupColors[NETWORK_STATISTICS_GROUP_MAX]
|
|||||||
|
|
||||||
static constexpr int32_t NetworkTrafficGroupNames[NETWORK_STATISTICS_GROUP_MAX] = {
|
static constexpr int32_t NetworkTrafficGroupNames[NETWORK_STATISTICS_GROUP_MAX] = {
|
||||||
STR_NETWORK,
|
STR_NETWORK,
|
||||||
STR_LEGEND_BASE,
|
STR_NETWORK_LEGEND_BASE,
|
||||||
STR_LEGEND_COMMANDS,
|
STR_NETWORK_LEGEND_COMMANDS,
|
||||||
STR_LEGEND_MAPDATA,
|
STR_NETWORK_LEGEND_MAPDATA,
|
||||||
};
|
};
|
||||||
|
|
||||||
static rct_window_event_list window_network_information_events = {
|
static rct_window_event_list window_network_information_events = {
|
||||||
@@ -285,9 +285,10 @@ static void window_network_information_update(rct_window* w)
|
|||||||
_networkHistory.push_back(_networkLastDeltaStats);
|
_networkHistory.push_back(_networkLastDeltaStats);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void format_readable_size(char* buf, uint64_t bytes)
|
static void format_readable_size(char* buf, size_t bufSize, uint64_t bytes)
|
||||||
{
|
{
|
||||||
constexpr const char* SizeTable[] = { "B", "KB", "MB", "GB", "TB" };
|
constexpr uint32_t SizeTable[] = { STR_SIZE_BYTE, STR_SIZE_KILOBYTE, STR_SIZE_MEGABYTE, STR_SIZE_GIGABYTE,
|
||||||
|
STR_SIZE_TERABYTE };
|
||||||
|
|
||||||
double size = bytes;
|
double size = bytes;
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
@@ -297,7 +298,21 @@ static void format_readable_size(char* buf, uint64_t bytes)
|
|||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(buf, "%.03f %s", size, SizeTable[idx]);
|
char sizeType[128] = {};
|
||||||
|
format_string(sizeType, sizeof(sizeType), SizeTable[idx], nullptr);
|
||||||
|
|
||||||
|
sprintf(buf, "%.03f %s", size, sizeType);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void format_readable_speed(char* buf, size_t bufSize, uint64_t bytes)
|
||||||
|
{
|
||||||
|
char sizeText[128] = {};
|
||||||
|
format_readable_size(sizeText, sizeof(sizeText), bytes);
|
||||||
|
|
||||||
|
const char* args[1] = {
|
||||||
|
sizeText,
|
||||||
|
};
|
||||||
|
format_string(buf, bufSize, STR_NETWORK_SPEED_SEC, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_network_information_invalidate(rct_window* w)
|
static void window_network_information_invalidate(rct_window* w)
|
||||||
@@ -393,7 +408,7 @@ static void window_network_information_paint(rct_window* w, rct_drawpixelinfo* d
|
|||||||
constexpr int32_t padding = 5;
|
constexpr int32_t padding = 5;
|
||||||
constexpr int32_t heightTab = 43;
|
constexpr int32_t heightTab = 43;
|
||||||
constexpr int32_t textHeight = 12;
|
constexpr int32_t textHeight = 12;
|
||||||
constexpr int32_t graphBarWidth = 1;
|
const int32_t graphBarWidth = std::min(1, w->width / WH);
|
||||||
const int32_t totalHeight = w->height;
|
const int32_t totalHeight = w->height;
|
||||||
const int32_t totalHeightText = (textHeight + (padding * 2)) * 3;
|
const int32_t totalHeightText = (textHeight + (padding * 2)) * 3;
|
||||||
const int32_t graphHeight = (totalHeight - totalHeightText - heightTab) / 2;
|
const int32_t graphHeight = (totalHeight - totalHeightText - heightTab) / 2;
|
||||||
@@ -408,13 +423,15 @@ static void window_network_information_paint(rct_window* w, rct_drawpixelinfo* d
|
|||||||
|
|
||||||
// Received stats.
|
// Received stats.
|
||||||
{
|
{
|
||||||
sprintf(textBuffer, "%-6u %.2f B/s", _bytesIn, _bytesInSec);
|
gfx_draw_string_left(dpi, STR_NETWORK_RECEIVE, nullptr, PALETTE_INDEX_10, x, y);
|
||||||
gfx_draw_string_left(dpi, STR_BYTES_IN, nullptr, PALETTE_INDEX_10, x, y);
|
|
||||||
|
format_readable_speed(textBuffer, sizeof(textBuffer), _bytesInSec);
|
||||||
gfx_draw_string(dpi, textBuffer, PALETTE_INDEX_10, x + 70, y);
|
gfx_draw_string(dpi, textBuffer, PALETTE_INDEX_10, x + 70, y);
|
||||||
|
|
||||||
format_readable_size(textBuffer, _networkStats.bytesReceived[NETWORK_STATISTICS_GROUP_TOTAL]);
|
gfx_draw_string_left(dpi, STR_NETWORK_TOTAL_RECEIVED, nullptr, PALETTE_INDEX_10, x + 200, y);
|
||||||
gfx_draw_string_left(dpi, STR_TOTAL_IN, nullptr, PALETTE_INDEX_10, x + 200, y);
|
|
||||||
gfx_draw_string(dpi, textBuffer, PALETTE_INDEX_10, x + 260, y);
|
format_readable_size(textBuffer, sizeof(textBuffer), _networkStats.bytesReceived[NETWORK_STATISTICS_GROUP_TOTAL]);
|
||||||
|
gfx_draw_string(dpi, textBuffer, PALETTE_INDEX_10, x + 300, y);
|
||||||
y += textHeight + padding;
|
y += textHeight + padding;
|
||||||
|
|
||||||
window_network_draw_graph(w, dpi, x, y, graphHeight, w->width - (padding * 2), graphBarWidth, true);
|
window_network_draw_graph(w, dpi, x, y, graphHeight, w->width - (padding * 2), graphBarWidth, true);
|
||||||
@@ -423,13 +440,15 @@ static void window_network_information_paint(rct_window* w, rct_drawpixelinfo* d
|
|||||||
|
|
||||||
// Sent stats.
|
// Sent stats.
|
||||||
{
|
{
|
||||||
sprintf(textBuffer, "%-6u %.2f B/s", _bytesOut, _bytesOutSec);
|
gfx_draw_string_left(dpi, STR_NETWORK_SEND, nullptr, PALETTE_INDEX_10, x, y);
|
||||||
gfx_draw_string_left(dpi, STR_BYTES_OUT, nullptr, PALETTE_INDEX_10, x, y);
|
|
||||||
|
format_readable_speed(textBuffer, sizeof(textBuffer), _bytesOutSec);
|
||||||
gfx_draw_string(dpi, textBuffer, PALETTE_INDEX_10, x + 70, y);
|
gfx_draw_string(dpi, textBuffer, PALETTE_INDEX_10, x + 70, y);
|
||||||
|
|
||||||
format_readable_size(textBuffer, _networkStats.bytesSent[NETWORK_STATISTICS_GROUP_TOTAL]);
|
gfx_draw_string_left(dpi, STR_NETWORK_TOTAL_SENT, nullptr, PALETTE_INDEX_10, x + 200, y);
|
||||||
gfx_draw_string_left(dpi, STR_TOTAL_OUT, nullptr, PALETTE_INDEX_10, x + 200, y);
|
|
||||||
gfx_draw_string(dpi, textBuffer, PALETTE_INDEX_10, x + 260, y);
|
format_readable_size(textBuffer, sizeof(textBuffer), _networkStats.bytesSent[NETWORK_STATISTICS_GROUP_TOTAL]);
|
||||||
|
gfx_draw_string(dpi, textBuffer, PALETTE_INDEX_10, x + 300, y);
|
||||||
y += textHeight + padding;
|
y += textHeight + padding;
|
||||||
|
|
||||||
window_network_draw_graph(w, dpi, x, y, graphHeight, w->width - (padding * 2), graphBarWidth, false);
|
window_network_draw_graph(w, dpi, x, y, graphHeight, w->width - (padding * 2), graphBarWidth, false);
|
||||||
|
|||||||
@@ -3909,15 +3909,23 @@ enum
|
|||||||
STR_NETWORK = 6284,
|
STR_NETWORK = 6284,
|
||||||
STR_NETWORK_INFORMATION_TITLE = 6285,
|
STR_NETWORK_INFORMATION_TITLE = 6285,
|
||||||
|
|
||||||
STR_BYTES_IN = 6286,
|
STR_NETWORK_RECEIVE = 6286,
|
||||||
STR_BYTES_OUT = 6287,
|
STR_NETWORK_SEND = 6287,
|
||||||
|
|
||||||
STR_TOTAL_IN = 6288,
|
STR_NETWORK_TOTAL_RECEIVED = 6288,
|
||||||
STR_TOTAL_OUT = 6289,
|
STR_NETWORK_TOTAL_SENT = 6289,
|
||||||
|
|
||||||
STR_LEGEND_BASE = 6290,
|
STR_NETWORK_LEGEND_BASE = 6290,
|
||||||
STR_LEGEND_COMMANDS = 6291,
|
STR_NETWORK_LEGEND_COMMANDS = 6291,
|
||||||
STR_LEGEND_MAPDATA = 6292,
|
STR_NETWORK_LEGEND_MAPDATA = 6292,
|
||||||
|
|
||||||
|
STR_SIZE_BYTE = 6293,
|
||||||
|
STR_SIZE_KILOBYTE = 6294,
|
||||||
|
STR_SIZE_MEGABYTE = 6295,
|
||||||
|
STR_SIZE_GIGABYTE = 6296,
|
||||||
|
STR_SIZE_TERABYTE = 6297,
|
||||||
|
|
||||||
|
STR_NETWORK_SPEED_SEC = 6298,
|
||||||
|
|
||||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||||
STR_COUNT = 32768
|
STR_COUNT = 32768
|
||||||
|
|||||||
Reference in New Issue
Block a user