forked from github/server
order leak in recruit_dracoids, do not build a study order
This commit is contained in:
parent
36809d1f9a
commit
ff2f83c371
|
@ -9,7 +9,7 @@
|
||||||
* based on:
|
* based on:
|
||||||
*
|
*
|
||||||
* Atlantis v1.0 13 September 1993 Copyright 1993 by Russell Wallace
|
* Atlantis v1.0 13 September 1993 Copyright 1993 by Russell Wallace
|
||||||
* Atlantis v1.7 Copyright 1996 by Alex Schröder
|
* Atlantis v1.7 Copyright 1996 by Alex Schr<EFBFBD>der
|
||||||
*
|
*
|
||||||
* This program may not be used, modified or distributed without
|
* This program may not be used, modified or distributed without
|
||||||
* prior permission by the authors of Eressea.
|
* prior permission by the authors of Eressea.
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#define DRAGON_RANGE 20 /* max. Distanz zum nächsten Drachenziel */
|
#define DRAGON_RANGE 20 /* max. Distanz zum n<EFBFBD>chsten Drachenziel */
|
||||||
#define MOVE_PERCENT 25 /* chance fuer bewegung */
|
#define MOVE_PERCENT 25 /* chance fuer bewegung */
|
||||||
#define MAXILLUSION_TEXTS 3
|
#define MAXILLUSION_TEXTS 3
|
||||||
|
|
||||||
|
@ -359,11 +359,11 @@ static direction_t random_neighbour(region * r, unit * u)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Zufällig eine auswählen */
|
/* Zuf<EFBFBD>llig eine ausw<73>hlen */
|
||||||
|
|
||||||
rr = rng_int() % c;
|
rr = rng_int() % c;
|
||||||
|
|
||||||
/* Durchzählen */
|
/* Durchz<EFBFBD>hlen */
|
||||||
|
|
||||||
c = 0;
|
c = 0;
|
||||||
for (i = 0; i != MAXDIRECTIONS; i++) {
|
for (i = 0; i != MAXDIRECTIONS; i++) {
|
||||||
|
@ -400,11 +400,11 @@ static direction_t treeman_neighbour(region * r)
|
||||||
if (c == 0) {
|
if (c == 0) {
|
||||||
return NODIRECTION;
|
return NODIRECTION;
|
||||||
}
|
}
|
||||||
/* Zufällig eine auswählen */
|
/* Zuf<EFBFBD>llig eine ausw<73>hlen */
|
||||||
|
|
||||||
rr = rng_int() % c;
|
rr = rng_int() % c;
|
||||||
|
|
||||||
/* Durchzählen */
|
/* Durchz<EFBFBD>hlen */
|
||||||
|
|
||||||
c = -1;
|
c = -1;
|
||||||
for (i = 0; i != MAXDIRECTIONS; i++) {
|
for (i = 0; i != MAXDIRECTIONS; i++) {
|
||||||
|
@ -559,7 +559,7 @@ static order *monster_learn(unit * u)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Monster lernt ein zufälliges Talent aus allen, in denen es schon
|
/* Monster lernt ein zuf<EFBFBD>lliges Talent aus allen, in denen es schon
|
||||||
* Lerntage hat. */
|
* Lerntage hat. */
|
||||||
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||||
if (sv->level > 0)
|
if (sv->level > 0)
|
||||||
|
@ -605,7 +605,6 @@ static void recruit_dracoids(unit * dragon, int size)
|
||||||
faction *f = dragon->faction;
|
faction *f = dragon->faction;
|
||||||
region *r = dragon->region;
|
region *r = dragon->region;
|
||||||
const struct item *weapon = NULL;
|
const struct item *weapon = NULL;
|
||||||
order *new_order = NULL;
|
|
||||||
unit *un = create_unit(r, f, size, get_race(RC_DRACOID), 0, NULL, NULL);
|
unit *un = create_unit(r, f, size, get_race(RC_DRACOID), 0, NULL, NULL);
|
||||||
|
|
||||||
fset(un, UFL_ISNEW | UFL_MOVED);
|
fset(un, UFL_ISNEW | UFL_MOVED);
|
||||||
|
@ -617,15 +616,10 @@ static void recruit_dracoids(unit * dragon, int size)
|
||||||
setstatus(un, ST_FIGHT);
|
setstatus(un, ST_FIGHT);
|
||||||
for (weapon = un->items; weapon; weapon = weapon->next) {
|
for (weapon = un->items; weapon; weapon = weapon->next) {
|
||||||
const weapon_type *wtype = weapon->type->rtype->wtype;
|
const weapon_type *wtype = weapon->type->rtype->wtype;
|
||||||
if (wtype && (wtype->flags & WTF_MISSILE)) {
|
if (wtype && wtype->flags & WTF_MISSILE) {
|
||||||
setstatus(un, ST_BEHIND);
|
setstatus(un, ST_BEHIND);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
new_order = create_order(K_STUDY, f->locale, "'%s'",
|
|
||||||
skillname(weapon->type->rtype->wtype->skill, f->locale));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_order != NULL) {
|
|
||||||
addlist(&un->orders, new_order);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,7 +647,7 @@ static order *plan_dragon(unit * u)
|
||||||
if (rc == rc_wyrm && !move) {
|
if (rc == rc_wyrm && !move) {
|
||||||
unit *u2;
|
unit *u2;
|
||||||
for (u2 = r->units; u2; u2 = u2->next) {
|
for (u2 = r->units; u2; u2 = u2->next) {
|
||||||
/* wyrme sind einzelgänger */
|
/* wyrme sind einzelg<EFBFBD>nger */
|
||||||
if (u2 == u) {
|
if (u2 == u) {
|
||||||
/* we do not make room for newcomers, so we don't need to look at them */
|
/* we do not make room for newcomers, so we don't need to look at them */
|
||||||
break;
|
break;
|
||||||
|
@ -750,11 +744,11 @@ void plan_monsters(faction * f)
|
||||||
attrib *ta;
|
attrib *ta;
|
||||||
order *long_order = NULL;
|
order *long_order = NULL;
|
||||||
|
|
||||||
/* Ab hier nur noch Befehle für NPC-Einheiten. */
|
/* Ab hier nur noch Befehle f<EFBFBD>r NPC-Einheiten. */
|
||||||
if (u->faction!=f)
|
if (u->faction!=f)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Befehle müssen jede Runde neu gegeben werden: */
|
/* Befehle m<EFBFBD>ssen jede Runde neu gegeben werden: */
|
||||||
free_orders(&u->orders);
|
free_orders(&u->orders);
|
||||||
if (skill_enabled(SK_PERCEPTION)) {
|
if (skill_enabled(SK_PERCEPTION)) {
|
||||||
/* Monster bekommen jede Runde ein paar Tage Wahrnehmung dazu */
|
/* Monster bekommen jede Runde ein paar Tage Wahrnehmung dazu */
|
||||||
|
@ -823,7 +817,7 @@ void plan_monsters(faction * f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (long_order == NULL && unit_can_study(u)) {
|
if (long_order == NULL && unit_can_study(u)) {
|
||||||
/* Einheiten, die Waffenlosen Kampf lernen könnten, lernen es um
|
/* Einheiten, die Waffenlosen Kampf lernen k<EFBFBD>nnten, lernen es um
|
||||||
* zu bewachen: */
|
* zu bewachen: */
|
||||||
if (rc->bonus[SK_WEAPONLESS] != -99) {
|
if (rc->bonus[SK_WEAPONLESS] != -99) {
|
||||||
if (effskill(u, SK_WEAPONLESS, 0) < 1) {
|
if (effskill(u, SK_WEAPONLESS, 0) < 1) {
|
||||||
|
@ -868,7 +862,7 @@ unit *spawn_seaserpent(region *r, faction *f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Drachen und Seeschlangen können entstehen
|
* Drachen und Seeschlangen k<EFBFBD>nnen entstehen
|
||||||
*/
|
*/
|
||||||
void spawn_dragons(void)
|
void spawn_dragons(void)
|
||||||
{
|
{
|
||||||
|
@ -917,7 +911,7 @@ void spawn_dragons(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Untote können entstehen */
|
/** Untote k<EFBFBD>nnen entstehen */
|
||||||
void spawn_undead(void)
|
void spawn_undead(void)
|
||||||
{
|
{
|
||||||
region *r;
|
region *r;
|
||||||
|
@ -937,7 +931,7 @@ void spawn_undead(void)
|
||||||
message *msg;
|
message *msg;
|
||||||
unit *u;
|
unit *u;
|
||||||
/* es ist sinnfrei, wenn irgendwo im Wald 3er-Einheiten Untote entstehen.
|
/* es ist sinnfrei, wenn irgendwo im Wald 3er-Einheiten Untote entstehen.
|
||||||
* Lieber sammeln lassen, bis sie mindestens 5% der Bevölkerung sind, und
|
* Lieber sammeln lassen, bis sie mindestens 5% der Bev<EFBFBD>lkerung sind, und
|
||||||
* dann erst auferstehen. */
|
* dann erst auferstehen. */
|
||||||
int undead = unburied / (rng_int() % 2 + 1);
|
int undead = unburied / (rng_int() % 2 + 1);
|
||||||
const race *rc = NULL;
|
const race *rc = NULL;
|
||||||
|
@ -995,7 +989,7 @@ void spawn_undead(void)
|
||||||
else {
|
else {
|
||||||
int i = deathcount(r);
|
int i = deathcount(r);
|
||||||
if (i) {
|
if (i) {
|
||||||
/* Gräber verwittern, 3% der Untoten finden die ewige Ruhe */
|
/* Gr<EFBFBD>ber verwittern, 3% der Untoten finden die ewige Ruhe */
|
||||||
deathcounts(r, (int)(-i * 0.03));
|
deathcounts(r, (int)(-i * 0.03));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue