176 if (val <= 1) DrawSprite(0x3AE + val, x, y); |
176 if (val <= 1) DrawSprite(0x3AE + val, x, y); |
177 } else { |
177 } else { |
178 if (val <= 1) DrawSprite(0x347 + val, x, y); |
178 if (val <= 1) DrawSprite(0x347 + val, x, y); |
179 } |
179 } |
180 } |
180 } |
|
181 } |
|
182 |
|
183 byte ActivePlayerCount(void) |
|
184 { |
|
185 const Player *p; |
|
186 byte count = 0; |
|
187 |
|
188 FOR_ALL_PLAYERS(p) { |
|
189 if (p->is_active) count++; |
|
190 } |
|
191 |
|
192 return count; |
181 } |
193 } |
182 |
194 |
183 void InvalidatePlayerWindows(const Player *p) |
195 void InvalidatePlayerWindows(const Player *p) |
184 { |
196 { |
185 PlayerID pid = p->index; |
197 PlayerID pid = p->index; |
855 * For example in network_client.c:534? */ |
867 * For example in network_client.c:534? */ |
856 _cmd_text = ci->client_name; |
868 _cmd_text = ci->client_name; |
857 _local_player = ci->client_playas - 1; |
869 _local_player = ci->client_playas - 1; |
858 NetworkSend_Command(0, 0, 0, CMD_CHANGE_PRESIDENT_NAME, NULL); |
870 NetworkSend_Command(0, 0, 0, CMD_CHANGE_PRESIDENT_NAME, NULL); |
859 _local_player = player_backup; |
871 _local_player = player_backup; |
860 _network_game_info.companies_on++; |
|
861 } |
872 } |
862 } |
873 } |
863 } else if (_network_server) { // Creating player failed, defer client to spectator |
874 } else if (_network_server) { // Creating player failed, defer client to spectator |
864 /* XXX - UGLY! p2 (pid) is mis-used to fetch the client-id, done at server-side |
875 /* XXX - UGLY! p2 (pid) is mis-used to fetch the client-id, done at server-side |
865 * in network_server.c:838, function DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND) */ |
876 * in network_server.c:838, function DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND) */ |
866 NetworkClientInfo *ci = &_network_client_info[pid]; |
877 NetworkClientInfo *ci = &_network_client_info[pid]; |
867 ci->client_playas = OWNER_SPECTATOR; |
878 ci->client_playas = OWNER_SPECTATOR; |
868 _network_game_info.spectators_on++; |
|
869 NetworkUpdateClientInfo(ci->client_index); |
879 NetworkUpdateClientInfo(ci->client_index); |
870 } |
880 } |
871 #else |
881 #else |
872 } |
882 } |
873 #endif /* ENABLE_NETWORK */ |
883 #endif /* ENABLE_NETWORK */ |
902 ChangeOwnershipOfPlayerItems(p->index, OWNER_SPECTATOR); |
912 ChangeOwnershipOfPlayerItems(p->index, OWNER_SPECTATOR); |
903 p->money64 = p->player_money = 100000000; // XXX - wtf? |
913 p->money64 = p->player_money = 100000000; // XXX - wtf? |
904 p->is_active = false; |
914 p->is_active = false; |
905 } |
915 } |
906 RemoveAllEngineReplacementForPlayer(p); |
916 RemoveAllEngineReplacementForPlayer(p); |
907 #ifdef ENABLE_NETWORK |
|
908 _network_game_info.companies_on--; |
|
909 #endif /* ENABLE_NETWORK */ |
|
910 |
917 |
911 } break; |
918 } break; |
912 |
919 |
913 case 3: { /* Merge a company (#1) into another company (#2), elimination company #1 */ |
920 case 3: { /* Merge a company (#1) into another company (#2), elimination company #1 */ |
914 PlayerID pid_old = GB(p2, 0, 16); |
921 PlayerID pid_old = GB(p2, 0, 16); |