* 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) {
unit * u = *up;
faction * f = u->faction;
#ifdef MAXAGE
faction * f = u->faction;
if (f->age > MAXAGE) set_number(u, 0);
#endif
if ((u->number <= 0 && u->race != new_race[RC_SPELL])

View File

@ -284,9 +284,9 @@ unit_max_hp(const unit * u)
{
int h;
double p;
static const curse_type * heal_ct = NULL;
h = u->race->hitpoints;
static const curse_type * heal_ct;
heal_ct = ct_find("healingzone");
if (heal_ct==NULL) heal_ct = ct_find("healingzone");
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;
}
#if 0
/* ------------------------------------------------------------- */
/* Name: Hoher Gesang der Drachen
* Stufe: 14
@ -4969,7 +4970,6 @@ sp_depression(castorder *co)
* (FARCASTING | REGIONSPELL | TESTRESISTANCE)
*/
/* TODO zur Aktivierung in Zauberliste aufnehmen*/
static int
sp_dragonsong(castorder *co)
{
@ -5043,7 +5043,7 @@ sp_songofAttraction(castorder *co)
return cast_level;
}
#endif
/* ------------------------------------------------------------- */
/* TRAUM - Illaun */

View File

@ -34,7 +34,7 @@
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;
@ -55,7 +55,7 @@ cinfo_building(const locale * lang, void * obj, typ_t typ, curse *c, int self)
/* C_MAGICWALLS*/
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){

View File

@ -16,7 +16,7 @@
struct locale;
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);

View File

@ -16,6 +16,7 @@
/* kernel includes */
#include <region.h>
#include <plane.h>
#include <faction.h>
#include <race.h>
#include <unit.h>
@ -277,21 +278,44 @@ preferred_terrain(const struct race * rc)
#define REGIONS_PER_FACTION 2
#define MINFACTIONS 1
void
int
mkisland(int nsize)
{
int x, y;
int x = 0, y = 0;
region * r;
regionlist * rlist = NULL;
int rsize;
int rsize, isize=0;
if (listlen(newfactions)<MINFACTIONS) return;
#ifdef RANDOM_LOCATION
do {
x = (rand() % 2001) - 1000;
y = (rand() % 2001) - 1000;
r = findregion(x, y);
} 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);
terraform(r, T_OCEAN);
add_regionlist(&rlist, r);
@ -309,6 +333,7 @@ mkisland(int nsize)
newfaction ** nfp, * nextf = newfactions;
unit * u;
terraform(r, preferred_terrain(nextf->race));
++isize;
u = addplayer(r, nextf->email, nextf->password, nextf->race, nextf->lang);
/* 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 get_island(struct regionlist ** rlist);
extern void mkisland(int nsize);
extern int mkisland(int nsize);
#endif

View File

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