|
41 | 41 | #include "memory/module.hpp" |
42 | 42 | #include "memory/thread_local.hpp" |
43 | 43 | #include "networking/network_globals.hpp" |
| 44 | +#include "networking/online/online.hpp" |
44 | 45 | #include "networking/online/online_achievements.hpp" |
45 | 46 | #include "networking/tools/network_webstats.hpp" |
46 | 47 | #include "networking/tools/remote_command.hpp" |
@@ -274,23 +275,40 @@ void __cdecl game_create_players() |
274 | 275 | // simulation_notify_players_created(); |
275 | 276 | //} |
276 | 277 |
|
277 | | - if (game_is_splitscreen_deterministic()) |
| 278 | + if (!game_is_splitscreen_deterministic()) |
| 279 | + return; |
| 280 | + |
| 281 | + c_player_in_game_iterator player_iterator; |
| 282 | + player_iterator.begin(); |
| 283 | + while (player_iterator.next()) |
278 | 284 | { |
279 | | - c_player_in_game_iterator player_iterator; |
280 | | - player_iterator.begin(); |
281 | | - while (player_iterator.next()) |
| 285 | + if (!player_is_local(player_iterator.get_index())) |
| 286 | + continue; |
| 287 | + |
| 288 | + short absolute_index = player_iterator.get_absolute_index(); |
| 289 | + player_datum* player = player_iterator.get_datum(); |
| 290 | + |
| 291 | + e_controller_index controller_index = (e_controller_index)absolute_index; |
| 292 | + if (VALID_CONTROLLER(controller_index)) |
282 | 293 | { |
283 | | - if (player_is_local(player_iterator.get_index())) |
284 | | - { |
285 | | - short absolute_index = player_iterator.get_absolute_index(); |
286 | | - player_datum* player = player_iterator.get_datum(); |
| 294 | + qword player_identifier = online_local_user_get_player_identifier(controller_index); |
| 295 | + player->player_identifier = player_identifier; |
287 | 296 |
|
288 | | - if (player->configuration.host.name.is_empty()) |
289 | | - player->configuration.host.name.print(L"player_%d", absolute_index); |
| 297 | + wchar_t const* name = online_local_user_get_name(controller_index); |
290 | 298 |
|
291 | | - if (player->configuration.client.desired_name.is_empty()) |
292 | | - player->configuration.client.desired_name.print(L"player_%d", absolute_index); |
293 | | - } |
| 299 | + if (player->configuration.host.name.is_empty()) |
| 300 | + player->configuration.host.name = name; |
| 301 | + |
| 302 | + if (player->configuration.client.desired_name.is_empty()) |
| 303 | + player->configuration.client.desired_name = name; |
| 304 | + } |
| 305 | + else |
| 306 | + { |
| 307 | + if (player->configuration.host.name.is_empty()) |
| 308 | + player->configuration.host.name.print(L"player_%d", absolute_index); |
| 309 | + |
| 310 | + if (player->configuration.client.desired_name.is_empty()) |
| 311 | + player->configuration.client.desired_name.print(L"player_%d", absolute_index); |
294 | 312 | } |
295 | 313 | } |
296 | 314 | } |
|
0 commit comments