1
0
Fork 0

(svn r27591) [1.6] -Backport from trunk:

- Change: Performance improvement for dedicated servers by skipping drawing calls earlier in the process [FS#6402] (r27579)
- Fix: Vehicles could not be hidden from the purchase list when they were in exclusive preview [FS#6454] (r27578)
- Fix: Dock and roadstop picker, client list and town authority window did not auto-resize according to their content when they were positioned at the bottom of the screen [FS#6386] (r27577)
- Fix: Various incorrect but uncritical size computations in the content client [FS#6449] (r27576, r27570)
release/1.6
frosch 2016-05-29 19:05:11 +00:00
parent 8b5936c224
commit 4b4e8f0a1e
8 changed files with 19 additions and 12 deletions

View File

@ -433,7 +433,7 @@ public:
* Never make the window smaller to avoid oscillating if the size change affects the acceptance.
* (This is the case, if making the window bigger moves the mouse into the window.) */
if (top > bottom) {
ResizeWindow(this, 0, top - bottom);
ResizeWindow(this, 0, top - bottom, false);
}
}

View File

@ -879,7 +879,7 @@ CommandCost CmdSetVehicleVisibility(TileIndex tile, DoCommandFlag flags, uint32
{
Engine *e = Engine::GetIfValid(GB(p2, 0, 31));
if (e == NULL || _current_company >= MAX_COMPANIES) return CMD_ERROR;
if ((e->flags & ENGINE_AVAILABLE) == 0 || !HasBit(e->company_avail, _current_company)) return CMD_ERROR;
if (!IsEngineBuildable(e->index, e->type, _current_company)) return CMD_ERROR;
if ((flags & DC_EXEC) != 0) {
SB(e->company_hidden, _current_company, 1, GB(p2, 31, 1));

View File

@ -57,7 +57,7 @@ bool ClientNetworkContentSocketHandler::Receive_SERVER_INFO(Packet *p)
ci->filesize = p->Recv_uint32();
p->Recv_string(ci->name, lengthof(ci->name));
p->Recv_string(ci->version, lengthof(ci->name));
p->Recv_string(ci->version, lengthof(ci->version));
p->Recv_string(ci->url, lengthof(ci->url));
p->Recv_string(ci->description, lengthof(ci->description), SVS_REPLACE_WITH_QUESTION_MARK | SVS_ALLOW_NEWLINE);
@ -220,10 +220,9 @@ void ClientNetworkContentSocketHandler::RequestContentList(uint count, const Con
while (count > 0) {
/* We can "only" send a limited number of IDs in a single packet.
* A packet begins with the packet size and a byte for the type.
* Then this packet adds a byte for the content type and a uint16
* for the count in this packet. The rest of the packet can be
* used for the IDs. */
uint p_count = min(count, (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32));
* Then this packet adds a uint16 for the count in this packet.
* The rest of the packet can be used for the IDs. */
uint p_count = min(count, (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32));
Packet *p = new Packet(PACKET_CONTENT_CLIENT_INFO_ID);
p->Send_uint16(p_count);
@ -249,9 +248,9 @@ void ClientNetworkContentSocketHandler::RequestContentList(ContentVector *cv, bo
this->Connect();
/* 20 is sizeof(uint32) + sizeof(md5sum (byte[16])) */
assert(cv->Length() < 255);
assert(cv->Length() < (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint8)) / (send_md5sum ? 20 : sizeof(uint32)));
assert(cv->Length() < (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint8)) /
(sizeof(uint8) + sizeof(uint32) + (send_md5sum ? /*sizeof(ContentInfo::md5sum)*/16 : 0)));
Packet *p = new Packet(send_md5sum ? PACKET_CONTENT_CLIENT_INFO_EXTID_MD5 : PACKET_CONTENT_CLIENT_INFO_EXTID);
p->Send_uint8(cv->Length());

View File

@ -1892,7 +1892,7 @@ struct NetworkClientListWindow : Window {
int diff = (num + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM) - (this->GetWidget<NWidgetBase>(WID_CL_PANEL)->current_y);
/* If height is changed */
if (diff != 0) {
ResizeWindow(this, 0, diff);
ResizeWindow(this, 0, diff, false);
return false;
}
return true;

View File

@ -1002,7 +1002,7 @@ struct BuildRoadStationWindow : public PickerWindowBase {
* Never make the window smaller to avoid oscillating if the size change affects the acceptance.
* (This is the case, if making the window bigger moves the mouse into the window.) */
if (top > bottom) {
ResizeWindow(this, 0, top - bottom);
ResizeWindow(this, 0, top - bottom, false);
}
}

View File

@ -177,7 +177,7 @@ public:
y = y + WD_FRAMERECT_BOTTOM - nwid->pos_y; // Compute needed size of the widget.
if (y > nwid->current_y) {
/* If the company list is too big to fit, mark ourself dirty and draw again. */
ResizeWindow(this, 0, y - nwid->current_y);
ResizeWindow(this, 0, y - nwid->current_y, false);
}
}

View File

@ -23,6 +23,7 @@
#include "transport_type.h"
#include "group_type.h"
#include "base_consist.h"
#include "network/network.h"
#include <list>
#include <map>
@ -1072,6 +1073,9 @@ struct SpecializedVehicle : public Vehicle {
*/
inline void UpdateViewport(bool force_update, bool update_delta)
{
/* Skip updating sprites on dedicated servers without screen */
if (_network_dedicated) return;
/* Explicitly choose method to call to prevent vtable dereference -
* it gives ~3% runtime improvements in games with many vehicles */
if (update_delta) ((T *)this)->T::UpdateDeltaXY(this->direction);

View File

@ -3031,6 +3031,10 @@ void UpdateWindows()
w->ProcessHighlightedInvalidations();
}
/* Skip the actual drawing on dedicated servers without screen.
* But still empty the invalidation queues above. */
if (_network_dedicated) return;
static int we4_timer = 0;
int t = we4_timer + 1;