From 28921d4e3de39bedad15f00b75a78ae193469a19 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 18 Aug 2007 14:54:35 +0000 Subject: [PATCH] Unicode WIP: we're compiling on Linux --- src/common/gamecode/Jamfile | 2 +- src/common/kernel/Jamfile | 2 +- src/common/kernel/alchemy.c | 15 ++++---- src/common/kernel/race.c | 70 ------------------------------------- src/common/kernel/reports.c | 3 +- src/common/kernel/save.c | 4 +-- src/common/util/unicode.c | 1 + 7 files changed, 16 insertions(+), 81 deletions(-) diff --git a/src/common/gamecode/Jamfile b/src/common/gamecode/Jamfile index 7c78ffd5a..bf6e16ea1 100644 --- a/src/common/gamecode/Jamfile +++ b/src/common/gamecode/Jamfile @@ -18,7 +18,7 @@ SOURCES = luck.c monster.c randenc.c - report.c +# report.c spells.c spy.c study.c diff --git a/src/common/kernel/Jamfile b/src/common/kernel/Jamfile index 614b5d20e..831f6d57e 100644 --- a/src/common/kernel/Jamfile +++ b/src/common/kernel/Jamfile @@ -24,7 +24,7 @@ SOURCES = karma.c magic.c message.c - movement.c + move.c names.c order.c pathfinder.c diff --git a/src/common/kernel/alchemy.c b/src/common/kernel/alchemy.c index 2827d7ef0..83d17b76a 100644 --- a/src/common/kernel/alchemy.c +++ b/src/common/kernel/alchemy.c @@ -37,6 +37,8 @@ /* util includes */ #include +#include +#include #include /* libc includes */ @@ -220,8 +222,8 @@ change_effect (unit * u, const potion_type * effect, int delta) attrib * a = a_find(u->attribs, &at_effect); effect_data * data = NULL; - while (a && a->type==&at_effect) { - data = (effect_data *)a->data.v; + while (a && a->type==&at_effect) { + data = (effect_data *)a->data.v; if (data->type==effect) { if (data->value+delta==0) { a_remove(&u->attribs, a); @@ -231,14 +233,15 @@ change_effect (unit * u, const potion_type * effect, int delta) return data->value; } } - a = a->next; - } - + a = a->next; + } + a = a_add(&u->attribs, a_new(&at_effect)); data = (effect_data*)a->data.v; data->type = effect; data->value = delta; + return data->value; } log_error(("change effect with delta==0 for unit %s\n", itoa36(u->no))); - return data->value; + return 0; } diff --git a/src/common/kernel/race.c b/src/common/kernel/race.c index 276ba422b..6d08f918a 100644 --- a/src/common/kernel/race.c +++ b/src/common/kernel/race.c @@ -221,47 +221,6 @@ unit_max_hp(const unit * u) return h; } -static void -equip_newunits(const struct equipment * eq, struct unit *u) -{ - struct region *r = u->region; - - switch (old_race(u->race)) { - case RC_ELF: - set_show_item(u->faction, I_FEENSTIEFEL); - break; - case RC_GOBLIN: - set_show_item(u->faction, I_RING_OF_INVISIBILITY); - set_number(u, 10); - break; - case RC_HUMAN: - if (u->building==NULL) { - const building_type * btype = bt_find("castle"); - if (btype!=NULL) { - building *b = new_building(btype, r, u->faction->locale); - b->size = 10; - u->building = b; - fset(u, UFL_OWNER); - } - } - break; - case RC_CAT: - set_show_item(u->faction, I_RING_OF_INVISIBILITY); - break; - case RC_AQUARIAN: - { - ship *sh = new_ship(st_find("boat"), u->faction->locale, r); - sh->size = sh->type->construction->maxsize; - u->ship = sh; - fset(u, UFL_OWNER); - } - break; - case RC_CENTAUR: - rsethorses(r, 250+rng_int()%51+rng_int()%51); - break; - } -} - boolean r_insectstalled(const region * r) { @@ -305,35 +264,6 @@ racename(const struct locale *loc, const unit *u, const race * rc) return LOC(loc, rc_name(rc, u->number != 1)); } -static void -oldfamiliars(unit * u) -{ - char fname[64]; - /* these familiars have no special skills. - */ - snprintf(fname, sizeof(fname), "%s_familiar", u->race->_name[0]); - create_mage(u, M_GRAU); - equip_unit(u, get_equipment(fname)); -} - -static item * -default_spoil(const struct race * rc, int size) -{ - item * itm = NULL; - - if (rng_int()%100 < RACESPOILCHANCE) { - char spoilname[32]; - const item_type * itype; - - sprintf(spoilname, "%sspoil", rc->_name[0]); - itype = it_find(spoilname); - if (itype!=NULL) { - i_add(&itm, i_new(itype, size)); - } - } - return itm; -} - int rc_specialdamage(const race * ar, const race * dr, const struct weapon_type * wtype) { diff --git a/src/common/kernel/reports.c b/src/common/kernel/reports.c index a8eac9d87..7fd7a505a 100644 --- a/src/common/kernel/reports.c +++ b/src/common/kernel/reports.c @@ -53,6 +53,7 @@ #include /* libc includes */ +#include #include #include #include @@ -1420,7 +1421,7 @@ init_reports(void) #ifdef HAVE_STAT { - stat_type st; + struct stat st; if (stat(reportpath(), &st)==0) return 0; } #endif diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index dc50fe966..55cff0fb0 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -349,7 +349,7 @@ fwritestr(FILE * F, const char * str) static void -rds(FILE * F, void **ds) +rds(FILE * F, char **ds) { static char buffer[DISPLAYSIZE + 1]; /*Platz für null-char nicht vergessen!*/ char *s = &buffer[0]; @@ -387,7 +387,7 @@ rds(FILE * F, void **ds) static void -xrds(FILE * F, void **ds, int encoding) +xrds(FILE * F, char **ds, int encoding) { static char buffer[DISPLAYSIZE + 1]; /*Platz für null-char nicht vergessen!*/ int len = freadstr(F, encoding, buffer, sizeof(buffer)); diff --git a/src/common/util/unicode.c b/src/common/util/unicode.c index 9121b5a62..351ba8917 100644 --- a/src/common/util/unicode.c +++ b/src/common/util/unicode.c @@ -12,6 +12,7 @@ #include "unicode.h" #include +#include int unicode_utf8_strcasecmp(const char * a, const char * b)