forked from github/server
- ich denke, es liegt daran dass es regionen gibt, die schemen zweier anderer regionen sind - für die ist nicht klar, welche astralregion bei zaubern wie dem tor benutzt werden.
This commit is contained in:
parent
deaf47ded7
commit
85d0383471
|
@ -1348,7 +1348,7 @@ report_computer(FILE * F, faction * f, const faction_list * addresses,
|
|||
if (sd->mode==see_unit && r->planep && r->planep->id == 1 && !is_cursed(r->attribs, C_ASTRALBLOCK, 0))
|
||||
{
|
||||
/* Sonderbehandlung Teleport-Ebene */
|
||||
region_list *rl = allinhab_in_range(r_astral_to_standard(r),TP_RADIUS);
|
||||
region_list *rl = astralregions(r_astral_to_standard(r), inhabitable);
|
||||
|
||||
if (rl) {
|
||||
region_list *rl2 = rl;
|
||||
|
|
|
@ -1367,7 +1367,7 @@ describe(FILE * F, const region * r, int partial, faction * f)
|
|||
if (partial==0 && r->planep && r->planep->id == 1 &&
|
||||
!is_cursed(r->attribs, C_ASTRALBLOCK, 0)) {
|
||||
/* Sonderbehandlung Teleport-Ebene */
|
||||
region_list *rl = allinhab_in_range(r_astral_to_standard(r), TP_RADIUS);
|
||||
region_list *rl = astralregions(r_astral_to_standard(r), inhabitable);
|
||||
region_list *rl2;
|
||||
|
||||
if (rl) {
|
||||
|
|
|
@ -38,7 +38,7 @@ const int FIREWORK_RANGE=10;
|
|||
static int
|
||||
use_birthday_firework(struct unit * u, const struct item_type * itype, int amount, const char *cm)
|
||||
{
|
||||
region_list *rlist = all_in_range(u->region, FIREWORK_RANGE);
|
||||
region_list *rlist = all_in_range(u->region, FIREWORK_RANGE, NULL);
|
||||
region_list *rl;
|
||||
message *m;
|
||||
const char *name;
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "spell.h"
|
||||
#include "ship.h"
|
||||
#include "skill.h"
|
||||
#include "teleport.h"
|
||||
#include "unit.h"
|
||||
|
||||
/* util includes */
|
||||
|
@ -1065,7 +1066,7 @@ travel(unit * u, region * next, int flucht, region_list ** routep)
|
|||
|
||||
/* Im Astralraum sind Tyb und Ill-Magier doppelt so schnell.
|
||||
* Nicht kumulativ mit anderen Beschleunigungen! */
|
||||
if ( mp == 1 && getplane(next) == astral_plane && is_mage(u)) {
|
||||
if ( mp == 1 && getplane(next) == get_astralplane() && is_mage(u)) {
|
||||
if(get_mage(u)->magietyp == M_ASTRAL
|
||||
|| get_mage(u)->magietyp == M_TRAUM) {
|
||||
mp *= 2;
|
||||
|
|
|
@ -1916,7 +1916,7 @@ sp_treewalkexit(castorder *co)
|
|||
spellparameter *pa = co->par;
|
||||
int cast_level = co->level;
|
||||
|
||||
if(getplane(r) != astral_plane) {
|
||||
if(getplane(r) != get_astralplane()) {
|
||||
cmistake(mage, strdup(co->order), 193, MSG_MAGIC);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1939,7 +1939,7 @@ sp_treewalkexit(castorder *co)
|
|||
tay = rt->y;
|
||||
rt = NULL;
|
||||
|
||||
rl = allinhab_in_range(r_astral_to_standard(r),TP_RADIUS);
|
||||
rl = astralregions(r_astral_to_standard(r), inhabitable);
|
||||
rt = 0;
|
||||
|
||||
rl2 = rl;
|
||||
|
@ -2232,7 +2232,7 @@ sp_fog_of_confusion(castorder *co)
|
|||
range = (power-11)/3-1;
|
||||
duration = (int)((power-11)/1.5)+1;
|
||||
|
||||
rl = all_in_range(r, (int)range);
|
||||
rl = all_in_range(r, (int)range, NULL);
|
||||
|
||||
for(rl2 = rl; rl2; rl2 = rl2->next) {
|
||||
curse * c;
|
||||
|
@ -2807,7 +2807,7 @@ sp_summondragon(castorder *co)
|
|||
}
|
||||
}
|
||||
|
||||
rl = all_in_range(r, (int)power);
|
||||
rl = all_in_range(r, (int)power, NULL);
|
||||
|
||||
for(rl2 = rl; rl2; rl2 = rl2->next) {
|
||||
for(u = rl2->data->units; u; u = u->next) {
|
||||
|
@ -5598,7 +5598,7 @@ sp_dream_of_confusion(castorder *co)
|
|||
double range = (power-14)/2-1;
|
||||
int duration = (int)(power-14)+1;
|
||||
|
||||
rl = all_in_range(r, (int)range);
|
||||
rl = all_in_range(r, (int)range, NULL);
|
||||
|
||||
for(rl2 = rl; rl2; rl2 = rl2->next) {
|
||||
region * r2 = rl2->data;
|
||||
|
@ -5934,7 +5934,7 @@ sp_pullastral(castorder *co)
|
|||
case 1:
|
||||
rt = r;
|
||||
ro = pa->param[0]->data.r;
|
||||
rl = all_in_range(r_astral_to_standard(r), TP_RADIUS);
|
||||
rl = astralregions(r_astral_to_standard(r), NULL);
|
||||
rl2 = rl;
|
||||
while (rl2!=NULL) {
|
||||
region * r2 = rl2->data;
|
||||
|
@ -6066,7 +6066,7 @@ sp_leaveastral(castorder *co)
|
|||
MSG_MAGIC, ML_MISTAKE);
|
||||
return 0;
|
||||
}
|
||||
rl = allinhab_in_range(r_astral_to_standard(r), TP_RADIUS);
|
||||
rl = astralregions(r_astral_to_standard(r), inhabitable);
|
||||
rl2 = rl;
|
||||
while (rl2!=NULL) {
|
||||
if (rl2->data == rt) break;
|
||||
|
@ -6391,7 +6391,7 @@ sp_viewreality(castorder *co)
|
|||
return 0;
|
||||
}
|
||||
|
||||
rl = all_in_range(r_astral_to_standard(r), TP_RADIUS);
|
||||
rl = astralregions(r_astral_to_standard(r), NULL);
|
||||
|
||||
/* Irgendwann mal auf Curses u/o Attribut umstellen. */
|
||||
for (rl2=rl; rl2; rl2=rl2->next) {
|
||||
|
@ -6440,7 +6440,7 @@ sp_disruptastral(castorder *co)
|
|||
return 0;
|
||||
}
|
||||
|
||||
rl = all_in_range(rt, (int)(power/5));
|
||||
rl = all_in_range(rt, (int)(power/5), NULL);
|
||||
|
||||
for (rl2=rl; rl2!=NULL; rl2=rl2->next) {
|
||||
attrib *a, *a2;
|
||||
|
@ -6454,7 +6454,7 @@ sp_disruptastral(castorder *co)
|
|||
if (r2->units!=NULL) {
|
||||
region_list * trl2;
|
||||
|
||||
trl = allinhab_in_range(r_astral_to_standard(rl2->data), TP_RADIUS);
|
||||
trl = astralregions(r_astral_to_standard(rl2->data), inhabitable);
|
||||
for (trl2 = trl; trl2; trl2 = trl2->next) ++inhab_regions;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea-pbem.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* based on:
|
||||
*
|
||||
* Atlantis v1.0 13 September 1993 Copyright 1993 by Russell Wallace
|
||||
* Atlantis v1.7 Copyright 1996 by Alex Schröder
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
* This program may not be sold or used commercially without prior written
|
||||
* permission from the authors.
|
||||
*/
|
||||
*
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea-pbem.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* based on:
|
||||
*
|
||||
* Atlantis v1.0 13 September 1993 Copyright 1993 by Russell Wallace
|
||||
* Atlantis v1.7 Copyright 1996 by Alex Schröder
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
* This program may not be sold or used commercially without prior written
|
||||
* permission from the authors.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "eressea.h"
|
||||
|
@ -35,170 +35,172 @@
|
|||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define TE_CENTER_X 1000
|
||||
#define TE_CENTER_Y 1000
|
||||
#define TP_RADIUS 4
|
||||
|
||||
static int
|
||||
real2tp(int rk) {
|
||||
/* in C:
|
||||
* -4 / 5 = 0;
|
||||
* +4 / 5 = 0;
|
||||
* !!!!!!!!!!;
|
||||
*/
|
||||
return (rk + (TP_RADIUS*5000)) / TP_RADIUS - 5000;
|
||||
/* in C:
|
||||
* -4 / 5 = 0;
|
||||
* +4 / 5 = 0;
|
||||
* !!!!!!!!!!;
|
||||
*/
|
||||
return (rk + (TP_RADIUS*5000)) / TP_RADIUS - 5000;
|
||||
}
|
||||
|
||||
static region *
|
||||
tpregion(const region *r) {
|
||||
return findregion(TE_CENTER_X+real2tp(r->x), TE_CENTER_Y+real2tp(r->y));
|
||||
return findregion(TE_CENTER_X+real2tp(r->x), TE_CENTER_Y+real2tp(r->y));
|
||||
}
|
||||
|
||||
region_list *
|
||||
astralregions(const region * r, boolean (*valid)(const region *))
|
||||
{
|
||||
region_list * rlist = NULL;
|
||||
int x, y;
|
||||
|
||||
assert(rplane(r) == NULL);
|
||||
if (r==NULL) return NULL;
|
||||
r = r_astral_to_standard(r);
|
||||
|
||||
for (x=r->x-TP_RADIUS;x<=r->x+TP_RADIUS;++x) {
|
||||
for (y=r->y-TP_RADIUS;y<=r->y+TP_RADIUS;++y) {
|
||||
region * rn;
|
||||
int dist = koor_distance(r->x, r->y, x, y);
|
||||
|
||||
if (dist > TP_RADIUS) continue;
|
||||
if (dist==4) {
|
||||
/* these three regions are in dispute with the NW, W & SW areas */
|
||||
if (x==-2 && y==0) continue;
|
||||
if (x==-2 && y==2) continue;
|
||||
if (x==0 && y==-2) continue;
|
||||
}
|
||||
rn = findregion(x, y);
|
||||
if (rn!=NULL && (valid==NULL || valid(rn))) add_regionlist(&rlist, rn);
|
||||
}
|
||||
}
|
||||
return rlist;
|
||||
}
|
||||
|
||||
region *
|
||||
r_standard_to_astral(const region *r)
|
||||
{
|
||||
region *r2;
|
||||
#if 0
|
||||
int x, y;
|
||||
region *r2;
|
||||
r2 = tpregion(r);
|
||||
|
||||
x = TE_CENTER_X + (r->x/TP_RADIUS);
|
||||
y = TE_CENTER_Y + (r->y/TP_RADIUS);
|
||||
if (rplane(r2) != get_astralplane() || rterrain(r2) != T_ASTRAL) return NULL;
|
||||
|
||||
r2 = findregion(x,y);
|
||||
#endif
|
||||
|
||||
r2 = tpregion(r);
|
||||
|
||||
if(getplaneid(r2) != 1 || rterrain(r2) != T_ASTRAL)
|
||||
return NULL;
|
||||
|
||||
return r2;
|
||||
return r2;
|
||||
}
|
||||
|
||||
region *
|
||||
r_astral_to_standard(const region *r)
|
||||
{
|
||||
int x, y;
|
||||
region *r2;
|
||||
int x, y;
|
||||
region *r2;
|
||||
|
||||
assert(getplaneid(r) == 1);
|
||||
x = (r->x-TE_CENTER_X)*TP_RADIUS;
|
||||
y = (r->y-TE_CENTER_Y)*TP_RADIUS;
|
||||
assert(rplane(r) == get_astralplane());
|
||||
x = (r->x-TE_CENTER_X)*TP_RADIUS;
|
||||
y = (r->y-TE_CENTER_Y)*TP_RADIUS;
|
||||
|
||||
r2 = findregion(x,y);
|
||||
if(!r2 || getplaneid(r2) != 0)
|
||||
return NULL;
|
||||
r2 = findregion(x,y);
|
||||
if (r2!=NULL || getplaneid(r2) != 0) return NULL;
|
||||
|
||||
return r2;
|
||||
return r2;
|
||||
}
|
||||
|
||||
region_list *
|
||||
all_in_range(region *r, int n)
|
||||
all_in_range(const region *r, int n, boolean (*valid)(const region *))
|
||||
{
|
||||
int x,y;
|
||||
region_list *rlist = NULL;
|
||||
region *r2;
|
||||
int x,y;
|
||||
region_list *rlist = NULL;
|
||||
|
||||
if(r == NULL) return NULL; /* Um Probleme abzufangen,
|
||||
wenn zu einer Astralregion
|
||||
noch kein Realitätsregion existiert.
|
||||
Nicht gut, aber nicht zu ändern. */
|
||||
if (r == NULL) return NULL;
|
||||
|
||||
for(x = r->x-n; x <= r->x+n; x++) {
|
||||
for(y = r->y-n; y <= r->y+n; y++) {
|
||||
if(koor_distance(r->x, r->y, x, y) <= n) {
|
||||
r2 = findregion(x,y);
|
||||
if(r2) add_regionlist(&rlist, findregion(x,y));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (x = r->x-n; x <= r->x+n; x++) {
|
||||
for (y = r->y-n; y <= r->y+n; y++) {
|
||||
if (koor_distance(r->x, r->y, x, y) <= n) {
|
||||
region * r2 = findregion(x,y);
|
||||
if (r2!=NULL && (valid==NULL || valid(r2))) add_regionlist(&rlist, r2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rlist;
|
||||
return rlist;
|
||||
}
|
||||
|
||||
void
|
||||
random_in_teleport_plane(void)
|
||||
{
|
||||
region *r;
|
||||
unit *u;
|
||||
faction *f0 = findfaction(MONSTER_FACTION);
|
||||
region *r;
|
||||
faction *f0 = findfaction(MONSTER_FACTION);
|
||||
int next = rand() % 100;
|
||||
|
||||
if(!f0) return;
|
||||
if (f0==NULL) return;
|
||||
|
||||
for(r=regions; r; r=r->next) {
|
||||
if(getplaneid(r) != 1 || rterrain(r) != T_ASTRAL) continue;
|
||||
for (r=regions; r; r=r->next) {
|
||||
if (rplane(r) != get_astralplane() || rterrain(r) != T_ASTRAL) continue;
|
||||
|
||||
/* Neues Monster ? */
|
||||
if(rand()%100 == 0) {
|
||||
switch(rand()%1) {
|
||||
case 0:
|
||||
u = createunit(r, f0, 1+rand()%10+rand()%10, new_race[RC_HIRNTOETER]);
|
||||
set_string(&u->name, "Hirntöter");
|
||||
set_string(&u->display, "Wabernde grüne Schwaden treiben durch den Nebel und verdichten sich zu einer unheimlichen Kreatur, die nur aus einem langen Ruderschwanz und einem riesigen runden Maul zu bestehen scheint.");
|
||||
set_level(u, SK_STEALTH, 1);
|
||||
set_level(u, SK_OBSERVATION, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Neues Monster ? */
|
||||
if (next-- == 0) {
|
||||
unit *u = createunit(r, f0, 1+rand()%10+rand()%10, new_race[RC_HIRNTOETER]);
|
||||
|
||||
set_string(&u->name, "Hirntöter");
|
||||
set_string(&u->display, "Wabernde grüne Schwaden treiben durch den Nebel und verdichten sich zu einer unheimlichen Kreatur, die nur aus einem langen Ruderschwanz und einem riesigen runden Maul zu bestehen scheint.");
|
||||
set_level(u, SK_STEALTH, 1);
|
||||
set_level(u, SK_OBSERVATION, 1);
|
||||
next = rand() % 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plane * astral_plane;
|
||||
plane *
|
||||
get_astralplane(void)
|
||||
{
|
||||
static plane * astral_plane = NULL;
|
||||
if (astral_plane==NULL) {
|
||||
astral_plane = getplanebyid(1);
|
||||
}
|
||||
if (astral_plane==NULL) {
|
||||
astral_plane = create_new_plane(1, "Astralraum",
|
||||
TE_CENTER_X-500, TE_CENTER_X+500,
|
||||
TE_CENTER_Y-500, TE_CENTER_Y+500, 0);
|
||||
}
|
||||
return astral_plane;
|
||||
}
|
||||
|
||||
void
|
||||
create_teleport_plane(void)
|
||||
{
|
||||
region *r;
|
||||
int i;
|
||||
region *r;
|
||||
int i;
|
||||
plane * aplane = get_astralplane();
|
||||
|
||||
astral_plane = getplanebyid(1);
|
||||
/* Regionsbereich aufbauen. */
|
||||
/* wichtig: das muß auch für neue regionen gemacht werden.
|
||||
* Evtl. bringt man es besser in new_region() unter, und
|
||||
* übergibt an new_region die plane mit, in der die
|
||||
* Region gemacht wird.
|
||||
*/
|
||||
|
||||
if (!astral_plane) {
|
||||
astral_plane = create_new_plane(1, "Astralraum",
|
||||
TE_CENTER_X-500, TE_CENTER_X+500,
|
||||
TE_CENTER_Y-500, TE_CENTER_Y+500,
|
||||
0);
|
||||
}
|
||||
for (r=regions;r;r=r->next) if(r->planep == NULL) {
|
||||
region *ra = tpregion(r);
|
||||
if (ra==NULL) {
|
||||
ra = new_region(TE_CENTER_X+real2tp(r->x), TE_CENTER_Y+real2tp(r->y));
|
||||
rsetterrain(ra, T_ASTRAL);
|
||||
}
|
||||
ra->planep = aplane;
|
||||
if (terrain[rterrain(r)].flags & FORBIDDEN_LAND) rsetterrain(ra, T_ASTRALB);
|
||||
}
|
||||
|
||||
/* Regionsbereich aufbauen. */
|
||||
/* wichtig: das muß auch für neue regionen gemacht werden.
|
||||
* Evtl. bringt man es besser in new_region() unter, und
|
||||
* übergibt an new_region die plane mit, in der die
|
||||
* Region gemacht wird.
|
||||
*/
|
||||
|
||||
for (r=regions;r;r=r->next) if(r->planep == NULL) {
|
||||
region *ra = tpregion(r);
|
||||
if (!ra) {
|
||||
ra = new_region(TE_CENTER_X+real2tp(r->x), TE_CENTER_Y+real2tp(r->y));
|
||||
rsetterrain(ra, T_ASTRAL);
|
||||
}
|
||||
ra->planep = getplanebyid(1);
|
||||
if (terrain[rterrain(r)].flags & FORBIDDEN_LAND) rsetterrain(ra, T_ASTRALB);
|
||||
}
|
||||
|
||||
for(i=0;i<4;i++) {
|
||||
random_in_teleport_plane();
|
||||
}
|
||||
for(i=0;i<4;i++) {
|
||||
random_in_teleport_plane();
|
||||
}
|
||||
}
|
||||
|
||||
region_list *
|
||||
allinhab_in_range(const region *r, int n)
|
||||
boolean
|
||||
inhabitable(const region * r)
|
||||
{
|
||||
int x,y;
|
||||
region_list *rlist = NULL;
|
||||
region *r2;
|
||||
|
||||
if(r == NULL) return NULL; /* Um Probleme abzufangen,
|
||||
wenn zu einer Astralregion
|
||||
noch kein Realitätsregion existiert.
|
||||
Nicht gut, aber nicht zu ändern. */
|
||||
|
||||
for(x = r->x-n; x <= r->x+n; x++) {
|
||||
for(y = r->y-n; y <= r->y+n; y++) {
|
||||
if(koor_distance(r->x, r->y, x, y) <= n) {
|
||||
r2 = findregion(x,y);
|
||||
if (r2 && landregion(rterrain(r2)))
|
||||
add_regionlist(&rlist, findregion(x,y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rlist;
|
||||
return landregion(rterrain(r));
|
||||
}
|
||||
|
|
|
@ -18,21 +18,15 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define TE_CENTER_X 1000
|
||||
#define TE_CENTER_Y 1000
|
||||
#define ENNOS_PLANE 1
|
||||
#if ENNOS_PLANE
|
||||
#define TP_RADIUS 4
|
||||
#else
|
||||
#define RADIUS 75
|
||||
#define TP_RADIUS 2
|
||||
#endif
|
||||
struct region *r_standard_to_astral(const struct region *r);
|
||||
struct region *r_astral_to_standard(const struct region *);
|
||||
struct region_list *all_in_range(struct region *r, int n);
|
||||
struct region_list *allinhab_in_range(const struct region *r, int n);
|
||||
void create_teleport_plane(void);
|
||||
void set_teleport_plane_regiontypes(void);
|
||||
struct region *r_standard_to_astral(const struct region *r);
|
||||
struct region *r_astral_to_standard(const struct region *);
|
||||
extern struct region_list *astralregions(const struct region * r, boolean (*valid)(const struct region *));
|
||||
extern struct region_list *all_in_range(const struct region *r, int n, boolean (*valid)(const struct region *));
|
||||
extern boolean inhabitable(const struct region * r);
|
||||
extern struct plane * get_astralplane(void);
|
||||
|
||||
void create_teleport_plane(void);
|
||||
void set_teleport_plane_regiontypes(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue