mirror of https://github.com/OpenTTD/OpenTTD
(svn r21184) [1.0] -Backport from trunk:
- Fix: Reading (very) recently freed memory (r21182) - Fix: [Windows] Make sure to be upgraded openttd is not running when installing [FS#4212] (r21146)release/1.0
parent
618f8b7836
commit
8241931ef8
|
@ -102,6 +102,9 @@ Page custom SelectCDEnter SelectCDExit ": TTD folder"
|
||||||
;--------------------------------------------------------------
|
;--------------------------------------------------------------
|
||||||
; (Core) OpenTTD install section. Copies all internal game data
|
; (Core) OpenTTD install section. Copies all internal game data
|
||||||
Section "!OpenTTD" Section1
|
Section "!OpenTTD" Section1
|
||||||
|
; Make sure to be upgraded OpenTTD is not running
|
||||||
|
Call CheckOpenTTDRunning
|
||||||
|
|
||||||
; Overwrite files by default, but don't complain on failure
|
; Overwrite files by default, but don't complain on failure
|
||||||
SetOverwrite try
|
SetOverwrite try
|
||||||
|
|
||||||
|
@ -520,7 +523,6 @@ Abort:
|
||||||
Done:
|
Done:
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
; Check whether we're not running an installer for NT on 9x and vice versa
|
; Check whether we're not running an installer for NT on 9x and vice versa
|
||||||
Function CheckWindowsVersion
|
Function CheckWindowsVersion
|
||||||
|
@ -540,6 +542,23 @@ Abort:
|
||||||
Done:
|
Done:
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------------
|
||||||
|
; Check whether OpenTTD is running
|
||||||
|
Function CheckOpenTTDRunning
|
||||||
|
IfFileExists "$INSTDIR\openttd.exe" 0 Done
|
||||||
|
Retry:
|
||||||
|
FindProcDLL::FindProc "openttd.exe"
|
||||||
|
Pop $R0
|
||||||
|
IntCmp $R0 1 0 Done
|
||||||
|
ClearErrors
|
||||||
|
Delete "$INSTDIR\openttd.exe"
|
||||||
|
IfErrors 0 Done
|
||||||
|
ClearErrors
|
||||||
|
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "OpenTTD is running. Please close it and retry." IDRETRY Retry
|
||||||
|
Abort
|
||||||
|
Done:
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
Var OLDVERSION
|
Var OLDVERSION
|
||||||
Var UninstallString
|
Var UninstallString
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,8 @@ void NetworkTCPSocketHandler::Send_Packet(Packet *packet)
|
||||||
* data right now (full network-buffer, it happens ;))
|
* data right now (full network-buffer, it happens ;))
|
||||||
* 3) sending took too long
|
* 3) sending took too long
|
||||||
* @param closing_down Whether we are closing down the connection.
|
* @param closing_down Whether we are closing down the connection.
|
||||||
|
* @return \c true if a (part of a) packet could be sent and
|
||||||
|
* the connection is not closed yet.
|
||||||
*/
|
*/
|
||||||
bool NetworkTCPSocketHandler::Send_Packets(bool closing_down)
|
bool NetworkTCPSocketHandler::Send_Packets(bool closing_down)
|
||||||
{
|
{
|
||||||
|
|
|
@ -681,7 +681,7 @@ static void NetworkClose()
|
||||||
FOR_ALL_CLIENT_SOCKETS(cs) {
|
FOR_ALL_CLIENT_SOCKETS(cs) {
|
||||||
if (!_network_server) {
|
if (!_network_server) {
|
||||||
SEND_COMMAND(PACKET_CLIENT_QUIT)();
|
SEND_COMMAND(PACKET_CLIENT_QUIT)();
|
||||||
cs->Send_Packets();
|
cs->Send_Packets(true);
|
||||||
}
|
}
|
||||||
NetworkCloseClient(cs, NETWORK_RECV_STATUS_CONN_LOST);
|
NetworkCloseClient(cs, NETWORK_RECV_STATUS_CONN_LOST);
|
||||||
}
|
}
|
||||||
|
@ -1012,9 +1012,7 @@ static void NetworkSend()
|
||||||
NetworkClientSocket *cs;
|
NetworkClientSocket *cs;
|
||||||
FOR_ALL_CLIENT_SOCKETS(cs) {
|
FOR_ALL_CLIENT_SOCKETS(cs) {
|
||||||
if (cs->writable) {
|
if (cs->writable) {
|
||||||
cs->Send_Packets();
|
if (cs->Send_Packets() && cs->status == STATUS_MAP) {
|
||||||
|
|
||||||
if (cs->status == STATUS_MAP) {
|
|
||||||
/* This client is in the middle of a map-send, call the function for that */
|
/* This client is in the middle of a map-send, call the function for that */
|
||||||
SEND_COMMAND(PACKET_SERVER_MAP)(cs);
|
SEND_COMMAND(PACKET_SERVER_MAP)(cs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -412,8 +412,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_MAP)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send all packets (forced) and check if we have send it all */
|
/* Send all packets (forced) and check if we have send it all */
|
||||||
cs->Send_Packets();
|
if (cs->Send_Packets() && cs->IsPacketQueueEmpty()) {
|
||||||
if (cs->IsPacketQueueEmpty()) {
|
|
||||||
/* All are sent, increase the sent_packets */
|
/* All are sent, increase the sent_packets */
|
||||||
sent_packets *= 2;
|
sent_packets *= 2;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue