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))
|
if (sd->mode==see_unit && r->planep && r->planep->id == 1 && !is_cursed(r->attribs, C_ASTRALBLOCK, 0))
|
||||||
{
|
{
|
||||||
/* Sonderbehandlung Teleport-Ebene */
|
/* 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) {
|
if (rl) {
|
||||||
region_list *rl2 = 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 &&
|
if (partial==0 && r->planep && r->planep->id == 1 &&
|
||||||
!is_cursed(r->attribs, C_ASTRALBLOCK, 0)) {
|
!is_cursed(r->attribs, C_ASTRALBLOCK, 0)) {
|
||||||
/* Sonderbehandlung Teleport-Ebene */
|
/* 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;
|
region_list *rl2;
|
||||||
|
|
||||||
if (rl) {
|
if (rl) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ const int FIREWORK_RANGE=10;
|
||||||
static int
|
static int
|
||||||
use_birthday_firework(struct unit * u, const struct item_type * itype, int amount, const char *cm)
|
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;
|
region_list *rl;
|
||||||
message *m;
|
message *m;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "spell.h"
|
#include "spell.h"
|
||||||
#include "ship.h"
|
#include "ship.h"
|
||||||
#include "skill.h"
|
#include "skill.h"
|
||||||
|
#include "teleport.h"
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
|
|
||||||
/* util includes */
|
/* 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.
|
/* Im Astralraum sind Tyb und Ill-Magier doppelt so schnell.
|
||||||
* Nicht kumulativ mit anderen Beschleunigungen! */
|
* 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
|
if(get_mage(u)->magietyp == M_ASTRAL
|
||||||
|| get_mage(u)->magietyp == M_TRAUM) {
|
|| get_mage(u)->magietyp == M_TRAUM) {
|
||||||
mp *= 2;
|
mp *= 2;
|
||||||
|
|
|
@ -1916,7 +1916,7 @@ sp_treewalkexit(castorder *co)
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
|
|
||||||
if(getplane(r) != astral_plane) {
|
if(getplane(r) != get_astralplane()) {
|
||||||
cmistake(mage, strdup(co->order), 193, MSG_MAGIC);
|
cmistake(mage, strdup(co->order), 193, MSG_MAGIC);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1939,7 +1939,7 @@ sp_treewalkexit(castorder *co)
|
||||||
tay = rt->y;
|
tay = rt->y;
|
||||||
rt = NULL;
|
rt = NULL;
|
||||||
|
|
||||||
rl = allinhab_in_range(r_astral_to_standard(r),TP_RADIUS);
|
rl = astralregions(r_astral_to_standard(r), inhabitable);
|
||||||
rt = 0;
|
rt = 0;
|
||||||
|
|
||||||
rl2 = rl;
|
rl2 = rl;
|
||||||
|
@ -2232,7 +2232,7 @@ sp_fog_of_confusion(castorder *co)
|
||||||
range = (power-11)/3-1;
|
range = (power-11)/3-1;
|
||||||
duration = (int)((power-11)/1.5)+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) {
|
for(rl2 = rl; rl2; rl2 = rl2->next) {
|
||||||
curse * c;
|
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(rl2 = rl; rl2; rl2 = rl2->next) {
|
||||||
for(u = rl2->data->units; u; u = u->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;
|
double range = (power-14)/2-1;
|
||||||
int duration = (int)(power-14)+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) {
|
for(rl2 = rl; rl2; rl2 = rl2->next) {
|
||||||
region * r2 = rl2->data;
|
region * r2 = rl2->data;
|
||||||
|
@ -5934,7 +5934,7 @@ sp_pullastral(castorder *co)
|
||||||
case 1:
|
case 1:
|
||||||
rt = r;
|
rt = r;
|
||||||
ro = pa->param[0]->data.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;
|
rl2 = rl;
|
||||||
while (rl2!=NULL) {
|
while (rl2!=NULL) {
|
||||||
region * r2 = rl2->data;
|
region * r2 = rl2->data;
|
||||||
|
@ -6066,7 +6066,7 @@ sp_leaveastral(castorder *co)
|
||||||
MSG_MAGIC, ML_MISTAKE);
|
MSG_MAGIC, ML_MISTAKE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
rl = allinhab_in_range(r_astral_to_standard(r), TP_RADIUS);
|
rl = astralregions(r_astral_to_standard(r), inhabitable);
|
||||||
rl2 = rl;
|
rl2 = rl;
|
||||||
while (rl2!=NULL) {
|
while (rl2!=NULL) {
|
||||||
if (rl2->data == rt) break;
|
if (rl2->data == rt) break;
|
||||||
|
@ -6391,7 +6391,7 @@ sp_viewreality(castorder *co)
|
||||||
return 0;
|
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. */
|
/* Irgendwann mal auf Curses u/o Attribut umstellen. */
|
||||||
for (rl2=rl; rl2; rl2=rl2->next) {
|
for (rl2=rl; rl2; rl2=rl2->next) {
|
||||||
|
@ -6440,7 +6440,7 @@ sp_disruptastral(castorder *co)
|
||||||
return 0;
|
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) {
|
for (rl2=rl; rl2!=NULL; rl2=rl2->next) {
|
||||||
attrib *a, *a2;
|
attrib *a, *a2;
|
||||||
|
@ -6454,7 +6454,7 @@ sp_disruptastral(castorder *co)
|
||||||
if (r2->units!=NULL) {
|
if (r2->units!=NULL) {
|
||||||
region_list * trl2;
|
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;
|
for (trl2 = trl; trl2; trl2 = trl2->next) ++inhab_regions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,10 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define TE_CENTER_X 1000
|
||||||
|
#define TE_CENTER_Y 1000
|
||||||
|
#define TP_RADIUS 4
|
||||||
|
|
||||||
static int
|
static int
|
||||||
real2tp(int rk) {
|
real2tp(int rk) {
|
||||||
/* in C:
|
/* in C:
|
||||||
|
@ -50,23 +54,42 @@ 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 *
|
region *
|
||||||
r_standard_to_astral(const region *r)
|
r_standard_to_astral(const region *r)
|
||||||
{
|
{
|
||||||
region *r2;
|
region *r2;
|
||||||
#if 0
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
x = TE_CENTER_X + (r->x/TP_RADIUS);
|
|
||||||
y = TE_CENTER_Y + (r->y/TP_RADIUS);
|
|
||||||
|
|
||||||
r2 = findregion(x,y);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
r2 = tpregion(r);
|
r2 = tpregion(r);
|
||||||
|
|
||||||
if(getplaneid(r2) != 1 || rterrain(r2) != T_ASTRAL)
|
if (rplane(r2) != get_astralplane() || rterrain(r2) != T_ASTRAL) return NULL;
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return r2;
|
return r2;
|
||||||
}
|
}
|
||||||
|
@ -77,34 +100,29 @@ r_astral_to_standard(const region *r)
|
||||||
int x, y;
|
int x, y;
|
||||||
region *r2;
|
region *r2;
|
||||||
|
|
||||||
assert(getplaneid(r) == 1);
|
assert(rplane(r) == get_astralplane());
|
||||||
x = (r->x-TE_CENTER_X)*TP_RADIUS;
|
x = (r->x-TE_CENTER_X)*TP_RADIUS;
|
||||||
y = (r->y-TE_CENTER_Y)*TP_RADIUS;
|
y = (r->y-TE_CENTER_Y)*TP_RADIUS;
|
||||||
|
|
||||||
r2 = findregion(x,y);
|
r2 = findregion(x,y);
|
||||||
if(!r2 || getplaneid(r2) != 0)
|
if (r2!=NULL || getplaneid(r2) != 0) return NULL;
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return r2;
|
return r2;
|
||||||
}
|
}
|
||||||
|
|
||||||
region_list *
|
region_list *
|
||||||
all_in_range(region *r, int n)
|
all_in_range(const region *r, int n, boolean (*valid)(const region *))
|
||||||
{
|
{
|
||||||
int x,y;
|
int x,y;
|
||||||
region_list *rlist = NULL;
|
region_list *rlist = NULL;
|
||||||
region *r2;
|
|
||||||
|
|
||||||
if(r == NULL) return NULL; /* Um Probleme abzufangen,
|
if (r == NULL) return NULL;
|
||||||
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 (x = r->x-n; x <= r->x+n; x++) {
|
||||||
for (y = r->y-n; y <= r->y+n; y++) {
|
for (y = r->y-n; y <= r->y+n; y++) {
|
||||||
if (koor_distance(r->x, r->y, x, y) <= n) {
|
if (koor_distance(r->x, r->y, x, y) <= n) {
|
||||||
r2 = findregion(x,y);
|
region * r2 = findregion(x,y);
|
||||||
if(r2) add_regionlist(&rlist, findregion(x,y));
|
if (r2!=NULL && (valid==NULL || valid(r2))) add_regionlist(&rlist, r2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,45 +134,48 @@ void
|
||||||
random_in_teleport_plane(void)
|
random_in_teleport_plane(void)
|
||||||
{
|
{
|
||||||
region *r;
|
region *r;
|
||||||
unit *u;
|
|
||||||
faction *f0 = findfaction(MONSTER_FACTION);
|
faction *f0 = findfaction(MONSTER_FACTION);
|
||||||
|
int next = rand() % 100;
|
||||||
|
|
||||||
if(!f0) return;
|
if (f0==NULL) return;
|
||||||
|
|
||||||
for (r=regions; r; r=r->next) {
|
for (r=regions; r; r=r->next) {
|
||||||
if(getplaneid(r) != 1 || rterrain(r) != T_ASTRAL) continue;
|
if (rplane(r) != get_astralplane() || rterrain(r) != T_ASTRAL) continue;
|
||||||
|
|
||||||
/* Neues Monster ? */
|
/* Neues Monster ? */
|
||||||
if(rand()%100 == 0) {
|
if (next-- == 0) {
|
||||||
switch(rand()%1) {
|
unit *u = createunit(r, f0, 1+rand()%10+rand()%10, new_race[RC_HIRNTOETER]);
|
||||||
case 0:
|
|
||||||
u = createunit(r, f0, 1+rand()%10+rand()%10, new_race[RC_HIRNTOETER]);
|
|
||||||
set_string(&u->name, "Hirntöter");
|
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_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_STEALTH, 1);
|
||||||
set_level(u, SK_OBSERVATION, 1);
|
set_level(u, SK_OBSERVATION, 1);
|
||||||
break;
|
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
|
void
|
||||||
create_teleport_plane(void)
|
create_teleport_plane(void)
|
||||||
{
|
{
|
||||||
region *r;
|
region *r;
|
||||||
int i;
|
int i;
|
||||||
|
plane * aplane = get_astralplane();
|
||||||
astral_plane = getplanebyid(1);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Regionsbereich aufbauen. */
|
/* Regionsbereich aufbauen. */
|
||||||
/* wichtig: das muß auch für neue regionen gemacht werden.
|
/* wichtig: das muß auch für neue regionen gemacht werden.
|
||||||
|
@ -165,11 +186,11 @@ create_teleport_plane(void)
|
||||||
|
|
||||||
for (r=regions;r;r=r->next) if(r->planep == NULL) {
|
for (r=regions;r;r=r->next) if(r->planep == NULL) {
|
||||||
region *ra = tpregion(r);
|
region *ra = tpregion(r);
|
||||||
if (!ra) {
|
if (ra==NULL) {
|
||||||
ra = new_region(TE_CENTER_X+real2tp(r->x), TE_CENTER_Y+real2tp(r->y));
|
ra = new_region(TE_CENTER_X+real2tp(r->x), TE_CENTER_Y+real2tp(r->y));
|
||||||
rsetterrain(ra, T_ASTRAL);
|
rsetterrain(ra, T_ASTRAL);
|
||||||
}
|
}
|
||||||
ra->planep = getplanebyid(1);
|
ra->planep = aplane;
|
||||||
if (terrain[rterrain(r)].flags & FORBIDDEN_LAND) rsetterrain(ra, T_ASTRALB);
|
if (terrain[rterrain(r)].flags & FORBIDDEN_LAND) rsetterrain(ra, T_ASTRALB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,27 +199,8 @@ create_teleport_plane(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
region_list *
|
boolean
|
||||||
allinhab_in_range(const region *r, int n)
|
inhabitable(const region * r)
|
||||||
{
|
{
|
||||||
int x,y;
|
return landregion(rterrain(r));
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,19 +18,13 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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_standard_to_astral(const struct region *r);
|
||||||
struct region *r_astral_to_standard(const struct region *);
|
struct region *r_astral_to_standard(const struct region *);
|
||||||
struct region_list *all_in_range(struct region *r, int n);
|
extern struct region_list *astralregions(const struct region * r, boolean (*valid)(const struct region *));
|
||||||
struct region_list *allinhab_in_range(const struct region *r, int n);
|
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 create_teleport_plane(void);
|
||||||
void set_teleport_plane_regiontypes(void);
|
void set_teleport_plane_regiontypes(void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue