mirror of https://github.com/OpenTTD/OpenTTD.git
(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)
This commit is contained in:
parent
618f8b7836
commit
8241931ef8
|
@ -102,6 +102,9 @@ Page custom SelectCDEnter SelectCDExit ": TTD folder"
|
|||
;--------------------------------------------------------------
|
||||
; (Core) OpenTTD install section. Copies all internal game data
|
||||
Section "!OpenTTD" Section1
|
||||
; Make sure to be upgraded OpenTTD is not running
|
||||
Call CheckOpenTTDRunning
|
||||
|
||||
; Overwrite files by default, but don't complain on failure
|
||||
SetOverwrite try
|
||||
|
||||
|
@ -520,7 +523,6 @@ Abort:
|
|||
Done:
|
||||
FunctionEnd
|
||||
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; Check whether we're not running an installer for NT on 9x and vice versa
|
||||
Function CheckWindowsVersion
|
||||
|
@ -540,6 +542,23 @@ Abort:
|
|||
Done:
|
||||
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 UninstallString
|
||||
|
||||
|
|
|
@ -82,6 +82,8 @@ void NetworkTCPSocketHandler::Send_Packet(Packet *packet)
|
|||
* data right now (full network-buffer, it happens ;))
|
||||
* 3) sending took too long
|
||||
* @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)
|
||||
{
|
||||
|
|
|
@ -681,7 +681,7 @@ static void NetworkClose()
|
|||
FOR_ALL_CLIENT_SOCKETS(cs) {
|
||||
if (!_network_server) {
|
||||
SEND_COMMAND(PACKET_CLIENT_QUIT)();
|
||||
cs->Send_Packets();
|
||||
cs->Send_Packets(true);
|
||||
}
|
||||
NetworkCloseClient(cs, NETWORK_RECV_STATUS_CONN_LOST);
|
||||
}
|
||||
|
@ -1012,9 +1012,7 @@ static void NetworkSend()
|
|||
NetworkClientSocket *cs;
|
||||
FOR_ALL_CLIENT_SOCKETS(cs) {
|
||||
if (cs->writable) {
|
||||
cs->Send_Packets();
|
||||
|
||||
if (cs->status == STATUS_MAP) {
|
||||
if (cs->Send_Packets() && cs->status == STATUS_MAP) {
|
||||
/* This client is in the middle of a map-send, call the function for that */
|
||||
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 */
|
||||
cs->Send_Packets();
|
||||
if (cs->IsPacketQueueEmpty()) {
|
||||
if (cs->Send_Packets() && cs->IsPacketQueueEmpty()) {
|
||||
/* All are sent, increase the sent_packets */
|
||||
sent_packets *= 2;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue