From 41d8f1ebfa49dbc122a729e652d651447e1ed4e1 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 3 Jan 2005 21:28:21 +0000 Subject: [PATCH] =?UTF-8?q?-=20Startgegenst=C3=A4nde=20=C3=BCber=20XML=20d?= =?UTF-8?q?efinierbar=20(nicht=20lua,=20weil=20dann=20nicht=20im=20mapper)?= =?UTF-8?q?=20-=20TARNE=20PARTEI=20NUMMER=20geht=20wieder=20richtig,=20hof?= =?UTF-8?q?fe=20ich?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/gamecode/laws.c | 2 +- src/common/gamecode/spy.c | 12 +++++------ src/common/kernel/race.c | 11 +--------- src/common/kernel/save.c | 2 +- src/common/kernel/xmlreader.c | 38 +++++++++++++++++++++++++++++++++++ src/common/settings-wdw.h | 1 - src/eressea/main.c | 7 ------- src/eressea/server.cpp | 2 +- src/res/equipment.xml | 8 ++++++++ src/res/eressea-hse-05-01.xml | 4 ++++ src/res/eressea.xml | 9 +++++---- src/res/tutorial.xml | 1 + src/res/vinyambar-wdw.xml | 1 + src/todo.txt | 2 -- 14 files changed, 67 insertions(+), 33 deletions(-) create mode 100644 src/res/equipment.xml diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index d69f75663..9768fedec 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -3694,7 +3694,7 @@ processorders (void) parse(K_MAIL, prepare_mail_cmd, false); parse(K_MAIL, mail_cmd, false); - puts(" - Altern"); + puts(" - Parteien altern"); age_factions(); puts(" - Benutzen"); diff --git a/src/common/gamecode/spy.c b/src/common/gamecode/spy.c index 3bf218d41..9cccb5aab 100644 --- a/src/common/gamecode/spy.c +++ b/src/common/gamecode/spy.c @@ -24,7 +24,8 @@ #include "spy.h" /* kernel includes */ -#include "build.h" +#include +#include #include "economy.h" #include "item.h" #include "karma.h" @@ -236,16 +237,15 @@ setstealth_cmd(unit * u, struct order * ord) while (mu!=NULL) { unit * ru = mu->region->units; if (mu->region!=lastr) { + lastr = mu->region; while (ru!=NULL) { - attrib *a = a_find(ru->attribs, &at_otherfaction); - if (a) { - faction *fv = get_otherfaction(a); - if (fv==f) break; + faction * fv = visible_faction(f, ru); + if (fv==f) { + if (cansee(f, lastr, ru, 0)) break; } ru = ru->next; } if (ru!=NULL) break; - lastr = mu->region; } mu = mu->nextF; } diff --git a/src/common/kernel/race.c b/src/common/kernel/race.c index c4207dd6d..da4f56f8e 100644 --- a/src/common/kernel/race.c +++ b/src/common/kernel/race.c @@ -181,21 +181,12 @@ void add_equipment(const item_type * itype, int number) void give_starting_equipment(struct region *r, struct unit *u) { -#ifdef NEW_STARTEQUIPMENT item * itm = equipment; while (itm!=NULL) { i_add(&u->items, i_new(itm->type, itm->number)); itm=itm->next; } -#else - 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 + set_money(u, turn * 10); switch(old_race(u->race)) { case RC_DWARF: diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index ce290c7c7..bd82f6b98 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -1836,7 +1836,7 @@ readgame(const char * filename, int backup) int y = ri(F); plane * pl = findplane(x, y); - if (firstx && firsty) { + if (firstx || firsty) { if (x!=firstx || y!=firsty) { skip = true; } else { diff --git a/src/common/kernel/xmlreader.c b/src/common/kernel/xmlreader.c index 2425bb2ad..e9cf3e967 100644 --- a/src/common/kernel/xmlreader.c +++ b/src/common/kernel/xmlreader.c @@ -711,6 +711,43 @@ parse_resources(xmlDocPtr doc) 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 parse_races(xmlDocPtr doc) { @@ -1201,4 +1238,5 @@ register_xmlreader(void) xml_register_callback(parse_resources); xml_register_callback(parse_buildings); xml_register_callback(parse_ships); + xml_register_callback(parse_equipment); } diff --git a/src/common/settings-wdw.h b/src/common/settings-wdw.h index b6701c764..61aa8af5d 100644 --- a/src/common/settings-wdw.h +++ b/src/common/settings-wdw.h @@ -56,7 +56,6 @@ #undef XECMD_MODULE #define WDW_PHOENIX #define WDW_PYRAMIDSPELL -#define NEW_STARTEQUIPMENT #define KEEP_UNZIPPED 1 diff --git a/src/eressea/main.c b/src/eressea/main.c index c9b784f9a..b756ae9a8 100644 --- a/src/eressea/main.c +++ b/src/eressea/main.c @@ -632,13 +632,6 @@ main(int argc, char *argv[]) i = readgame(zText, false); 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(); update_subscriptions(); { diff --git a/src/eressea/server.cpp b/src/eressea/server.cpp index 88801a3ae..19a503505 100644 --- a/src/eressea/server.cpp +++ b/src/eressea/server.cpp @@ -652,7 +652,7 @@ main(int argc, char *argv[]) sqlpatch = true; log_open("eressea.log"); 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()); setlocale(LC_ALL, ""); diff --git a/src/res/equipment.xml b/src/res/equipment.xml new file mode 100644 index 000000000..50d2e8a13 --- /dev/null +++ b/src/res/equipment.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/res/eressea-hse-05-01.xml b/src/res/eressea-hse-05-01.xml index 44c23fbc9..ae6b8649a 100644 --- a/src/res/eressea-hse-05-01.xml +++ b/src/res/eressea-hse-05-01.xml @@ -15,6 +15,10 @@ + + + + Game specific diff --git a/src/res/eressea.xml b/src/res/eressea.xml index 5847636d6..11ceb64e1 100644 --- a/src/res/eressea.xml +++ b/src/res/eressea.xml @@ -11,10 +11,11 @@ - - - - + + + + + Game specific diff --git a/src/res/tutorial.xml b/src/res/tutorial.xml index b7d53782e..13dfe9eff 100644 --- a/src/res/tutorial.xml +++ b/src/res/tutorial.xml @@ -12,6 +12,7 @@ + Game specific diff --git a/src/res/vinyambar-wdw.xml b/src/res/vinyambar-wdw.xml index 8a9452149..9d557949a 100644 --- a/src/res/vinyambar-wdw.xml +++ b/src/res/vinyambar-wdw.xml @@ -12,6 +12,7 @@ + Game specific diff --git a/src/todo.txt b/src/todo.txt index 9cb5deaf2..9a6a6dc0a 100644 --- a/src/todo.txt +++ b/src/todo.txt @@ -51,8 +51,6 @@ unterschiede in vin3 + wdw per config statt defines? #define WDW_PHOENIX #define WDW_PYRAMIDSPE - LL - #define NEW_STARTEQUIPMENT #define ARENA_MODULE #define WORMHOLE_MODULE