remove last pieces of calendar.xml

This commit is contained in:
Enno Rehling 2017-05-07 20:21:49 +02:00
parent a2c963beb0
commit 18defdd5a2
2 changed files with 24 additions and 127 deletions

24
conf/e2/config.xml Normal file
View File

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<eressea xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config://game/familiars.xml"/>
<xi:include href="config://game/equipment.xml"/>
<equipment>
<set name="autoseed_unit">
<item name="log" amount="50"/>
<item name="stone" amount="50"/>
<item name="iron" amount="50"/>
<item name="laen" amount="10"/>
<item name="sword" amount="1"/>
<item name="mallorn" amount="10"/>
<item name="skillpotion" amount="5"/>
<item name="p2" amount="5"/>
<item name="money" amount="20000"/>
<skill name="perception" level="30"/>
<skill name="melee" level="1"/>
</set>
<set name="autoseed_faction">
<item name="adamantium" amount="1"/>
</set>
</equipment>
</eressea>

View File

@ -399,133 +399,6 @@ static int parse_buildings(xmlDocPtr doc)
return 0;
}
#if 0
static int parse_calendar(xmlDocPtr doc)
{
xmlXPathContextPtr xpath = xmlXPathNewContext(doc);
xmlXPathObjectPtr xpathCalendars;
xmlNodeSetPtr nsetCalendars;
xpathCalendars = xmlXPathEvalExpression(BAD_CAST "/eressea/calendar", xpath);
nsetCalendars = xpathCalendars->nodesetval;
if (nsetCalendars != NULL && nsetCalendars->nodeNr != 0) {
int c;
for (c = 0; c != nsetCalendars->nodeNr; ++c) {
xmlNodePtr calendar = nsetCalendars->nodeTab[c];
xmlXPathObjectPtr xpathWeeks, xpathMonths, xpathSeasons;
xmlNodeSetPtr nsetWeeks, nsetMonths, nsetSeasons;
xmlChar *propValue = xmlGetProp(calendar, BAD_CAST "name");
xmlChar *newyear = xmlGetProp(calendar, BAD_CAST "newyear");
xmlChar *start;
start = xmlGetProp(calendar, BAD_CAST "start");
if (start && config_get("game.start") == NULL) {
config_set("game.start", (const char *)start);
xmlFree(start);
}
if (propValue) {
free(agename);
agename = strdup(mkname("calendar", (const char *)propValue));
xmlFree(propValue);
}
xpath->node = calendar;
xpathWeeks = xmlXPathEvalExpression(BAD_CAST "week", xpath);
nsetWeeks = xpathWeeks->nodesetval;
if (nsetWeeks != NULL && nsetWeeks->nodeNr) {
int i;
weeks_per_month = nsetWeeks->nodeNr;
free(weeknames);
free(weeknames2);
weeknames = malloc(sizeof(char *) * weeks_per_month);
weeknames2 = malloc(sizeof(char *) * weeks_per_month);
for (i = 0; i != nsetWeeks->nodeNr; ++i) {
xmlNodePtr week = nsetWeeks->nodeTab[i];
xmlChar *propValue = xmlGetProp(week, BAD_CAST "name");
if (propValue) {
weeknames[i] = strdup(mkname("calendar", (const char *)propValue));
weeknames2[i] = malloc(strlen(weeknames[i]) + 3);
sprintf(weeknames2[i], "%s_d", weeknames[i]);
xmlFree(propValue);
}
}
}
xmlXPathFreeObject(xpathWeeks);
xpathSeasons = xmlXPathEvalExpression(BAD_CAST "season", xpath);
nsetSeasons = xpathSeasons->nodesetval;
if (nsetSeasons != NULL && nsetSeasons->nodeNr) {
int i;
seasons = nsetSeasons->nodeNr;
assert(!seasonnames);
seasonnames = malloc(sizeof(char *) * seasons);
for (i = 0; i != nsetSeasons->nodeNr; ++i) {
xmlNodePtr season = nsetSeasons->nodeTab[i];
xmlChar *propValue = xmlGetProp(season, BAD_CAST "name");
if (propValue) {
seasonnames[i] =
strdup(mkname("calendar", (const char *)propValue));
xmlFree(propValue);
}
}
}
xpathMonths = xmlXPathEvalExpression(BAD_CAST "season/month", xpath);
nsetMonths = xpathMonths->nodesetval;
if (nsetMonths != NULL && nsetMonths->nodeNr) {
int i;
months_per_year = nsetMonths->nodeNr;
free(monthnames);
monthnames = malloc(sizeof(char *) * months_per_year);
free(month_season);
month_season = malloc(sizeof(int) * months_per_year);
free(storms);
storms = malloc(sizeof(int) * months_per_year);
for (i = 0; i != nsetMonths->nodeNr; ++i) {
xmlNodePtr month = nsetMonths->nodeTab[i];
xmlChar *propValue = xmlGetProp(month, BAD_CAST "name");
if (propValue) {
if (newyear
&& strcmp((const char *)newyear, (const char *)propValue) == 0) {
first_month = i;
xmlFree(newyear);
newyear = NULL;
}
monthnames[i] = strdup(mkname("calendar", (const char *)propValue));
xmlFree(propValue);
}
if (nsetSeasons) {
int j;
for (j = 0; j != seasons; ++j) {
xmlNodePtr season = month->parent;
if (season == nsetSeasons->nodeTab[j]) {
month_season[i] = j;
break;
}
}
assert(j != seasons);
}
storms[i] = xml_ivalue(nsetMonths->nodeTab[i], "storm", 0);
}
}
xmlXPathFreeObject(xpathMonths);
xmlXPathFreeObject(xpathSeasons);
xmlFree(newyear);
newyear = NULL;
}
}
xmlXPathFreeObject(xpathCalendars);
xmlXPathFreeContext(xpath);
return 0;
}
#endif
static int parse_ships(xmlDocPtr doc)
{
xmlXPathContextPtr xpath = xmlXPathNewContext(doc);