MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / update

Method update

game/ui/boot.cpp:33–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31void BootUp::eventOccurred(Event *e) { std::ignore = e; }
32
33void BootUp::update()
34{
35 bool skipIntro = Options::skipIntroOption.get();
36 // The first forms instance causes it to get loaded
37 sp<GameState> loadedState;
38 std::shared_future<void> loadTask;
39 bool loadGame = false;
40
41 fw().setupModDataPaths();
42 fw().jukebox->loadPlaylists();
43
44 if (Options::loadGameOption.get().empty())
45 {
46 loadTask = fw().threadPoolEnqueue([]() {
47 auto &ui_instance = ui();
48 std::ignore = ui_instance;
49 });
50 }
51 else
52 {
53 loadGame = true;
54 auto path = Options::loadGameOption.get();
55 loadedState = mksp<GameState>();
56 loadTask = fw().threadPoolEnqueue([loadedState, path]() {
57 auto &ui_instance = ui();
58 std::ignore = ui_instance;
59 LogWarning("Loading save \"%s\"", path);
60
61 if (!loadedState->loadGame(path))
62 {
63 LogError("Failed to load supplied game \"%s\"", path);
64 }
65 loadedState->initState();
66 });
67 }
68
69 sp<Stage> nextScreen;
70 if (loadGame == true)
71 {
72 nextScreen =
73 mksp<LoadingScreen>(nullptr, std::move(loadTask), [loadedState]() -> sp<Stage> {
74 if (loadedState->current_battle)
75 {
76 return mksp<BattleView>(loadedState);
77 }
78 else
79 {
80 return mksp<CityView>(loadedState);
81 }
82 });
83 }
84 else
85 {
86 nextScreen = mksp<LoadingScreen>(nullptr, std::move(loadTask),
87 []() -> sp<Stage> { return mksp<MainMenu>(); });
88 }
89
90 fw().stageQueueCommand(

Callers

nothing calls this directly

Calls 8

setupModDataPathsMethod · 0.80
loadPlaylistsMethod · 0.80
emptyMethod · 0.80
threadPoolEnqueueMethod · 0.80
initStateMethod · 0.80
stageQueueCommandMethod · 0.80
getMethod · 0.45
loadGameMethod · 0.45

Tested by

no test coverage detected