wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
wowlib::formats::wmo::detail::WMO< V > Struct Template Reference

A whole WMO (world map object) for one client version: the root file and all its group files unified as one entity. More...

#include <wowlib/formats/wmo/wmo.hpp>

Inheritance diagram for wowlib::formats::wmo::detail::WMO< V >:

Public Member Functions

Result< void > read (fs::FileSystem &fs, const FileKey &key)
 Load the WMO and all its group files from a client filesystem, replacing this entity's contents.
Result< void > read (std::span< const std::byte > rootData, std::span< const std::span< const std::byte > > groupDatas)
 Parse the WMO from already-loaded buffers (no filesystem access), replacing this entity's contents.
Result< void > write (fs::FileSystem &fs, const FileKey &key) const
 Serialize and store the WMO (root and every group) through the filesystem's project overlay; group file names are derived from the root key, which must resolve to a path.
ValidationReport validate () const
Result< void > ensureValid () const
 Validate and raise on the first error instead of returning a report — the assert-style face of validate().

Public Attributes

WMORoot< V > root {}
 The root file contents.
std::vector< WMOGroup< V > > groups
 The group files, in group order.

Static Public Attributes

static constexpr ClientVersion Version = V

Detailed Description

template<ClientVersion V>
struct wowlib::formats::wmo::detail::WMO< V >

A whole WMO (world map object) for one client version: the root file and all its group files unified as one entity.

Instantiate through the canonicalizing wmo::WMO alias, never directly.

A WMO is a v17 world map object — a building, cave, bridge or other placed structure. It is stored as a root file (shared data: materials, doodads, portals, lights; see WMORoot) plus one file per group (the geometry; see WMOGroup). Group files are located by GFID (Legion+ clients) or the "{root}_NNN.wmo" naming convention. Reading is chunk-order independent; writing replays the original chunk order, so an entity read from a client and left unmodified rewrites byte-for-byte.

Template Parameters
Vthe client version this assembly targets.
See also
https://wowdev.wiki/WMO

Definition at line 65 of file wmo.hpp.

Member Function Documentation

◆ ensureValid()

template<ClientVersion V>
Result< void > wowlib::formats::wmo::detail::WMO< V >::ensureValid ( ) const
nodiscard

Validate and raise on the first error instead of returning a report — the assert-style face of validate().

Returns
nothing; raises when validate() finds any error

Definition at line 245 of file wmo.hpp.

References validate().

◆ read() [1/2]

template<ClientVersion V>
Result< void > wowlib::formats::wmo::detail::WMO< V >::read ( fs::FileSystem & fs,
const FileKey & key )

Load the WMO and all its group files from a client filesystem, replacing this entity's contents.

Parameters
fsthe filesystem gateway
keythe root file identity (path and/or FileDataID)

Definition at line 278 of file wmo.hpp.

References groups, wowlib::makeError(), wowlib::FileKey::path, wowlib::PathNotResolvable, and root.

◆ read() [2/2]

template<ClientVersion V>
Result< void > wowlib::formats::wmo::detail::WMO< V >::read ( std::span< const std::byte > rootData,
std::span< const std::span< const std::byte > > groupDatas )

Parse the WMO from already-loaded buffers (no filesystem access), replacing this entity's contents.

Not welded: span-of-spans does not cross the binding boundary — the Python read() glue accepts a root buffer plus one buffer/file-like per group instead.

Parameters
rootDatathe root file bytes.
groupDatasone buffer per group file, in group order.
Returns
nothing, or the first error.

Definition at line 258 of file wmo.hpp.

References groups, wowlib::makeError(), and root.

◆ validate()

◆ write()

template<ClientVersion V>
Result< void > wowlib::formats::wmo::detail::WMO< V >::write ( fs::FileSystem & fs,
const FileKey & key ) const

Serialize and store the WMO (root and every group) through the filesystem's project overlay; group file names are derived from the root key, which must resolve to a path.

Parameters
fsthe filesystem gateway
keythe root file identity; must resolve to a path

Definition at line 328 of file wmo.hpp.

References groups, wowlib::InvalidEntityState, wowlib::makeError(), wowlib::FileKey::path, wowlib::PathNotResolvable, and root.

Member Data Documentation

◆ groups

template<ClientVersion V>
std::vector<WMOGroup<V> > wowlib::formats::wmo::detail::WMO< V >::groups

The group files, in group order.

Definition at line 72 of file wmo.hpp.

Referenced by read(), read(), validate(), and write().

◆ root

The root file contents.

Definition at line 69 of file wmo.hpp.

Referenced by read(), read(), validate(), and write().

◆ Version

template<ClientVersion V>
ClientVersion wowlib::formats::wmo::detail::WMO< V >::Version = V
staticconstexpr

Definition at line 66 of file wmo.hpp.


The documentation for this struct was generated from the following file: