mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-28 06:34:33 +01:00
(svn r22099) [1.1] -Backport from trunk:
- Fix: Remove invalid keycodes when reading hotkeys.cfg [FS#4510] (r22094) - Fix: The server list did not get sorted with one item in it, so the 'position in the list' variable was never updated causing problems when using the keyboard shortcuts for scrolling [FS#4514] (r22093) - Fix: When deleting towns, only relocate objects during DC_EXEC (r22087)
This commit is contained in:
@@ -95,8 +95,14 @@ static uint16 ParseKeycode(const char *start, const char *end)
|
||||
uint16 code = ParseCode(start, cur);
|
||||
if (code == 0) return 0;
|
||||
if (code & WKC_SPECIAL_KEYS) {
|
||||
/* Some completely wrong keycode we don't support. */
|
||||
if (code & ~WKC_SPECIAL_KEYS) return 0;
|
||||
keycode |= code;
|
||||
} else {
|
||||
/* Ignore invalid keycodes */
|
||||
if (code >= 128) {
|
||||
return 0;
|
||||
}
|
||||
/* Ignore the code if it has more then 1 letter. */
|
||||
if (keycode & ~WKC_SPECIAL_KEYS) return 0;
|
||||
keycode |= code;
|
||||
|
||||
@@ -347,7 +347,12 @@ protected:
|
||||
/** Sort the server list */
|
||||
void SortNetworkGameList()
|
||||
{
|
||||
if (!this->servers.Sort()) return;
|
||||
bool did_sort = this->servers.Sort();
|
||||
/* In case of 0 or 1 servers there is no sorting, thus this->list_pos
|
||||
* isn't set to a "sane" value. So, we only take the short way out
|
||||
* when we did not (re)sort and we have a valid this->list_pos, or
|
||||
* there are no servers to actually select. */
|
||||
if (!did_sort && (this->list_pos != SLP_INVALID || this->servers.Length() == 0)) return;
|
||||
|
||||
/* After sorting ngl->sort_list contains the sorted items. Put these back
|
||||
* into the original list. Basically nothing has changed, we are only
|
||||
|
||||
@@ -285,7 +285,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::CloseConnection(NetworkRecvSta
|
||||
NetworkClientSocket *cs;
|
||||
FOR_ALL_CLIENT_SOCKETS(cs) {
|
||||
if (cs->writable) {
|
||||
if (cs->SendPackets() && cs->status == STATUS_MAP) {
|
||||
if (cs->SendPackets() != SPS_CLOSED && cs->status == STATUS_MAP) {
|
||||
/* This client is in the middle of a map-send, call the function for that */
|
||||
cs->SendMap();
|
||||
}
|
||||
|
||||
@@ -2419,7 +2419,7 @@ CommandCost CmdDeleteTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
try_clear = true;
|
||||
} else {
|
||||
/* Tell to find a new town. */
|
||||
o->town = NULL;
|
||||
if (flags & DC_EXEC) o->town = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user