forked from github/server
remove old gamecode-diabling logic
it was old, and not in use.
This commit is contained in:
parent
58fa2d4454
commit
f43d8a3297
3 changed files with 35 additions and 60 deletions
|
@ -78,8 +78,6 @@ void game_init(void)
|
||||||
register_itemtypes();
|
register_itemtypes();
|
||||||
register_xmlreader();
|
register_xmlreader();
|
||||||
register_archetypes();
|
register_archetypes();
|
||||||
enable_xml_gamecode();
|
|
||||||
|
|
||||||
register_attributes();
|
register_attributes();
|
||||||
register_gmcmd();
|
register_gmcmd();
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,6 @@ without prior permission by the authors of Eressea.
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static bool gamecode_enabled = false;
|
|
||||||
|
|
||||||
static building_type *bt_get_or_create(const char *name)
|
static building_type *bt_get_or_create(const char *name)
|
||||||
{
|
{
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
|
@ -67,11 +65,6 @@ static building_type *bt_get_or_create(const char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void enable_xml_gamecode(void)
|
|
||||||
{
|
|
||||||
gamecode_enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void xml_readtext(xmlNodePtr node, struct locale **lang, xmlChar ** text)
|
static void xml_readtext(xmlNodePtr node, struct locale **lang, xmlChar ** text)
|
||||||
{
|
{
|
||||||
xmlChar *propValue = xmlGetProp(node, BAD_CAST "locale");
|
xmlChar *propValue = xmlGetProp(node, BAD_CAST "locale");
|
||||||
|
@ -304,11 +297,10 @@ static int parse_buildings(xmlDocPtr doc)
|
||||||
xml_readconstruction(xpath, result->nodesetval, &btype->construction);
|
xml_readconstruction(xpath, result->nodesetval, &btype->construction);
|
||||||
xmlXPathFreeObject(result);
|
xmlXPathFreeObject(result);
|
||||||
|
|
||||||
if (gamecode_enabled) {
|
/* reading eressea/buildings/building/function */
|
||||||
/* reading eressea/buildings/building/function */
|
xpath->node = node;
|
||||||
xpath->node = node;
|
result = xmlXPathEvalExpression(BAD_CAST "function", xpath);
|
||||||
result = xmlXPathEvalExpression(BAD_CAST "function", xpath);
|
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
||||||
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
|
||||||
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
||||||
pf_generic fun;
|
pf_generic fun;
|
||||||
parse_function(node, &fun, &propValue);
|
parse_function(node, &fun, &propValue);
|
||||||
|
@ -337,9 +329,8 @@ static int parse_buildings(xmlDocPtr doc)
|
||||||
log_error("unknown function type '%s' for building %s\n", (const char *)propValue, btype->_name);
|
log_error("unknown function type '%s' for building %s\n", (const char *)propValue, btype->_name);
|
||||||
}
|
}
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
}
|
|
||||||
xmlXPathFreeObject(result);
|
|
||||||
}
|
}
|
||||||
|
xmlXPathFreeObject(result);
|
||||||
|
|
||||||
/* reading eressea/buildings/building/maintenance */
|
/* reading eressea/buildings/building/maintenance */
|
||||||
result = xmlXPathEvalExpression(BAD_CAST "maintenance", xpath);
|
result = xmlXPathEvalExpression(BAD_CAST "maintenance", xpath);
|
||||||
|
@ -806,11 +797,10 @@ static weapon_type *xml_readweapon(xmlXPathContextPtr xpath, item_type * itype)
|
||||||
}
|
}
|
||||||
xmlXPathFreeObject(result);
|
xmlXPathFreeObject(result);
|
||||||
|
|
||||||
if (gamecode_enabled) {
|
/* reading weapon/function */
|
||||||
/* reading weapon/function */
|
xpath->node = node;
|
||||||
xpath->node = node;
|
result = xmlXPathEvalExpression(BAD_CAST "function", xpath);
|
||||||
result = xmlXPathEvalExpression(BAD_CAST "function", xpath);
|
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
||||||
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
|
||||||
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
||||||
xmlChar *propValue;
|
xmlChar *propValue;
|
||||||
pf_generic fun;
|
pf_generic fun;
|
||||||
|
@ -830,9 +820,8 @@ static weapon_type *xml_readweapon(xmlXPathContextPtr xpath, item_type * itype)
|
||||||
log_error("unknown function type '%s' for item '%s'\n", (const char *)propValue, itype->rtype->_name[0]);
|
log_error("unknown function type '%s' for item '%s'\n", (const char *)propValue, itype->rtype->_name[0]);
|
||||||
}
|
}
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
}
|
|
||||||
xmlXPathFreeObject(result);
|
|
||||||
}
|
}
|
||||||
|
xmlXPathFreeObject(result);
|
||||||
|
|
||||||
xpath->node = node;
|
xpath->node = node;
|
||||||
return wtype;
|
return wtype;
|
||||||
|
@ -912,11 +901,10 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype)
|
||||||
}
|
}
|
||||||
xmlXPathFreeObject(result);
|
xmlXPathFreeObject(result);
|
||||||
|
|
||||||
if (gamecode_enabled) {
|
/* reading item/function */
|
||||||
/* reading item/function */
|
xpath->node = node;
|
||||||
xpath->node = node;
|
result = xmlXPathEvalExpression(BAD_CAST "function", xpath);
|
||||||
result = xmlXPathEvalExpression(BAD_CAST "function", xpath);
|
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
||||||
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
|
||||||
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
||||||
xmlChar *propValue;
|
xmlChar *propValue;
|
||||||
pf_generic fun;
|
pf_generic fun;
|
||||||
|
@ -947,9 +935,8 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype)
|
||||||
log_error("unknown function type '%s' for item '%s'\n", (const char *)propValue, rtype->_name[0]);
|
log_error("unknown function type '%s' for item '%s'\n", (const char *)propValue, rtype->_name[0]);
|
||||||
}
|
}
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
}
|
|
||||||
xmlXPathFreeObject(result);
|
|
||||||
}
|
}
|
||||||
|
xmlXPathFreeObject(result);
|
||||||
|
|
||||||
return itype;
|
return itype;
|
||||||
}
|
}
|
||||||
|
@ -1068,11 +1055,10 @@ static int parse_resources(xmlDocPtr doc)
|
||||||
xmlFree(name);
|
xmlFree(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gamecode_enabled) {
|
/* reading eressea/resources/resource/function */
|
||||||
/* reading eressea/resources/resource/function */
|
xpath->node = node;
|
||||||
xpath->node = node;
|
result = xmlXPathEvalExpression(BAD_CAST "function", xpath);
|
||||||
result = xmlXPathEvalExpression(BAD_CAST "function", xpath);
|
if (result->nodesetval != NULL)
|
||||||
if (result->nodesetval != NULL)
|
|
||||||
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
||||||
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
||||||
pf_generic fun;
|
pf_generic fun;
|
||||||
|
@ -1096,8 +1082,7 @@ static int parse_resources(xmlDocPtr doc)
|
||||||
}
|
}
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
}
|
}
|
||||||
xmlXPathFreeObject(result);
|
xmlXPathFreeObject(result);
|
||||||
}
|
|
||||||
|
|
||||||
/* reading eressea/resources/resource/resourcelimit */
|
/* reading eressea/resources/resource/resourcelimit */
|
||||||
xpath->node = node;
|
xpath->node = node;
|
||||||
|
@ -1585,22 +1570,21 @@ static int parse_spells(xmlDocPtr doc)
|
||||||
if (k >= 0 && k <= 3)
|
if (k >= 0 && k <= 3)
|
||||||
sp->sptyp |= modes[k];
|
sp->sptyp |= modes[k];
|
||||||
|
|
||||||
if (gamecode_enabled) {
|
/* reading eressea/spells/spell/function */
|
||||||
/* reading eressea/spells/spell/function */
|
pf_generic cast = 0;
|
||||||
pf_generic cast = 0;
|
pf_generic fumble = 0;
|
||||||
pf_generic fumble = 0;
|
|
||||||
|
|
||||||
xpath->node = node;
|
xpath->node = node;
|
||||||
result = xmlXPathEvalExpression(BAD_CAST "function", xpath);
|
result = xmlXPathEvalExpression(BAD_CAST "function", xpath);
|
||||||
|
|
||||||
if (result->nodesetval->nodeNr == 0) {
|
if (result->nodesetval->nodeNr == 0) {
|
||||||
cast = get_function(sp->sname);
|
cast = get_function(sp->sname);
|
||||||
if (!cast) {
|
if (!cast) {
|
||||||
log_error("no spell cast function registered for '%s'\n", sp->sname);
|
log_error("no spell cast function registered for '%s'\n", sp->sname);
|
||||||
}
|
}
|
||||||
strlcpy(zText+7, sp->sname, sizeof(zText)-7);
|
strlcpy(zText+7, sp->sname, sizeof(zText)-7);
|
||||||
fumble = get_function(zText);
|
fumble = get_function(zText);
|
||||||
} else {
|
} else {
|
||||||
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
||||||
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
||||||
pf_generic fun;
|
pf_generic fun;
|
||||||
|
@ -1620,11 +1604,10 @@ static int parse_spells(xmlDocPtr doc)
|
||||||
}
|
}
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
sp->cast = (spell_f)cast;
|
|
||||||
sp->fumble = (fumble_f)fumble;
|
|
||||||
xmlXPathFreeObject(result);
|
|
||||||
}
|
}
|
||||||
|
sp->cast = (spell_f)cast;
|
||||||
|
sp->fumble = (fumble_f)fumble;
|
||||||
|
xmlXPathFreeObject(result);
|
||||||
|
|
||||||
/* reading eressea/spells/spell/resource */
|
/* reading eressea/spells/spell/resource */
|
||||||
xpath->node = node;
|
xpath->node = node;
|
||||||
|
@ -1869,11 +1852,10 @@ static int parse_races(xmlDocPtr doc)
|
||||||
}
|
}
|
||||||
xmlXPathFreeObject(result);
|
xmlXPathFreeObject(result);
|
||||||
|
|
||||||
if (gamecode_enabled) {
|
/* reading eressea/races/race/function */
|
||||||
/* reading eressea/races/race/function */
|
xpath->node = node;
|
||||||
xpath->node = node;
|
result = xmlXPathEvalExpression(BAD_CAST "function", xpath);
|
||||||
result = xmlXPathEvalExpression(BAD_CAST "function", xpath);
|
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
||||||
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
|
||||||
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
||||||
pf_generic fun;
|
pf_generic fun;
|
||||||
|
|
||||||
|
@ -1902,9 +1884,8 @@ static int parse_races(xmlDocPtr doc)
|
||||||
log_error("unknown function type '%s' for race %s\n", (const char *)propValue, rc->_name[0]);
|
log_error("unknown function type '%s' for race %s\n", (const char *)propValue, rc->_name[0]);
|
||||||
}
|
}
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
}
|
|
||||||
xmlXPathFreeObject(result);
|
|
||||||
}
|
}
|
||||||
|
xmlXPathFreeObject(result);
|
||||||
|
|
||||||
/* reading eressea/races/race/familiar */
|
/* reading eressea/races/race/familiar */
|
||||||
xpath->node = node;
|
xpath->node = node;
|
||||||
|
@ -2110,9 +2091,6 @@ static int parse_messages(xmlDocPtr doc)
|
||||||
xmlNodeSetPtr nodes;
|
xmlNodeSetPtr nodes;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!gamecode_enabled)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
xpath = xmlXPathNewContext(doc);
|
xpath = xmlXPathNewContext(doc);
|
||||||
|
|
||||||
/* reading eressea/messages/message */
|
/* reading eressea/messages/message */
|
||||||
|
|
|
@ -16,7 +16,6 @@ without prior permission by the authors of Eressea.
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
extern void register_xmlreader(void);
|
extern void register_xmlreader(void);
|
||||||
extern void enable_xml_gamecode(void);
|
|
||||||
|
|
||||||
/* game-specific callbacks */
|
/* game-specific callbacks */
|
||||||
extern void (*set_spelldata_cb) (struct spell * sp);
|
extern void (*set_spelldata_cb) (struct spell * sp);
|
||||||
|
|
Loading…
Reference in a new issue