- Startgegenstände über XML definierbar (nicht lua, weil dann nicht im mapper)

- TARNE PARTEI NUMMER geht wieder richtig, hoffe ich
This commit is contained in:
Enno Rehling 2005-01-03 21:28:21 +00:00
parent 36d1956c12
commit 41d8f1ebfa
14 changed files with 67 additions and 33 deletions

View File

@ -3694,7 +3694,7 @@ processorders (void)
parse(K_MAIL, prepare_mail_cmd, false); parse(K_MAIL, prepare_mail_cmd, false);
parse(K_MAIL, mail_cmd, false); parse(K_MAIL, mail_cmd, false);
puts(" - Altern"); puts(" - Parteien altern");
age_factions(); age_factions();
puts(" - Benutzen"); puts(" - Benutzen");

View File

@ -24,7 +24,8 @@
#include "spy.h" #include "spy.h"
/* kernel includes */ /* kernel includes */
#include "build.h" #include <kernel/build.h>
#include <kernel/reports.h>
#include "economy.h" #include "economy.h"
#include "item.h" #include "item.h"
#include "karma.h" #include "karma.h"
@ -236,16 +237,15 @@ setstealth_cmd(unit * u, struct order * ord)
while (mu!=NULL) { while (mu!=NULL) {
unit * ru = mu->region->units; unit * ru = mu->region->units;
if (mu->region!=lastr) { if (mu->region!=lastr) {
lastr = mu->region;
while (ru!=NULL) { while (ru!=NULL) {
attrib *a = a_find(ru->attribs, &at_otherfaction); faction * fv = visible_faction(f, ru);
if (a) { if (fv==f) {
faction *fv = get_otherfaction(a); if (cansee(f, lastr, ru, 0)) break;
if (fv==f) break;
} }
ru = ru->next; ru = ru->next;
} }
if (ru!=NULL) break; if (ru!=NULL) break;
lastr = mu->region;
} }
mu = mu->nextF; mu = mu->nextF;
} }

View File

@ -181,21 +181,12 @@ void add_equipment(const item_type * itype, int number)
void void
give_starting_equipment(struct region *r, struct unit *u) give_starting_equipment(struct region *r, struct unit *u)
{ {
#ifdef NEW_STARTEQUIPMENT
item * itm = equipment; item * itm = equipment;
while (itm!=NULL) { while (itm!=NULL) {
i_add(&u->items, i_new(itm->type, itm->number)); i_add(&u->items, i_new(itm->type, itm->number));
itm=itm->next; itm=itm->next;
} }
#else set_money(u, turn * 10);
const item_type * token = it_find("conquesttoken");
if (token!=NULL) {
i_add(&u->items, i_new(token, 1));
}
set_item(u, I_WOOD, 30);
set_item(u, I_STONE, 30);
set_money(u, 2000 + turn * 10);
#endif
switch(old_race(u->race)) { switch(old_race(u->race)) {
case RC_DWARF: case RC_DWARF:

View File

@ -1836,7 +1836,7 @@ readgame(const char * filename, int backup)
int y = ri(F); int y = ri(F);
plane * pl = findplane(x, y); plane * pl = findplane(x, y);
if (firstx && firsty) { if (firstx || firsty) {
if (x!=firstx || y!=firsty) { if (x!=firstx || y!=firsty) {
skip = true; skip = true;
} else { } else {

View File

@ -711,6 +711,43 @@ parse_resources(xmlDocPtr doc)
return 0; return 0;
} }
static int
parse_equipment(xmlDocPtr doc)
{
xmlXPathContextPtr xpath = xmlXPathNewContext(doc);
xmlXPathObjectPtr items;
xmlNodeSetPtr nodes;
int i;
/* reading eressea/races/race */
items = xmlXPathEvalExpression(BAD_CAST "/eressea/equipment/item", xpath);
nodes = items->nodesetval;
for (i=0;i!=nodes->nodeNr;++i) {
xmlNodePtr node = nodes->nodeTab[i];
xmlChar * property;
const struct item_type * itype;
property = xmlGetProp(node, BAD_CAST "name");
assert(property!=NULL);
itype = it_find((const char*)property);
xmlFree(property);
if (itype!=NULL) {
int num = 0;
property = xmlGetProp(node, BAD_CAST "amount");
if (property!=NULL) {
num = atoi((const char*)property);
xmlFree(property);
}
add_equipment(itype, num);
}
}
xmlXPathFreeObject(items);
xmlXPathFreeContext(xpath);
return 0;
}
static int static int
parse_races(xmlDocPtr doc) parse_races(xmlDocPtr doc)
{ {
@ -1201,4 +1238,5 @@ register_xmlreader(void)
xml_register_callback(parse_resources); xml_register_callback(parse_resources);
xml_register_callback(parse_buildings); xml_register_callback(parse_buildings);
xml_register_callback(parse_ships); xml_register_callback(parse_ships);
xml_register_callback(parse_equipment);
} }

View File

@ -56,7 +56,6 @@
#undef XECMD_MODULE #undef XECMD_MODULE
#define WDW_PHOENIX #define WDW_PHOENIX
#define WDW_PYRAMIDSPELL #define WDW_PYRAMIDSPELL
#define NEW_STARTEQUIPMENT
#define KEEP_UNZIPPED 1 #define KEEP_UNZIPPED 1

View File

@ -632,13 +632,6 @@ main(int argc, char *argv[])
i = readgame(zText, false); i = readgame(zText, false);
if (i!=0) return i; if (i!=0) return i;
#ifdef NEW_STARTEQUIPMENT
add_equipment(it_find("conquesttoken"), 1);
add_equipment(it_find("wood"), 30);
add_equipment(it_find("stone"), 30);
add_equipment(it_find("money"), 2000 + turn * 10);
#endif
confirm_newbies(); confirm_newbies();
update_subscriptions(); update_subscriptions();
{ {

View File

@ -652,7 +652,7 @@ main(int argc, char *argv[])
sqlpatch = true; sqlpatch = true;
log_open("eressea.log"); log_open("eressea.log");
printf("\n%s PBEM host\n" printf("\n%s PBEM host\n"
"Copyright (C) 1996-2004 C. Schlittchen, K. Zedel, E. Rehling, H. Peters.\n\n" "Copyright (C) 1996-2005 C. Schlittchen, K. Zedel, E. Rehling, H. Peters.\n\n"
"Compilation: " __DATE__ " at " __TIME__ "\nVersion: %f\n\n", global.gamename, version()); "Compilation: " __DATE__ " at " __TIME__ "\nVersion: %f\n\n", global.gamename, version());
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

8
src/res/equipment.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<equipment>
<item name="conquesttoken" amount="1"/>
<item name="wood" amount="30"/>
<item name="stone" amount="30"/>
<item name="money" amount="2000"/>
</equipment>

View File

@ -15,6 +15,10 @@
<xi:include file="alchemy.xml"/> <xi:include file="alchemy.xml"/>
<xi:include file="technologies.xml"/> <xi:include file="technologies.xml"/>
<xi:include file="skills.xml"/> <xi:include file="skills.xml"/>
<equipment>
<item name="wood" amount="5"/>
<item name="stone" amount="10"/>
</equipment>
<game name="HSE" welcome="eressea"> <game name="HSE" welcome="eressea">
<comment>Game specific</comment> <comment>Game specific</comment>

View File

@ -11,10 +11,11 @@
<xi:include href="prefixes.xml"/> <xi:include href="prefixes.xml"/>
<xi:include href="ships.xml"/> <xi:include href="ships.xml"/>
<xi:include href="buildings.xml"/> <xi:include href="buildings.xml"/>
<xi:include file="terrains.xml"/> <xi:include href="terrains.xml"/>
<xi:include file="alchemy.xml"/> <xi:include href="alchemy.xml"/>
<xi:include file="technologies.xml"/> <xi:include href="technologies.xml"/>
<xi:include file="skills.xml"/> <xi:include href="skills.xml"/>
<xi:include href="equipment.xml"/>
<game name="Eressea" welcome="eressea"> <game name="Eressea" welcome="eressea">
<comment>Game specific</comment> <comment>Game specific</comment>

View File

@ -12,6 +12,7 @@
<xi:include href="resources.xml"/> <xi:include href="resources.xml"/>
<xi:include href="ships.xml"/> <xi:include href="ships.xml"/>
<xi:include href="buildings.xml"/> <xi:include href="buildings.xml"/>
<xi:include href="equipment.xml"/>
<game name="Tutorial" welcome="tutorial"> <game name="Tutorial" welcome="tutorial">
<comment>Game specific</comment> <comment>Game specific</comment>

View File

@ -12,6 +12,7 @@
<xi:include href="resources.xml"/> <xi:include href="resources.xml"/>
<xi:include href="ships.xml"/> <xi:include href="ships.xml"/>
<xi:include href="buildings.xml"/> <xi:include href="buildings.xml"/>
<xi:include href="equipment.xml"/>
<game name="Wettstreit der Weisen" units="250" welcome="vinyambar"> <game name="Wettstreit der Weisen" units="250" welcome="vinyambar">
<comment>Game specific</comment> <comment>Game specific</comment>

View File

@ -51,8 +51,6 @@ unterschiede in vin3 + wdw per config statt defines?
#define WDW_PHOENIX #define WDW_PHOENIX
#define WDW_PYRAMIDSPE #define WDW_PYRAMIDSPE
LL
#define NEW_STARTEQUIPMENT
#define ARENA_MODULE #define ARENA_MODULE
#define WORMHOLE_MODULE #define WORMHOLE_MODULE