Unicode WIP: we're compiling on Linux

This commit is contained in:
Enno Rehling 2007-08-18 14:54:35 +00:00
parent 4e863e9059
commit 28921d4e3d
7 changed files with 16 additions and 81 deletions

View file

@ -18,7 +18,7 @@ SOURCES =
luck.c
monster.c
randenc.c
report.c
# report.c
spells.c
spy.c
study.c

View file

@ -24,7 +24,7 @@ SOURCES =
karma.c
magic.c
message.c
movement.c
move.c
names.c
order.c
pathfinder.c

View file

@ -37,6 +37,8 @@
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/log.h>
#include <util/rand.h>
/* 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;
}

View file

@ -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)
{

View file

@ -53,6 +53,7 @@
#include <util/log.h>
/* libc includes */
#include <sys/stat.h>
#include <assert.h>
#include <errno.h>
#include <limits.h>
@ -1420,7 +1421,7 @@ init_reports(void)
#ifdef HAVE_STAT
{
stat_type st;
struct stat st;
if (stat(reportpath(), &st)==0) return 0;
}
#endif

View file

@ -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));

View file

@ -12,6 +12,7 @@
#include "unicode.h"
#include <errno.h>
#include <wctype.h>
int
unicode_utf8_strcasecmp(const char * a, const char * b)