Crossfire Server, Trunk
CREScriptEngine.cpp
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2022 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #include "CREScriptEngine.h"
14 
15 #include "global.h"
16 #include "attack.h"
17 
19 {
20  QScriptValue attacks = newObject();
21 
22  for (int attack = 0; attack < NROFATTACKS; attack++)
23  {
24  QString name(attacktype_desc[attack]);
25  name = name.replace(' ', '_');
26  attacks.setProperty(name, 1 << attack);
27  }
28 
29  globalObject().setProperty("AttackType", attacks, QScriptValue::ReadOnly | QScriptValue::Undeletable);
30 }
31 
33 {
34 }
global.h
CREScriptEngine::CREScriptEngine
CREScriptEngine()
Definition: CREScriptEngine.cpp:18
CREScriptEngine::~CREScriptEngine
virtual ~CREScriptEngine()
Definition: CREScriptEngine.cpp:32
NROFATTACKS
#define NROFATTACKS
Definition: attack.h:17
attack.h
CREScriptEngine.h
attacktype_desc
const char *const attacktype_desc[NROFATTACKS]
Definition: init.cpp:40
attacks
const char *const attacks[NROFATTACKS]
Definition: living.cpp:129
give.name
name
Definition: give.py:27