UFO: Alien Invasion
Loading...
Searching...
No Matches
ui_node_data.cpp
Go to the documentation of this file.
1
12
13/*
14Copyright (C) 2002-2025 UFO: Alien Invasion.
15
16This program is free software; you can redistribute it and/or
17modify it under the terms of the GNU General Public License
18as published by the Free Software Foundation; either version 2
19of the License, or (at your option) any later version.
20
21This program is distributed in the hope that it will be useful,
22but WITHOUT ANY WARRANTY; without even the implied warranty of
23MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24
25See the GNU General Public License for more details.
26
27You should have received a copy of the GNU General Public License
28along with this program; if not, write to the Free Software
29Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30
31*/
32
33#include "../ui_nodes.h"
34#include "../ui_parse.h"
35#include "../ui_behaviour.h"
36#include "ui_node_data.h"
38
39#include "../../client.h"
40
42
43#define EXTRADATA_TYPE dataExtraData_t
44#define EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE)
45#define EXTRADATACONST(node) UI_EXTRADATACONST(node, EXTRADATA_TYPE)
46
48{
49 behaviour->name = "data";
50 behaviour->isVirtual = true;
51 behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
52 behaviour->manager = UINodePtr(new uiDataNode());
53 behaviour->lua_SWIG_typeinfo = UI_SWIG_TypeQuery("uiDataNode_t *");
54
55 /* Store a string into the node.
56 * @note you should note store a cvar ref
57 * @todo use a REF_STRING when it is possible
58 */
59 UI_RegisterOveridedNodeProperty(behaviour, "string");
60
61 /* Store a float number into the node. */
62 UI_RegisterExtradataNodeProperty(behaviour, "number", V_FLOAT, EXTRADATA_TYPE, number);
63
64 /* Store a integer number into the node. */
65 UI_RegisterExtradataNodeProperty(behaviour, "integer", V_INT, EXTRADATA_TYPE, integer);
66}
Primary header for client.
@ V_FLOAT
Definition scripts.h:54
@ V_INT
Definition scripts.h:52
Header for lua script functions.
node behaviour, how a node work
const char * name
void * lua_SWIG_typeinfo
UINodePtr manager
intptr_t extraDataSize
#define UI_RegisterOveridedNodeProperty(BEHAVIOUR, NAME)
Initialize a property which override an inherited property. It is yet only used for the documentation...
#define UI_RegisterExtradataNodeProperty(BEHAVIOUR, NAME, TYPE, EXTRADATATYPE, ATTRIBUTE)
Initialize a property from extradata of node.
void * UI_SWIG_TypeQuery(const char *name)
This function queries the SWIG type table for a type information structure. It is used in combination...
SharedPtr< uiNode > UINodePtr
#define EXTRADATA_TYPE
void UI_RegisterDataNode(uiBehaviour_t *behaviour)