MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / Update

Method Update

Source/Main/engine.cpp:1721–2331  ·  view source on GitHub ↗

Update the simulation

Source from the content-addressed store, hash-verified

1719
1720// Update the simulation
1721void Engine::Update() {
1722 game_timer.UpdateWallTime();
1723
1724 PROFILER_ZONE(g_profiler_ctx, "Update");
1725
1726 if (check_save_level_changes_dialog_is_showing) {
1727 // Wait for dialog to be complete
1728 UpdateControls(ui_timer.timestep, false);
1729 return;
1730 }
1731
1732#ifdef WIN32
1733 {
1734 PROFILER_ZONE(g_profiler_ctx, "Wait for object updates");
1735 if (WaitForSingleObject(data_change_notification, 0) == WAIT_OBJECT_0 || WaitForSingleObject(write_change_notification, 0) == WAIT_OBJECT_0) {
1736 RequestLiveUpdate();
1737 while (WaitForSingleObject(data_change_notification, 0) == WAIT_OBJECT_0) {
1738 FindNextChangeNotification(data_change_notification);
1739 }
1740 while (write_change_notification != INVALID_HANDLE_VALUE && WaitForSingleObject(write_change_notification, 0) == WAIT_OBJECT_0) {
1741 FindNextChangeNotification(write_change_notification);
1742 }
1743 }
1744 }
1745#endif
1746
1747#if ENABLE_STEAMWORKS
1748 {
1749 PROFILER_ZONE(g_profiler_ctx, "Steam update");
1750 Steamworks::Instance()->Update(current_engine_state_.type != kEngineLevelState && current_engine_state_.type != kEngineEditorLevelState);
1751 }
1752#endif
1753
1754 while (queued_engine_state_.size() > 0) {
1755 bool continue_state_change = true;
1756
1757 EngineState new_engine_state;
1758
1759 bool found = false;
1760 std::deque<EngineState> history_copy = state_history;
1761 std::deque<EngineState> final_pop;
1762
1763 LOGI << "Checking if we actually allow any state changes" << std::endl;
1764
1765 switch (current_engine_state_.type) {
1766 case kEngineLevelState:
1767 case kEngineEditorLevelState:
1768 if (scenegraph_) {
1769 if (!check_save_level_changes_dialog_is_finished && !check_save_level_changes_dialog_is_showing) {
1770 // Trigger save dialog
1771 Input::Instance()->SetGrabMouse(false);
1772 check_save_level_changes_dialog_is_showing = true;
1773 check_save_level_changes_dialog_quit_if_not_cancelled = false;
1774 check_save_level_changes_dialog_is_finished = false;
1775 return;
1776 }
1777
1778 continue_state_change = check_save_level_changes_last_result;

Callers 4

UpdateControlsMethod · 0.45
LoadLevelDataMethod · 0.45
ClearLoadedLevelMethod · 0.45
GameMainFunction · 0.45

Calls 15

RequestLiveUpdateFunction · 0.85
strmtchFunction · 0.85
FileExistsFunction · 0.85
FindFilePathFunction · 0.85
UIShowCursorFunction · 0.85
LoadLevelFunction · 0.85
UpdateImGuiFunction · 0.85
OgMallocTypeStringFunction · 0.85
LiveUpdateFunction · 0.85

Tested by

no test coverage detected