Files
fs2open.github.com/code/parse/sexp/SEXPParameterExtractor.cpp
asarium 62d6b3c834 Add system for adding SEXPs externally
This adds a "clear-debris" SEXP with a new system for declaring SEXPs
outside of sexp.cpp. This makes it easier to keep code modules self
contained since they do not need to export previously private
functionality just for having missiong being able to interface with it.

This is mostly a proof-of-concept which only supports basic parameter
types (booleans and integers).
2020-07-03 18:13:47 +02:00

24 lines
594 B
C++

#include "SEXPParameterExtractor.h"
#include "parse/sexp.h"
namespace sexp {
integer_return::integer_return() = default;
integer_return::integer_return(int _value) : value(_value) {}
namespace detail {
void nodeToValue(int node, bool& valOut) { valOut = is_sexp_true(node); }
void nodeToValue(int node, integer_return& valOut)
{
valOut.value = eval_num(node, valOut.is_nan, valOut.is_nan_forever);
}
} // namespace detail
SEXPParameterExtractor::SEXPParameterExtractor(int node) : _node(node) {}
bool SEXPParameterExtractor::hasMore() const { return _node != -1; }
} // namespace sexp