Merge branch 'master' into jgrpp

# Conflicts:
#	src/articulated_vehicles.cpp
#	src/articulated_vehicles.h
#	src/base_media_base.h
#	src/base_media_func.h
#	src/build_vehicle_gui.cpp
#	src/dock_gui.cpp
#	src/main_gui.cpp
#	src/music_gui.cpp
#	src/network/network_chat_gui.cpp
#	src/network/network_content.cpp
#	src/newgrf.cpp
#	src/newgrf_roadstop.cpp
#	src/os/windows/string_uniscribe.h
#	src/os/windows/win32.cpp
#	src/rail_gui.cpp
#	src/road.cpp
#	src/road_gui.cpp
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/smallmap_gui.cpp
#	src/strings.cpp
#	src/terraform_gui.cpp
#	src/tests/test_script_admin.cpp
#	src/tests/test_window_desc.cpp
#	src/timer/timer_game_calendar.h
#	src/vehicle.cpp
#	src/vehicle_base.h
#	src/viewport.cpp
#	src/widget_type.h
#	src/window.cpp
#	src/window_gui.h
This commit is contained in:
Jonathan G Rennison
2023-11-29 20:32:54 +00:00
154 changed files with 1094 additions and 798 deletions

View File

@@ -65,7 +65,7 @@ static std::chrono::steady_clock::time_point _chatmessage_dirty_time;
* the left and pixels from the bottom. The height is the maximum height.
*/
static PointDimension _chatmsg_box;
static uint8 *_chatmessage_backup = nullptr; ///< Backup in case text is moved.
static ReusableBuffer<uint8_t> _chatmessage_backup; ///< Backup in case text is moved.
/**
* Test if there are any chat messages to display.
@@ -112,7 +112,6 @@ void NetworkReInitChatBoxSize()
{
_chatmsg_box.y = 3 * FONT_HEIGHT_NORMAL;
_chatmsg_box.height = MAX_CHAT_MESSAGES * (FONT_HEIGHT_NORMAL + ScaleGUITrad(NETWORK_CHAT_LINE_SPACING)) + ScaleGUITrad(4);
_chatmessage_backup = ReallocT(_chatmessage_backup, static_cast<size_t>(_chatmsg_box.width) * _chatmsg_box.height * BlitterFactory::GetCurrentBlitter()->GetBytesPerPixel());
}
/** Initialize all buffers of the chat visualisation. */
@@ -165,7 +164,7 @@ void NetworkUndrawChatMessage()
_chatmessage_visible = false;
/* Put our 'shot' back to the screen */
blitter->CopyFromBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _chatmessage_backup, width, height);
blitter->CopyFromBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _chatmessage_backup.GetBuffer(), width, height);
/* And make sure it is updated next time */
VideoDriver::GetInstance()->MakeDirty(x, y, width, height);
@@ -218,10 +217,9 @@ void NetworkDrawChatMessage()
}
if (width <= 0 || height <= 0) return;
assert(blitter->BufferSize(width, height) <= static_cast<size_t>(_chatmsg_box.width) * _chatmsg_box.height * blitter->GetBytesPerPixel());
/* Make a copy of the screen as it is before painting (for undraw) */
blitter->CopyToBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _chatmessage_backup, width, height);
uint8_t *buffer = _chatmessage_backup.Allocate(BlitterFactory::GetCurrentBlitter()->BufferSize(width, height));
blitter->CopyToBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), buffer, width, height);
_cur_dpi = &_screen; // switch to _screen painting
@@ -520,7 +518,7 @@ static const NWidgetPart _nested_chat_window_widgets[] = {
};
/** The description of the chat window. */
static WindowDesc _chat_window_desc(
static WindowDesc _chat_window_desc(__FILE__, __LINE__,
WDP_MANUAL, nullptr, 0, 0,
WC_SEND_NETWORK_MSG, WC_NONE,
WDF_NETWORK,

View File

@@ -200,9 +200,9 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::CloseConnection(NetworkRecvSta
ShutdownSocket(this->sock, false, true, 2);
/* Wait a number of ticks so our leave message can reach the server.
* This is especially needed for Windows servers as they seem to get
* the "socket is closed" message before receiving our leave message,
* which would trigger the server to close the connection as well. */
* This is especially needed for Windows servers as they seem to get
* the "socket is closed" message before receiving our leave message,
* which would trigger the server to close the connection as well. */
CSleep(3 * MILLISECONDS_PER_TICK);
}

View File

@@ -93,7 +93,7 @@ static const NWidgetPart _nested_network_content_download_status_window_widgets[
};
/** Window description for the download window */
static WindowDesc _network_content_download_status_window_desc(
static WindowDesc _network_content_download_status_window_desc(__FILE__, __LINE__,
WDP_CENTER, nullptr, 0, 0,
WC_NETWORK_STATUS_WINDOW, WC_NONE,
WDF_MODAL,
@@ -1068,7 +1068,7 @@ static const NWidgetPart _nested_network_content_list_widgets[] = {
NWidget(NWID_VSCROLLBAR, COLOUR_LIGHT_BLUE, WID_NCL_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(0, 8, 0),
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_NCL_SEL_ALL_UPDATE), SetResize(1, 0), SetFill(1, 0),
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_NCL_SEL_ALL_UPDATE),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_SELECT_UPDATE), SetResize(1, 0), SetFill(1, 0),
SetDataTip(STR_CONTENT_SELECT_UPDATES_CAPTION, STR_CONTENT_SELECT_UPDATES_CAPTION_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_SELECT_ALL), SetResize(1, 0), SetFill(1, 0),
@@ -1113,7 +1113,7 @@ static const NWidgetPart _nested_network_content_list_widgets[] = {
};
/** Window description of the content list */
static WindowDesc _network_content_list_desc(
static WindowDesc _network_content_list_desc(__FILE__, __LINE__,
WDP_CENTER, "list_content", 630, 460,
WC_NETWORK_WINDOW, WC_NONE,
0,

View File

@@ -133,7 +133,7 @@ public:
this->smallest_x = this->head->smallest_x + this->tail->smallest_x; // First and last are always shown, rest not
}
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override
{
assert(given_width >= this->smallest_x && given_height >= this->smallest_y);
@@ -962,7 +962,7 @@ static const NWidgetPart _nested_network_game_widgets[] = {
EndContainer(),
};
static WindowDesc _network_game_window_desc(
static WindowDesc _network_game_window_desc(__FILE__, __LINE__,
WDP_CENTER, "list_servers", 1000, 730,
WC_NETWORK_WINDOW, WC_NONE,
WDF_NETWORK,
@@ -1229,7 +1229,7 @@ static const NWidgetPart _nested_network_start_server_window_widgets[] = {
EndContainer(),
};
static WindowDesc _network_start_server_window_desc(
static WindowDesc _network_start_server_window_desc(__FILE__, __LINE__,
WDP_CENTER, nullptr, 0, 0,
WC_NETWORK_WINDOW, WC_NONE,
WDF_NETWORK,
@@ -1308,7 +1308,7 @@ static const NWidgetPart _nested_client_list_widgets[] = {
EndContainer(),
};
static WindowDesc _client_list_desc(
static WindowDesc _client_list_desc(__FILE__, __LINE__,
WDP_AUTO, "list_clients", 220, 300,
WC_CLIENT_LIST, WC_NONE,
WDF_NETWORK,
@@ -2218,7 +2218,7 @@ static const NWidgetPart _nested_network_join_status_window_widgets[] = {
EndContainer(),
};
static WindowDesc _network_join_status_window_desc(
static WindowDesc _network_join_status_window_desc(__FILE__, __LINE__,
WDP_CENTER, nullptr, 0, 0,
WC_NETWORK_STATUS_WINDOW, WC_NONE,
WDF_MODAL | WDF_NETWORK,
@@ -2340,7 +2340,7 @@ static const NWidgetPart _nested_network_company_password_window_widgets[] = {
EndContainer(),
};
static WindowDesc _network_company_password_window_desc(
static WindowDesc _network_company_password_window_desc(__FILE__, __LINE__,
WDP_AUTO, nullptr, 0, 0,
WC_COMPANY_PASSWORD_WINDOW, WC_NONE,
WDF_NETWORK,
@@ -2449,7 +2449,7 @@ static const NWidgetPart _nested_network_ask_relay_widgets[] = {
EndContainer(),
};
static WindowDesc _network_ask_relay_desc(
static WindowDesc _network_ask_relay_desc(__FILE__, __LINE__,
WDP_CENTER, nullptr, 0, 0,
WC_NETWORK_ASK_RELAY, WC_NONE,
WDF_MODAL | WDF_NETWORK,
@@ -2547,7 +2547,7 @@ static const NWidgetPart _nested_network_ask_survey_widgets[] = {
EndContainer(),
};
static WindowDesc _network_ask_survey_desc(
static WindowDesc _network_ask_survey_desc(__FILE__, __LINE__,
WDP_CENTER, nullptr, 0, 0,
WC_NETWORK_ASK_SURVEY, WC_NONE,
WDF_MODAL,