| 575 | CCC_ALifeLoadFrom(LPCSTR N) : IConsole_Command(N) { bEmptyArgsHandled = true; } |
| 576 | |
| 577 | void Execute(LPCSTR args) override |
| 578 | { |
| 579 | if (!CSavedGameWrapper::valid_saved_game(args)) |
| 580 | { |
| 581 | Msg("! Cannot load saved game [%s]: not found or version mismatch or corrupted", args ? args : "nullptr"); |
| 582 | return; |
| 583 | } |
| 584 | |
| 585 | if (ai().get_alife()) |
| 586 | { |
| 587 | if (MainMenu()->IsActive()) |
| 588 | MainMenu()->Activate(false); |
| 589 | |
| 590 | Console->Hide(); |
| 591 | |
| 592 | ::Sound->set_master_volume(0.f); |
| 593 | |
| 594 | if (Device.Paused()) |
| 595 | Device.Pause(FALSE, TRUE, TRUE, "CCC_ALifeLoadFrom"); |
| 596 | |
| 597 | NET_Packet net_packet; |
| 598 | net_packet.w_begin(M_LOAD_GAME); |
| 599 | net_packet.w_stringZ(args); |
| 600 | Level().Send(net_packet, net_flags(TRUE)); |
| 601 | } |
| 602 | else |
| 603 | { |
| 604 | string_path command; |
| 605 | xr_strconcat(command, "start server(", args, "/single/alife/load)"); |
| 606 | Console->Execute(command); |
| 607 | } |
| 608 | } |
| 609 | |
| 610 | virtual void fill_tips(vecTips& tips, u32 mode) { get_files_list(tips, "$game_saves$", SAVE_EXTENSION); } |
| 611 | }; |
nothing calls this directly
no test coverage detected