L3DT documentation
Large 3D terrain generator



Save a floating-point map as a HF2/HFZ file.

Function prototype

long hfzSave(const char* lpFileName, long Format, hfzHeader& fh, float* pData, LIBHFZ_PROG_CALLBACK lpProgCallback, void* lpCallbackParam);


Name Type Comment
lpFileName const char* The file name of the file to be saved.
Format long The type of file to be opened. May be either LIBHFZ_FORMAT_HF2 (uncompressed) or LIBHFZ_FORMAT_HF2_GZ (compressed).
fh hfzHeader& The hfzHeader struct to be written to the file, as initialised by hfzHeader_Init.
pData float* A handle to the map data. Please refer to the HF2 file specification for the required pixel order.
lpProgCallback LIBHFZ_PROG_CALLBACK A handle to a callback function for displaying progress (see comments below). May be NULL if no callback is desired.
lpCallbackParam void* A handle to a user-defined parameter to be passed back to the lpProgCallback function, if used.

Return value

LIBHFZ_STATUS_OK if the file was saved successfully, and otherwise an error code. Use hfzGetErrorStr to retrieve the error description.


Using lpProgCallback

The prototype of the callback function must be:

long __stdcall MyCallbackFuncName(float Progress);

The value of Progress passed by LibHFZ varies from 0 to 1.

The value returned by the callback must be:

  • LIBHFZ_STATUS_OK (0) if the file saving/loading is to proceed.
  • A non-zero value if the file saving/loading should be cancelled, such as LIBHFZ_USER_ABORT (-15).
libhfz/functions/hfzsave.txt · Last modified: 2017/08/31 05:34 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki