Skip to content
Brass Orrery

Orrery Terrain · OrreryTerrain module · member function

UOrreryTerrainSubsystem::

SaveTerrainToFile

Write the terrain's save file: a snapshot pinned now (the world may go on changing), streamed on a task into <Path>.tmp, flushed and renamed over Path.

Declaration

EOrreryTerrainSaveResult SaveTerrainToFile(const FString& Path, FOnTerrainFileSaved Done,
                                             const FOrreryTerrainSaveOptions& Options = FOrreryTerrainSaveOptions());
Header
#include "OrreryTerrainSubsystem.h"
Module
PublicDependencyModuleNames.Add("OrreryTerrain"); in your module’s Build.cs.
Stability
Stable: changes within a major version only add.
Thread
Every member function is game thread unless it says otherwise. (the rule of UOrreryTerrainSubsystem)

Description

Any size; nothing is held whole in memory. Allowed on a read-only terrain. The game's own save keeps the result's Path, FileHash and StateHash (FOrreryTerrainSaveRef, <slot>.<n>.tsterrain).

Parameters

NameTypeDefaultMeaning
Pathconst FString&—

Absolute file path to write; the temporary file is beside it.

DoneFOnTerrainFileSaved—

Called from Tick on the game thread when the write ends, only if this returns Ok.

Optionsconst FOrreryTerrainSaveOptions&FOrreryTerrainSaveOptions()

What the save keeps.

Returns

Ok when the write started; NoTerrain; Busy while a save is in flight; WriteFailed when Path is the file this terrain pages from (save to a new name, then delete the old one).