R-Type
Networked shoot'em up built on Aegis2D
Loading...
Searching...
No Matches
rtype::LevelDraft Struct Reference

A waves file opened in the editor. More...

#include </__w/project-rtype/project-rtype/client/network/include/rtype/level_editor.hpp>

Public Member Functions

std::string to_json (std::size_t first_wave=0) const
 The draft as a waves file, from one of its waves on.
 
void save (const std::filesystem::path &path) const
 Writes the draft to a waves file, once the server would read it.
 
aegis2d::ecs::WaveSchedule schedule (std::size_t first_wave=0) const
 The draft as the server plays it, from one of its waves on, for a playtest.
 

Static Public Member Functions

static LevelDraft from_file (const std::filesystem::path &path)
 Reads a waves file, as the server does (load_waves()).
 

Public Attributes

bool loop = false
 Whether the waves play again from the first after the last.
 
std::vector< DraftWave > waves {}
 The waves, in order.
 

Detailed Description

A waves file opened in the editor.

Each group of the file (count, every, step) becomes one enemy per member, so that each can be moved on its own; the waves they make are the same.

Member Function Documentation

◆ from_file()

static LevelDraft rtype::LevelDraft::from_file ( const std::filesystem::path &  path)
static

Reads a waves file, as the server does (load_waves()).

Parameters
pathJSON file in the format of ecs::WaveSchedule.
Returns
The draft.
Exceptions
aegis2d::core::ConfigErrorIf the file cannot be read or is not valid waves.

◆ save()

void rtype::LevelDraft::save ( const std::filesystem::path &  path) const

Writes the draft to a waves file, once the server would read it.

Written next to path first and checked as the server reads it (load_waves()): a draft the server would refuse, such as a wave with no enemy, leaves the file as it was.

Parameters
pathWaves file, created or replaced.
Exceptions
aegis2d::core::ConfigErrorIf the server would refuse it, or the file cannot be written; the message says why.

◆ schedule()

aegis2d::ecs::WaveSchedule rtype::LevelDraft::schedule ( std::size_t  first_wave = 0) const

The draft as the server plays it, from one of its waves on, for a playtest.

Parameters
first_waveIndex of the first wave played.
Returns
The schedule, at its start.
Exceptions
aegis2d::core::ConfigErrorIf it is not valid waves (a wave with no enemy...).

◆ to_json()

std::string rtype::LevelDraft::to_json ( std::size_t  first_wave = 0) const

The draft as a waves file, from one of its waves on.

Each enemy is a spawn of its own, at written when not 0; the waves before first_wave are left out.

Parameters
first_waveIndex of the first wave written.
Returns
JSON in the format of ecs::WaveSchedule.

Member Data Documentation

◆ loop

bool rtype::LevelDraft::loop = false

Whether the waves play again from the first after the last.

◆ waves

std::vector<DraftWave> rtype::LevelDraft::waves {}

The waves, in order.


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