forked from github/server
- prevent enslaved units from FORGET
- prevent promotion of foreign races - prevent charming of units with limited skills also: - rename teure_talente to has_limited_skills - move frame_regions to autoseed.c - some output for korrektur.c
This commit is contained in:
parent
76497abc92
commit
474431fb0d
9 changed files with 83 additions and 59 deletions
|
@ -843,18 +843,23 @@ give_cmd(unit * u, order * ord)
|
|||
static int
|
||||
forget_cmd(unit * u, order * ord)
|
||||
{
|
||||
skill_t sk;
|
||||
const char *s;
|
||||
|
||||
skill_t sk;
|
||||
const char *s;
|
||||
|
||||
if (is_cursed(u->attribs, C_SLAVE, 0)) {
|
||||
/* charmed units shouldn't be losing their skills */
|
||||
return 0;
|
||||
}
|
||||
|
||||
init_tokens(ord);
|
||||
skip_token();
|
||||
s = getstrtoken();
|
||||
|
||||
if ((sk = findskill(s, u->faction->locale)) != NOSKILL) {
|
||||
ADDMSG(&u->faction->msgs,
|
||||
msg_message("forget", "unit skill", u, sk));
|
||||
set_level(u, sk, 0);
|
||||
}
|
||||
if ((sk = findskill(s, u->faction->locale)) != NOSKILL) {
|
||||
ADDMSG(&u->faction->msgs,
|
||||
msg_message("forget", "unit skill", u, sk));
|
||||
set_level(u, sk, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ give_men(int n, unit * u, unit * u2, struct order * ord)
|
|||
} else if (count_migrants(u2->faction) + n > count_maxmigrants(u2->faction)) {
|
||||
error = 128;
|
||||
}
|
||||
else if (teure_talente(u) || teure_talente(u2)) {
|
||||
else if (has_limited_skills(u) || has_limited_skills(u2)) {
|
||||
error = 154;
|
||||
} else if (u2->number!=0) {
|
||||
error = 139;
|
||||
|
@ -363,7 +363,7 @@ give_unit(unit * u, unit * u2, order * ord)
|
|||
cmistake(u, ord, 128, MSG_COMMERCE);
|
||||
return;
|
||||
}
|
||||
if (teure_talente(u)) {
|
||||
if (has_limited_skills(u)) {
|
||||
cmistake(u, ord, 154, MSG_COMMERCE);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2242,7 +2242,7 @@ promotion_cmd(unit * u, struct order * ord)
|
|||
maxheroes(u->faction), countheroes(u->faction)));
|
||||
return 0;
|
||||
}
|
||||
if (!playerrace(u->race)) {
|
||||
if (u->race!=u->faction->race) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "heroes_race", "race",
|
||||
u->race));
|
||||
return 0;
|
||||
|
|
|
@ -2886,7 +2886,7 @@ lovar(double xpct_x2)
|
|||
}
|
||||
|
||||
boolean
|
||||
teure_talente (const struct unit * u)
|
||||
has_limited_skills (const struct unit * u)
|
||||
{
|
||||
if (has_skill(u, SK_MAGIC) || has_skill(u, SK_ALCHEMY) ||
|
||||
has_skill(u, SK_TACTICS) || has_skill(u, SK_HERBALISM) ||
|
||||
|
|
|
@ -250,7 +250,7 @@ extern int count_all(const struct faction * f);
|
|||
extern int count_migrants (const struct faction * f);
|
||||
extern int count_maxmigrants(const struct faction * f);
|
||||
|
||||
extern boolean teure_talente(const struct unit * u);
|
||||
extern boolean has_limited_skills(const struct unit * u);
|
||||
extern const struct race * findrace(const char *, const struct locale *);
|
||||
|
||||
int eff_stealth(const struct unit * u, const struct region * r);
|
||||
|
|
|
@ -505,6 +505,27 @@ free_newfaction(newfaction * nf)
|
|||
/** create new island with up to nsize players
|
||||
* returns the number of players placed on the new island.
|
||||
*/
|
||||
static void
|
||||
frame_regions(int age, terrain_t terrain)
|
||||
{
|
||||
region * r = regions;
|
||||
for (r=regions;r;r=r->next) {
|
||||
direction_t d;
|
||||
if (r->age<age) continue;
|
||||
if (r->planep) continue;
|
||||
if (rterrain(r)==terrain) continue;
|
||||
|
||||
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], 0);
|
||||
terraform(rn, terrain);
|
||||
rn->age=r->age;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
autoseed(newfaction ** players, int nsize, boolean new_island)
|
||||
{
|
||||
|
@ -516,6 +537,8 @@ autoseed(newfaction ** players, int nsize, boolean new_island)
|
|||
int psize = 0; /* players on this island */
|
||||
const terrain_type * volcano_terrain = get_terrain("volcano");
|
||||
|
||||
frame_regions(16, T_FIREWALL);
|
||||
|
||||
if (listlen(*players)<MINFACTIONS) return 0;
|
||||
|
||||
if (!new_island) {
|
||||
|
|
|
@ -77,7 +77,7 @@ wormhole_age(struct attrib * a)
|
|||
for (;u!=NULL && maxtransport!=0;u=u->next) {
|
||||
if (u->building==data->entry) {
|
||||
message * m = NULL;
|
||||
if (u->number>maxtransport || teure_talente(u)) {
|
||||
if (u->number>maxtransport || has_limited_skills(u)) {
|
||||
m = msg_message("wormhole_requirements", "unit region", u, u->region);
|
||||
} else if (data->exit!=NULL) {
|
||||
move_unit(u, data->exit->region, NULL);
|
||||
|
|
|
@ -3845,6 +3845,12 @@ sp_charmingsong(castorder *co)
|
|||
/* Die Einheit ist eine der unsrigen */
|
||||
cmistake(mage, co->order, 45, MSG_MAGIC);
|
||||
}
|
||||
/* niemand mit teurem Talent */
|
||||
if (has_limited_skills(target)) {
|
||||
ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order,
|
||||
"spellfail_noexpensives", "target", target));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Magieresistensbonus für mehr als Stufe Personen */
|
||||
if (target->number > force) {
|
||||
|
@ -3884,7 +3890,7 @@ sp_charmingsong(castorder *co)
|
|||
create_curse(mage, &target->attribs, ct_find("slavery"), force, duration, zero_effect, 0);
|
||||
|
||||
/* setze Partei um und lösche langen Befehl aus Sicherheitsgründen */
|
||||
u_setfaction(target,mage->faction);
|
||||
u_setfaction(target, mage->faction);
|
||||
set_order(&target->thisorder, NULL);
|
||||
|
||||
/* setze Parteitarnung, damit nicht sofort klar ist, wer dahinter
|
||||
|
@ -4113,7 +4119,7 @@ sp_migranten(castorder *co)
|
|||
return 0;
|
||||
}
|
||||
/* niemand mit teurem Talent */
|
||||
if (teure_talente(target)) {
|
||||
if (has_limited_skills(target)) {
|
||||
ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order,
|
||||
"spellfail_noexpensives", "target", target));
|
||||
return 0;
|
||||
|
|
|
@ -281,6 +281,8 @@ static void
|
|||
fix_firewalls(void)
|
||||
{
|
||||
region * r = regions;
|
||||
int fixes = 0;
|
||||
|
||||
while (r) {
|
||||
direction_t d;
|
||||
for (d=0;d!=MAXDIRECTIONS;++d) {
|
||||
|
@ -295,6 +297,7 @@ fix_firewalls(void)
|
|||
log_warning(("firewall between regions %s and %s was bugged. removed.\n",
|
||||
regionname(r, NULL), regionname(r2, NULL)));
|
||||
b = get_borders(r, r2);
|
||||
++fixes;
|
||||
} else {
|
||||
b = b->next;
|
||||
}
|
||||
|
@ -306,6 +309,7 @@ fix_firewalls(void)
|
|||
}
|
||||
r = r->next;
|
||||
}
|
||||
log_printf("fixed %u firewalls.\n", fixes);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -472,6 +476,7 @@ static void
|
|||
fix_gates(void)
|
||||
{
|
||||
region * r;
|
||||
int fixes = 0;
|
||||
for (r=regions;r;r=r->next) {
|
||||
unit * u;
|
||||
building * b;
|
||||
|
@ -492,6 +497,7 @@ fix_gates(void)
|
|||
}
|
||||
remove_triggers(&u->attribs, "timer", &tt_gate);
|
||||
remove_triggers(&u->attribs, "create", &tt_unguard);
|
||||
++fixes;
|
||||
}
|
||||
}
|
||||
for (b=r->buildings;b;b=b->next) {
|
||||
|
@ -510,10 +516,12 @@ fix_gates(void)
|
|||
add_trigger(&bgate->attribs, "create", trigger_unguard(bgate));
|
||||
fset(bgate, BLD_UNGUARDED);
|
||||
}
|
||||
++fixes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log_printf("fixed %u gates.\n", fixes);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -562,48 +570,6 @@ road_decay(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
frame_regions(void)
|
||||
{
|
||||
#ifdef AGE_FIX
|
||||
unsigned short ocean_age = (unsigned short)turn;
|
||||
#endif
|
||||
region * r = regions;
|
||||
for (r=regions;r;r=r->next) {
|
||||
direction_t d;
|
||||
#ifdef AGE_FIX
|
||||
if (rterrain(r) == T_OCEAN && r->age==0) {
|
||||
unsigned short age = 0;
|
||||
direction_t d;
|
||||
for (d=0;d!=MAXDIRECTIONS;++d) {
|
||||
region * rn = rconnect(r, d);
|
||||
if (rn && rn->age>age) {
|
||||
age = rn->age;
|
||||
}
|
||||
}
|
||||
if (age!=0 && age < ocean_age) {
|
||||
ocean_age = age;
|
||||
}
|
||||
r->age = ocean_age;
|
||||
} else if (r->age>ocean_age) {
|
||||
ocean_age = r->age;
|
||||
}
|
||||
#endif
|
||||
if (r->age<16) continue;
|
||||
if (r->planep) continue;
|
||||
if (rterrain(r)==T_FIREWALL) continue;
|
||||
|
||||
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], 0);
|
||||
terraform(rn, T_FIREWALL);
|
||||
rn->age=r->age;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if GLOBAL_WARMING
|
||||
|
||||
static void
|
||||
|
@ -917,6 +883,7 @@ static void
|
|||
fix_toads(void)
|
||||
{
|
||||
region * r;
|
||||
int fixes = 0;
|
||||
const struct race * toad = rc_find("toad");
|
||||
|
||||
for (r=regions;r!=NULL;r=r->next) {
|
||||
|
@ -942,12 +909,35 @@ fix_toads(void)
|
|||
if (!found) {
|
||||
log_error(("fixed toad %s.\n", unitname(u)));
|
||||
u->race=u->faction->race;
|
||||
++fixes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log_printf("fixed %u toads.\n", fixes);
|
||||
}
|
||||
|
||||
#ifdef REMOVE_ILLEGAL_MIGRANT_HEROES
|
||||
static void
|
||||
fix_heroes(void)
|
||||
{
|
||||
region * r;
|
||||
int fixes = 0;
|
||||
|
||||
for (r=regions;r!=NULL;r=r->next) {
|
||||
unit * u;
|
||||
for (u=r->units; u; u=u->next) {
|
||||
if (u->race!=u->faction->race) {
|
||||
log_error(("fixed race for hero %s (%s).\n", unitname(u), u->race->_name[0]));
|
||||
u->race=u->faction->race;
|
||||
++fixes;
|
||||
}
|
||||
}
|
||||
}
|
||||
log_printf("fixed %u heroes.\n", fixes);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
fix_groups(void)
|
||||
{
|
||||
|
@ -995,7 +985,6 @@ korrektur(void)
|
|||
do_once("chgt", &fix_chaosgates);
|
||||
do_once("atrx", &fix_attribflags);
|
||||
do_once("asfi", &fix_astral_firewalls);
|
||||
frame_regions();
|
||||
#if GLOBAL_WARMING
|
||||
if (get_gamedate(turn, NULL)->season == SEASON_SUMMER) {
|
||||
global_warming();
|
||||
|
@ -1005,6 +994,7 @@ korrektur(void)
|
|||
fix_firewalls();
|
||||
fix_gates();
|
||||
fix_toads();
|
||||
/* fix_heroes(); */
|
||||
verify_owners(false);
|
||||
/* fix_herbtypes(); */
|
||||
/* In Vin 3+ können Parteien komplett übergeben werden. */
|
||||
|
|
Loading…
Reference in a new issue