Merge svn r27779

Conflicts:
	src/autoreplace_gui.cpp
	src/economy.cpp
	src/fios_gui.cpp
	src/lang/spanish_MX.txt
	src/network/network_gui.cpp
	src/rev.cpp.in
	src/road_gui.cpp
	src/toolbar_gui.cpp
	src/window.cpp
This commit is contained in:
Sergii Pylypenko
2017-03-17 23:14:41 +02:00
287 changed files with 6065 additions and 4082 deletions

View File

@@ -55,8 +55,7 @@ static const uint NETWORK_GRF_NAME_LENGTH = 80; ///< Maximum l
/**
* Maximum number of GRFs that can be sent.
* This value is related to number of handles (files) OpenTTD can open.
* This is currently 64. Two are used for configuration and sound.
* This limit is reached when PACKET_UDP_SERVER_RESPONSE reaches the maximum size of SEND_MTU bytes.
*/
static const uint NETWORK_MAX_GRF_COUNT = 62;

View File

@@ -35,7 +35,7 @@ TCPConnecter::TCPConnecter(const NetworkAddress &address) :
address(address)
{
*_tcp_connecters.Append() = this;
if (!ThreadObject::New(TCPConnecter::ThreadEntry, this, &this->thread)) {
if (!ThreadObject::New(TCPConnecter::ThreadEntry, this, &this->thread, "ottd:tcp")) {
this->Connect();
}
}

View File

@@ -520,7 +520,7 @@ bool ClientNetworkGameSocketHandler::IsConnected()
* DEF_CLIENT_RECEIVE_COMMAND has parameter: Packet *p
************/
extern bool SafeLoad(const char *filename, int mode, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = NULL);
extern bool SafeLoad(const char *filename, SaveLoadOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = NULL);
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *p)
{
@@ -836,7 +836,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet
/* The map is done downloading, load it */
ClearErrorMessages();
bool load_success = SafeLoad(NULL, SL_LOAD, GM_NORMAL, NO_DIRECTORY, lf);
bool load_success = SafeLoad(NULL, SLO_LOAD, DFT_GAME_FILE, GM_NORMAL, NO_DIRECTORY, lf);
/* Long savegame loads shouldn't affect the lag calculation! */
this->last_packet = _realtime_tick;

View File

@@ -27,7 +27,7 @@ static CommandCallback * const _callback_table[] = {
/* 0x01 */ CcBuildPrimaryVehicle,
/* 0x02 */ CcBuildAirport,
/* 0x03 */ CcBuildBridge,
/* 0x04 */ CcBuildCanal,
/* 0x04 */ CcPlaySound_SPLAT_WATER,
/* 0x05 */ CcBuildDocks,
/* 0x06 */ CcFoundTown,
/* 0x07 */ CcBuildRoadTunnel,
@@ -36,9 +36,9 @@ static CommandCallback * const _callback_table[] = {
/* 0x0A */ CcRoadDepot,
/* 0x0B */ CcRailDepot,
/* 0x0C */ CcPlaceSign,
/* 0x0D */ CcPlaySound10,
/* 0x0E */ CcPlaySound1D,
/* 0x0F */ CcPlaySound1E,
/* 0x0D */ CcPlaySound_EXPLOSION,
/* 0x0E */ CcPlaySound_SPLAT_OTHER,
/* 0x0F */ CcPlaySound_SPLAT_RAIL,
/* 0x10 */ CcStation,
/* 0x11 */ CcTerraform,
/* 0x12 */ CcAI,

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

@@ -1185,17 +1185,17 @@ struct NetworkStartServerWindow : public Window {
case WID_NSS_LOAD_GAME:
_is_network_server = true;
ShowSaveLoadDialog(SLD_LOAD_GAME);
ShowSaveLoadDialog(FT_SAVEGAME, SLO_LOAD);
break;
case WID_NSS_PLAY_SCENARIO:
_is_network_server = true;
ShowSaveLoadDialog(SLD_LOAD_SCENARIO);
ShowSaveLoadDialog(FT_SCENARIO, SLO_LOAD);
break;
case WID_NSS_PLAY_HEIGHTMAP:
_is_network_server = true;
ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP);
ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_LOAD);
break;
}
}
@@ -1889,7 +1889,7 @@ struct NetworkClientListWindow : Window {
int diffy = (num + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM) - (this->GetWidget<NWidgetBase>(WID_CL_PANEL)->current_y);
/* If height is changed */
if (diffx > 0 || diffy != 0) { // Width can only grow, also title bar can be wider than content
ResizeWindow(this, diffx, diffy);
ResizeWindow(this, diffx, diffy, false);
return false;
}
return true;

View File

@@ -109,7 +109,7 @@ static void NetworkUDPQueryServerThread(void *pntr)
void NetworkUDPQueryServer(NetworkAddress address, bool manually)
{
NetworkUDPQueryServerInfo *info = new NetworkUDPQueryServerInfo(address, manually);
if (address.IsResolved() || !ThreadObject::New(NetworkUDPQueryServerThread, info)) {
if (address.IsResolved() || !ThreadObject::New(NetworkUDPQueryServerThread, info, NULL, "ottd:udp-query")) {
NetworkUDPQueryServerThread(info);
}
}
@@ -565,7 +565,7 @@ void NetworkUDPRemoveAdvertise(bool blocking)
/* Check if we are advertising */
if (!_networking || !_network_server || !_network_udp_server) return;
if (blocking || !ThreadObject::New(NetworkUDPRemoveAdvertiseThread, NULL)) {
if (blocking || !ThreadObject::New(NetworkUDPRemoveAdvertiseThread, NULL, NULL, "ottd:udp-advert")) {
NetworkUDPRemoveAdvertiseThread(NULL);
}
}
@@ -648,7 +648,7 @@ void NetworkUDPAdvertise()
if (_next_advertisement < _last_advertisement) _next_advertisement = UINT32_MAX;
if (_next_retry < _last_advertisement) _next_retry = UINT32_MAX;
if (!ThreadObject::New(NetworkUDPAdvertiseThread, NULL)) {
if (!ThreadObject::New(NetworkUDPAdvertiseThread, NULL, NULL, "ottd:udp-advert")) {
NetworkUDPAdvertiseThread(NULL);
}
}