Add actions to missions topic

This commit is contained in:
Ylva Selling
2023-03-28 13:51:57 -04:00
parent 99edcfc4e7
commit c1245fc9c5
2 changed files with 15 additions and 0 deletions

View File

@@ -95,6 +95,8 @@ public:
*/
const std::vector<MissionPhase>& phases() const;
const std::vector<std::string> &actions() const;
using Trace = std::vector<std::reference_wrapper<const MissionPhase>>;
/**
@@ -140,6 +142,8 @@ protected:
std::vector<MissionPhase> _subphases;
/// Image that is associated with this phase
std::string _image;
/// Actions associated with the phase
std::vector<std::string> _actions;
};
/**

View File

@@ -60,6 +60,9 @@ namespace {
std::optional<std::string> image;
};
std::optional<Media> media;
// Actions associated with this phase
std::optional<std::vector<std::string>> actions;
};
#include "mission_codegen.cpp"
} // namespace
@@ -141,6 +144,10 @@ MissionPhase::MissionPhase(const ghoul::Dictionary& dictionary) {
));
}
}
if (p.actions.has_value()) {
_actions = p.actions.value_or(_actions);
}
}
const std::string& MissionPhase::name() const {
@@ -163,6 +170,10 @@ const std::vector<MissionPhase>& MissionPhase::phases() const {
return _subphases;
}
const std::vector<std::string>& MissionPhase::actions() const {
return _actions;
}
MissionPhase::Trace MissionPhase::phaseTrace(double time, int maxDepth) const {
Trace trace;
if (_timeRange.includes(time)) {