1
0
Fork 0

(svn r24075) [1.2] -Backport from trunk:

- Fix: Reversing trains while they were entering or leaving a depot could lead to stuck trains [FS#5093] (r24071)
- Fix: The 'last joined' server was not properly selected anymore [FS#5098] (r24070)
- Fix: Immediately start querying the last joined server instead of waiting for the requery loop [FS#5097] (r24069, r24062)
- Fix: Make the full snowedness level of houses the same as roads and rails [FS#5121] (r24064)
release/1.2
rubidium 2012-03-26 20:41:21 +00:00
parent 557be445af
commit 2a13e8c184
7 changed files with 18 additions and 18 deletions

View File

@ -62,7 +62,7 @@ static void NetworkGameListHandleDelayedInsert()
} }
item->manually |= ins_item->manually; item->manually |= ins_item->manually;
if (item->manually) NetworkRebuildHostList(); if (item->manually) NetworkRebuildHostList();
UpdateNetworkGameWindow(false); UpdateNetworkGameWindow();
} }
free(ins_item); free(ins_item);
} }
@ -105,7 +105,7 @@ NetworkGameList *NetworkGameListAddItem(NetworkAddress address)
} }
DEBUG(net, 4, "[gamelist] added server to list"); DEBUG(net, 4, "[gamelist] added server to list");
UpdateNetworkGameWindow(false); UpdateNetworkGameWindow();
return item; return item;
} }
@ -132,7 +132,7 @@ void NetworkGameListRemoveItem(NetworkGameList *remove)
DEBUG(net, 4, "[gamelist] removed server from list"); DEBUG(net, 4, "[gamelist] removed server from list");
NetworkRebuildHostList(); NetworkRebuildHostList();
UpdateNetworkGameWindow(false); UpdateNetworkGameWindow();
return; return;
} }
prev_item = item; prev_item = item;

View File

@ -72,9 +72,9 @@ void SortNetworkLanguages()
* found on the network. * found on the network.
* @param unselect unselect the currently selected item * @param unselect unselect the currently selected item
*/ */
void UpdateNetworkGameWindow(bool unselect) void UpdateNetworkGameWindow()
{ {
InvalidateWindowData(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME, unselect ? 1 : 0); InvalidateWindowData(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME, 0);
} }
typedef GUIList<NetworkGameList*> GUIGameServerList; typedef GUIList<NetworkGameList*> GUIGameServerList;
@ -438,6 +438,9 @@ protected:
public: public:
NetworkGameWindow(const WindowDesc *desc) : QueryStringBaseWindow(NETWORK_CLIENT_NAME_LENGTH) NetworkGameWindow(const WindowDesc *desc) : QueryStringBaseWindow(NETWORK_CLIENT_NAME_LENGTH)
{ {
this->list_pos = SLP_INVALID;
this->server = NULL;
this->CreateNestedTree(desc); this->CreateNestedTree(desc);
this->vscroll = this->GetScrollbar(WID_NG_SCROLLBAR); this->vscroll = this->GetScrollbar(WID_NG_SCROLLBAR);
this->FinishInitNested(desc, WN_NETWORK_WINDOW_GAME); this->FinishInitNested(desc, WN_NETWORK_WINDOW_GAME);
@ -447,11 +450,10 @@ public:
InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 120); InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 120);
this->SetFocusedWidget(WID_NG_CLIENT); this->SetFocusedWidget(WID_NG_CLIENT);
UpdateNetworkGameWindow(true);
this->field = WID_NG_CLIENT; this->field = WID_NG_CLIENT;
this->last_joined = NetworkGameListAddItem(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); this->last_joined = NetworkGameListAddItem(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port));
this->server = this->last_joined; this->server = this->last_joined;
if (this->last_joined != NULL) NetworkUDPQueryServer(this->last_joined->address);
this->servers.SetListing(this->last_sorting); this->servers.SetListing(this->last_sorting);
this->servers.SetSortFuncs(this->sorter_funcs); this->servers.SetSortFuncs(this->sorter_funcs);
@ -790,10 +792,6 @@ public:
*/ */
virtual void OnInvalidateData(int data = 0, bool gui_scope = true) virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{ {
if (data == 1) {
this->server = NULL;
this->list_pos = SLP_INVALID;
}
this->servers.ForceRebuild(); this->servers.ForceRebuild();
this->SetDirty(); this->SetDirty();
} }

View File

@ -145,7 +145,7 @@ void NetworkTCPQueryServer(NetworkAddress address);
void GetBindAddresses(NetworkAddressList *addresses, uint16 port); void GetBindAddresses(NetworkAddressList *addresses, uint16 port);
void NetworkAddServer(const char *b); void NetworkAddServer(const char *b);
void NetworkRebuildHostList(); void NetworkRebuildHostList();
void UpdateNetworkGameWindow(bool unselect); void UpdateNetworkGameWindow();
bool IsNetworkCompatibleVersion(const char *version); bool IsNetworkCompatibleVersion(const char *version);

View File

@ -395,7 +395,7 @@ void ClientNetworkUDPSocketHandler::Receive_SERVER_RESPONSE(Packet *p, NetworkAd
item->online = true; item->online = true;
UpdateNetworkGameWindow(false); UpdateNetworkGameWindow();
} }
void ClientNetworkUDPSocketHandler::Receive_MASTER_RESPONSE_LIST(Packet *p, NetworkAddress *client_addr) void ClientNetworkUDPSocketHandler::Receive_MASTER_RESPONSE_LIST(Packet *p, NetworkAddress *client_addr)

View File

@ -369,7 +369,8 @@ Train *GetTrainForReservation(TileIndex tile, Track track)
*/ */
bool IsSafeWaitingPosition(const Train *v, TileIndex tile, Trackdir trackdir, bool include_line_end, bool forbid_90deg) bool IsSafeWaitingPosition(const Train *v, TileIndex tile, Trackdir trackdir, bool include_line_end, bool forbid_90deg)
{ {
if (IsRailDepotTile(tile)) return true; /* A depot is safe if we enter it, but not when we exit. */
if (IsRailDepotTile(tile) && TrackdirToExitdir(trackdir) != GetRailDepotDirection(tile)) return true;
if (IsTileType(tile, MP_RAILWAY)) { if (IsTileType(tile, MP_RAILWAY)) {
/* For non-pbs signals, stop on the signal tile. */ /* For non-pbs signals, stop on the signal tile. */

View File

@ -2171,8 +2171,8 @@ static bool BuildTownHouse(Town *t, TileIndex tile)
/* no house allowed at all, bail out */ /* no house allowed at all, bail out */
if (!CanBuildHouseHere(tile, t->index, false)) return false; if (!CanBuildHouseHere(tile, t->index, false)) return false;
int z; Slope slope = GetTileSlope(tile);
Slope slope = GetTileSlope(tile, &z); int maxz = GetTileMaxZ(tile);
/* Get the town zone type of the current tile, as well as the climate. /* Get the town zone type of the current tile, as well as the climate.
* This will allow to easily compare with the specs of the new house to build */ * This will allow to easily compare with the specs of the new house to build */
@ -2180,7 +2180,7 @@ static bool BuildTownHouse(Town *t, TileIndex tile)
/* Above snow? */ /* Above snow? */
int land = _settings_game.game_creation.landscape; int land = _settings_game.game_creation.landscape;
if (land == LT_ARCTIC && z >= HighestSnowLine()) land = -1; if (land == LT_ARCTIC && maxz > HighestSnowLine()) land = -1;
uint bitmask = (1 << rad) + (1 << (land + 12)); uint bitmask = (1 << rad) + (1 << (land + 12));
@ -2215,7 +2215,6 @@ static bool BuildTownHouse(Town *t, TileIndex tile)
houses[num++] = (HouseID)i; houses[num++] = (HouseID)i;
} }
int maxz = GetTileMaxZ(tile);
TileIndex baseTile = tile; TileIndex baseTile = tile;
while (probability_max > 0) { while (probability_max > 0) {

View File

@ -2200,6 +2200,8 @@ void FreeTrainTrackReservation(const Train *v, TileIndex origin, Trackdir orig_t
bool free_tile = tile != v->tile || !(IsRailStationTile(v->tile) || IsTileType(v->tile, MP_TUNNELBRIDGE)); bool free_tile = tile != v->tile || !(IsRailStationTile(v->tile) || IsTileType(v->tile, MP_TUNNELBRIDGE));
StationID station_id = IsRailStationTile(v->tile) ? GetStationIndex(v->tile) : INVALID_STATION; StationID station_id = IsRailStationTile(v->tile) ? GetStationIndex(v->tile) : INVALID_STATION;
/* A train inside a depot can't have a reservation. */
if (v->track == TRACK_BIT_DEPOT) return;
/* Don't free reservation if it's not ours. */ /* Don't free reservation if it's not ours. */
if (TracksOverlap(GetReservedTrackbits(tile) | TrackToTrackBits(TrackdirToTrack(td)))) return; if (TracksOverlap(GetReservedTrackbits(tile) | TrackToTrackBits(TrackdirToTrack(td)))) return;