* Compilerfehler in curses ausgebaut

* 2 kaputte curseinfo Funktionen gefixt
* Warnings eliminiert
This commit is contained in:
Enno Rehling 2002-05-25 06:58:54 +00:00
parent 7a9a8da8f0
commit 80e3d47d1a
8 changed files with 66 additions and 17 deletions

View File

@ -2427,8 +2427,8 @@ remove_empty_units_in_region(region *r)
while (*up) { while (*up) {
unit * u = *up; unit * u = *up;
faction * f = u->faction;
#ifdef MAXAGE #ifdef MAXAGE
faction * f = u->faction;
if (f->age > MAXAGE) set_number(u, 0); if (f->age > MAXAGE) set_number(u, 0);
#endif #endif
if ((u->number <= 0 && u->race != new_race[RC_SPELL]) if ((u->number <= 0 && u->race != new_race[RC_SPELL])

View File

@ -284,9 +284,9 @@ unit_max_hp(const unit * u)
{ {
int h; int h;
double p; double p;
static const curse_type * heal_ct = NULL;
h = u->race->hitpoints; h = u->race->hitpoints;
static const curse_type * heal_ct; if (heal_ct==NULL) heal_ct = ct_find("healingzone");
heal_ct = ct_find("healingzone");
p = pow(effskill(u, SK_AUSDAUER) / 2.0, 1.5) * 0.2; p = pow(effskill(u, SK_AUSDAUER) / 2.0, 1.5) * 0.2;

View File

@ -4955,6 +4955,7 @@ sp_depression(castorder *co)
return cast_level; return cast_level;
} }
#if 0
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* Name: Hoher Gesang der Drachen /* Name: Hoher Gesang der Drachen
* Stufe: 14 * Stufe: 14
@ -4969,7 +4970,6 @@ sp_depression(castorder *co)
* (FARCASTING | REGIONSPELL | TESTRESISTANCE) * (FARCASTING | REGIONSPELL | TESTRESISTANCE)
*/ */
/* TODO zur Aktivierung in Zauberliste aufnehmen*/ /* TODO zur Aktivierung in Zauberliste aufnehmen*/
static int static int
sp_dragonsong(castorder *co) sp_dragonsong(castorder *co)
{ {
@ -5043,7 +5043,7 @@ sp_songofAttraction(castorder *co)
return cast_level; return cast_level;
} }
#endif
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* TRAUM - Illaun */ /* TRAUM - Illaun */

View File

@ -34,7 +34,7 @@
int int
cinfo_building(const locale * lang, void * obj, typ_t typ, curse *c, int self) cinfo_building(const locale * lang, const void * obj, typ_t typ, curse *c, int self)
{ {
message * msg; message * msg;
@ -55,7 +55,7 @@ cinfo_building(const locale * lang, void * obj, typ_t typ, curse *c, int self)
/* C_MAGICWALLS*/ /* C_MAGICWALLS*/
static int static int
cinfo_magicrunes(void * obj, typ_t typ, curse *c, int self) cinfo_magicrunes(const struct locale* lang, const void * obj, typ_t typ, curse *c, int self)
{ {
if (typ == TYP_BUILDING){ if (typ == TYP_BUILDING){

View File

@ -16,7 +16,7 @@
struct locale; struct locale;
struct curse; struct curse;
extern int cinfo_building(const struct locale * lang, void * obj, typ_t typ, struct curse *c, int self); extern int cinfo_building(const struct locale * lang, const void * obj, typ_t typ, struct curse *c, int self);
extern void register_buildingcurse(void); extern void register_buildingcurse(void);

View File

@ -16,6 +16,7 @@
/* kernel includes */ /* kernel includes */
#include <region.h> #include <region.h>
#include <plane.h>
#include <faction.h> #include <faction.h>
#include <race.h> #include <race.h>
#include <unit.h> #include <unit.h>
@ -277,21 +278,44 @@ preferred_terrain(const struct race * rc)
#define REGIONS_PER_FACTION 2 #define REGIONS_PER_FACTION 2
#define MINFACTIONS 1 #define MINFACTIONS 1
void int
mkisland(int nsize) mkisland(int nsize)
{ {
int x, y; int x = 0, y = 0;
region * r; region * r;
regionlist * rlist = NULL; regionlist * rlist = NULL;
int rsize; int rsize, isize=0;
if (listlen(newfactions)<MINFACTIONS) return; #ifdef RANDOM_LOCATION
do { do {
x = (rand() % 2001) - 1000; x = (rand() % 2001) - 1000;
y = (rand() % 2001) - 1000; y = (rand() % 2001) - 1000;
r = findregion(x, y); r = findregion(x, y);
} while (r!=NULL); } while (r!=NULL);
#else
region * rmin = NULL;
direction_t d;
int dist;
for (r=regions;r;r=r->next) {
struct plane * p = rplane(r);
if (p==NULL && (rmin==NULL || r->age<=rmin->age)) rmin=r;
}
r = NULL;
for (dist=1;r!=rmin;++dist) {
for (d=0;r!=rmin && d!=MAXDIRECTIONS;++d) {
int i;
region * rn = rmin;
for (i=0;i!=dist;++i) rn=rconnect(rn, d);
if (rn==NULL) {
r = rmin;
x = rmin->x + delta_x[d] * dist;
y = rmin->y + delta_y[d] * dist;
}
}
}
#endif
if (listlen(newfactions)<MINFACTIONS) return 0;
r = new_region(x, y); r = new_region(x, y);
terraform(r, T_OCEAN); terraform(r, T_OCEAN);
add_regionlist(&rlist, r); add_regionlist(&rlist, r);
@ -309,6 +333,7 @@ mkisland(int nsize)
newfaction ** nfp, * nextf = newfactions; newfaction ** nfp, * nextf = newfactions;
unit * u; unit * u;
terraform(r, preferred_terrain(nextf->race)); terraform(r, preferred_terrain(nextf->race));
++isize;
u = addplayer(r, nextf->email, nextf->password, nextf->race, nextf->lang); u = addplayer(r, nextf->email, nextf->password, nextf->race, nextf->lang);
/* remove duplicate email addresses */ /* remove duplicate email addresses */
@ -336,5 +361,28 @@ mkisland(int nsize)
} }
} }
} }
if (rlist) {
regionlist ** rbegin = &rlist;
int i;
#define MINOCEANDIST 3
for (i=0;i!=MINOCEANDIST;++i) {
regionlist ** rend = rbegin;
while (*rend) rend=&(*rend)->next;
while (rbegin!=rend) {
direction_t d;
region * r = (*rbegin)->region;
rbegin=&(*rbegin)->next;
for (d=0;d!=MAXDIRECTIONS;++d) {
region * rn = rconnect(r, d);
if (rn==NULL) {
rn = new_region(r->x + delta_x[d], r->y + delta_y[d]);
terraform(rn, T_OCEAN);
add_regionlist(rend, rn);
}
}
} }
}
}
return isize;
}

View File

@ -30,6 +30,6 @@ extern newfaction * newfactions;
extern void autoseed(struct regionlist * rlist); extern void autoseed(struct regionlist * rlist);
extern void get_island(struct regionlist ** rlist); extern void get_island(struct regionlist ** rlist);
extern void mkisland(int nsize); extern int mkisland(int nsize);
#endif #endif

View File

@ -12,6 +12,7 @@
*/ */
#define VERSION "3.3.0" #define VERSION "3.3.0"
#define ISLANDSIZE 20
#define MAIN_C #define MAIN_C
#define BOOL_DEFINED #define BOOL_DEFINED
@ -1052,7 +1053,7 @@ movearound(int rx, int ry) {
modified = 1; modified = 1;
break; break;
case 'm': case 'm':
mkisland(20); mkisland(ISLANDSIZE);
modified = 1; modified = 1;
break; break;
case 'S': case 'S':
@ -1593,7 +1594,7 @@ main(int argc, char *argv[])
if (autoseeding) { if (autoseeding) {
while (newfactions) { while (newfactions) {
int n = listlen(newfactions); int n = listlen(newfactions);
int k = (n+19)/20; int k = (n+ISLANDSIZE-1)/ISLANDSIZE;
k = n / k; k = n / k;
mkisland(k); mkisland(k);
} }