mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 17:48:46 -10:00
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).
24 lines
594 B
C++
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
|