Pioneer
Loading...
Searching...
No Matches
Macros
CustomSystem.cpp File Reference
#include "CustomSystem.h"
#include "Galaxy.h"
#include "SystemPath.h"
#include "core/LZ4Format.h"
#include "../gameconsts.h"
#include "Factions.h"
#include "FileSystem.h"
#include "Polit.h"
#include "lua/LuaConstants.h"
#include "lua/LuaFixed.h"
#include "lua/LuaUtils.h"
#include "lua/LuaVector.h"
#include <map>
Include dependency graph for CustomSystem.cpp:

Macros

#define CSB_FIELD_SETTER_FIXED(luaname, fieldname)
 
#define CSB_FIELD_SETTER_REAL(luaname, fieldname)
 
#define CSB_FIELD_SETTER_INT(luaname, fieldname)
 
#define CSB_FIELD_SETTER_STRING(luaname, fieldname)
 

Macro Definition Documentation

◆ CSB_FIELD_SETTER_FIXED

#define CSB_FIELD_SETTER_FIXED (   luaname,
  fieldname 
)
Value:
static int l_csb_##luaname(lua_State *L) \
{ \
CustomSystemBody *csb = l_csb_check(L, 1); \
double *value = getDoubleOrFixed(L, 2); \
if (value == nullptr) \
return luaL_error(L, "Bad datatype. Expected fixed or float, got %s", luaL_typename(L, 2)); \
if (*value < 0.0) \
Output("Error: Custom system definition: Value cannot be negative (%lf) for %s : %s\n", *value, csb->name.c_str(), #luaname); \
csb->fieldname = fixed::FromDouble(*value); \
lua_settop(L, 1); \
return 1; \
}
Definition CustomSystem.h:17
std::string name
Definition CustomSystem.h:22
static fixedf FromDouble(const double val)
Definition fixed.h:194

◆ CSB_FIELD_SETTER_INT

#define CSB_FIELD_SETTER_INT (   luaname,
  fieldname 
)
Value:
static int l_csb_##luaname(lua_State *L) \
{ \
CustomSystemBody *csb = l_csb_check(L, 1); \
int value = luaL_checkinteger(L, 2); \
csb->fieldname = value; \
lua_settop(L, 1); \
return 1; \
}

◆ CSB_FIELD_SETTER_REAL

#define CSB_FIELD_SETTER_REAL (   luaname,
  fieldname 
)
Value:
static int l_csb_##luaname(lua_State *L) \
{ \
CustomSystemBody *csb = l_csb_check(L, 1); \
double value = luaL_checknumber(L, 2); \
csb->fieldname = value; \
lua_settop(L, 1); \
return 1; \
}

◆ CSB_FIELD_SETTER_STRING

#define CSB_FIELD_SETTER_STRING (   luaname,
  fieldname 
)
Value:
static int l_csb_##luaname(lua_State *L) \
{ \
CustomSystemBody *csb = l_csb_check(L, 1); \
std::string value = luaL_checkstring(L, 2); \
csb->fieldname = value; \
lua_settop(L, 1); \
return 1; \
}