diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 6af8b9714c..2f952b4aa4 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1017,7 +1017,7 @@ struct BuildVehicleWindow : Window { size_t num_items = this->eng_list.Length(); this->sel_engine = (i < num_items) ? this->eng_list[i] : INVALID_ENGINE; this->SetDirty(); - if (click_count > 1) this->OnClick(pt, BUILD_VEHICLE_WIDGET_BUILD, 1); + if (click_count > 1 && !this->listview_mode) this->OnClick(pt, BUILD_VEHICLE_WIDGET_BUILD, 1); break; } diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp index 2525ae7029..e28abe0a3a 100644 --- a/src/misc_cmd.cpp +++ b/src/misc_cmd.cpp @@ -222,7 +222,7 @@ CommandCost CmdGiveMoney(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 CommandCost amount(EXPENSES_OTHER, min((Money)p1, (Money)20000000LL)); /* You can only transfer funds that is in excess of your loan */ - if (c->money - c->current_loan < amount.GetCost() || amount.GetCost() <= 0) return CMD_ERROR; + if (c->money - c->current_loan < amount.GetCost() || amount.GetCost() < 0) return CMD_ERROR; if (!_networking || !Company::IsValidID((CompanyID)p2)) return CMD_ERROR; if (flags & DC_EXEC) { diff --git a/src/network/core/tcp_game.h b/src/network/core/tcp_game.h index 5fb58aa655..c5f56486e0 100644 --- a/src/network/core/tcp_game.h +++ b/src/network/core/tcp_game.h @@ -77,6 +77,7 @@ struct CommandPacket; /** Status of a client */ enum ClientStatus { STATUS_INACTIVE, ///< The client is not connected nor active + STATUS_NEWGRFS_CHECK, ///< The client is checking NewGRFs STATUS_AUTH_GAME, ///< The client is authorizing with game (server) password STATUS_AUTH_COMPANY, ///< The client is authorizing with company password STATUS_AUTHORIZED, ///< The client is authorized diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index 4dfa05df41..c6c1a2de57 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -660,7 +660,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMPANY_INFO) DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_NEWGRFS_CHECKED) { - if (cs->status != STATUS_INACTIVE) { + if (cs->status != STATUS_NEWGRFS_CHECK) { /* Illegal call, return error and ignore the packet */ return SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_NOT_EXPECTED); } @@ -743,7 +743,10 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_JOIN) /* Make sure companies to which people try to join are not autocleaned */ if (Company::IsValidID(playas)) _network_company_states[playas].months_empty = 0; + cs->status = STATUS_NEWGRFS_CHECK; + if (_grfconfig == NULL) { + /* Behave as if we received PACKET_CLIENT_NEWGRFS_CHECKED */ return RECEIVE_COMMAND(PACKET_CLIENT_NEWGRFS_CHECKED)(cs, NULL); } @@ -1707,6 +1710,7 @@ void NetworkServerShowStatusToConsole() { static const char * const stat_str[] = { "inactive", + "checking NewGRFs", "authorizing (server password)", "authorizing (company password)", "authorized", diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 60e5050454..28392f2db2 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -333,19 +333,19 @@ Window *ShowTerraformToolbar(Window *link) { if (!Company::IsValidID(_local_company)) return NULL; - Window *w = AllocateWindowDescFront(&_terraform_desc, 0); - if (link == NULL) return w; - - if (w == NULL) { - w = FindWindowById(WC_SCEN_LAND_GEN, 0); - if (w == NULL) return NULL; - } else { - w->top -= w->height; - w->SetDirty(); + Window *w; + if (link == NULL) { + w = AllocateWindowDescFront(&_terraform_desc, 0); + return w; } - /* Align the terraform toolbar under the main toolbar and put the linked - * toolbar to left/right of it */ + /* Delete the terraform toolbar to place it again. */ + DeleteWindowById(WC_SCEN_LAND_GEN, 0, true); + w = AllocateWindowDescFront(&_terraform_desc, 0); + /* Align the terraform toolbar under the main toolbar. */ + w->top -= w->height; + w->SetDirty(); + /* Put the linked toolbar to the left / right of it. */ link->left = w->left + (_dynlang.text_dir == TD_RTL ? w->width : -link->width); link->top = w->top; link->SetDirty();