equal
deleted
inserted
replaced
365 |
365 |
366 // There is no data at all.. |
366 // There is no data at all.. |
367 if (total == 0) return NETWORK_RECV_STATUS_CLOSE_QUERY; |
367 if (total == 0) return NETWORK_RECV_STATUS_CLOSE_QUERY; |
368 |
368 |
369 current = (Owner)p->Recv_uint8(); |
369 current = (Owner)p->Recv_uint8(); |
370 if (!IsValidPlayer(current)) return NETWORK_RECV_STATUS_CLOSE_QUERY; |
370 if (!IsValidPlayerID(current)) return NETWORK_RECV_STATUS_CLOSE_QUERY; |
371 |
371 |
372 p->Recv_string(_network_player_info[current].company_name, sizeof(_network_player_info[current].company_name)); |
372 p->Recv_string(_network_player_info[current].company_name, sizeof(_network_player_info[current].company_name)); |
373 _network_player_info[current].inaugurated_year = p->Recv_uint32(); |
373 _network_player_info[current].inaugurated_year = p->Recv_uint32(); |
374 _network_player_info[current].company_value = p->Recv_uint64(); |
374 _network_player_info[current].company_value = p->Recv_uint64(); |
375 _network_player_info[current].money = p->Recv_uint64(); |
375 _network_player_info[current].money = p->Recv_uint64(); |
622 // Say we received the map and loaded it correctly! |
622 // Say we received the map and loaded it correctly! |
623 SEND_COMMAND(PACKET_CLIENT_MAP_OK)(); |
623 SEND_COMMAND(PACKET_CLIENT_MAP_OK)(); |
624 |
624 |
625 /* New company/spectator (invalid player) or company we want to join is not active |
625 /* New company/spectator (invalid player) or company we want to join is not active |
626 * Switch local player to spectator and await the server's judgement */ |
626 * Switch local player to spectator and await the server's judgement */ |
627 if (_network_playas == PLAYER_NEW_COMPANY || !IsValidPlayer(_network_playas) || |
627 if (_network_playas == PLAYER_NEW_COMPANY || !IsValidPlayerID(_network_playas) || |
628 !GetPlayer(_network_playas)->is_active) { |
628 !GetPlayer(_network_playas)->is_active) { |
629 |
629 |
630 SetLocalPlayer(PLAYER_SPECTATOR); |
630 SetLocalPlayer(PLAYER_SPECTATOR); |
631 |
631 |
632 if (_network_playas != PLAYER_SPECTATOR) { |
632 if (_network_playas != PLAYER_SPECTATOR) { |
735 ci = NetworkFindClientInfoFromIndex(_network_own_client_index); |
735 ci = NetworkFindClientInfoFromIndex(_network_own_client_index); |
736 break; |
736 break; |
737 |
737 |
738 /* For speaking to company or giving money, we need the player-name */ |
738 /* For speaking to company or giving money, we need the player-name */ |
739 case NETWORK_ACTION_GIVE_MONEY: |
739 case NETWORK_ACTION_GIVE_MONEY: |
740 if (!IsValidPlayer(ci_to->client_playas)) return NETWORK_RECV_STATUS_OKAY; |
740 if (!IsValidPlayerID(ci_to->client_playas)) return NETWORK_RECV_STATUS_OKAY; |
741 /* fallthrough */ |
741 /* fallthrough */ |
742 case NETWORK_ACTION_CHAT_COMPANY: { |
742 case NETWORK_ACTION_CHAT_COMPANY: { |
743 StringID str = IsValidPlayer(ci_to->client_playas) ? STR_COMPANY_NAME : STR_NETWORK_SPECTATORS; |
743 StringID str = IsValidPlayerID(ci_to->client_playas) ? STR_COMPANY_NAME : STR_NETWORK_SPECTATORS; |
744 SetDParam(0, ci_to->client_playas); |
744 SetDParam(0, ci_to->client_playas); |
745 |
745 |
746 GetString(name, str, lastof(name)); |
746 GetString(name, str, lastof(name)); |
747 ci = NetworkFindClientInfoFromIndex(_network_own_client_index); |
747 ci = NetworkFindClientInfoFromIndex(_network_own_client_index); |
748 } break; |
748 } break; |