forked from github/server
Rekrutieren und div. andere Dinge waren möglich, weil HELFE GIB ein automatisches KONTAKTIERE setzte. Ich habe den Code nach anderen Vorkommen aehnlicher Bugs untersucht und repariert.
This commit is contained in:
parent
55c8f01b86
commit
2079db13cf
|
@ -468,7 +468,7 @@ give_cmd(unit * u, order * ord)
|
||||||
cmistake(u, ord, 49, MSG_EVENT);
|
cmistake(u, ord, 49, MSG_EVENT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!ucontact(u2, u)) {
|
if (!alliedunit(u2, u->faction, HELP_GIVE) && !ucontact(u2, u)) {
|
||||||
cmistake(u, ord, 40, MSG_EVENT);
|
cmistake(u, ord, 40, MSG_EVENT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -551,7 +551,7 @@ give_cmd(unit * u, order * ord)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u2 && !ucontact(u2, u)) {
|
if (u2 && !alliedunit(u2, u->faction, HELP_GIVE) && !ucontact(u2, u)) {
|
||||||
cmistake(u, ord, 40, MSG_COMMERCE);
|
cmistake(u, ord, 40, MSG_COMMERCE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -561,7 +561,7 @@ give_cmd(unit * u, order * ord)
|
||||||
if (findparam(s, u->faction->locale) == P_ANY) { /* Alle Gegenstände übergeben */
|
if (findparam(s, u->faction->locale) == P_ANY) { /* Alle Gegenstände übergeben */
|
||||||
const char * s = getstrtoken();
|
const char * s = getstrtoken();
|
||||||
|
|
||||||
if(u2 && !ucontact(u2, u)) {
|
if (u2 && !alliedunit(u2, u->faction, HELP_GIVE) && !ucontact(u2, u)) {
|
||||||
cmistake(u, ord, 40, MSG_COMMERCE);
|
cmistake(u, ord, 40, MSG_COMMERCE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -635,7 +635,7 @@ give_cmd(unit * u, order * ord)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u2 && !ucontact(u2, u)) {
|
if (u2 && !alliedunit(u2, u->faction, HELP_GIVE) && !ucontact(u2, u)) {
|
||||||
const resource_type * rtype = findresourcetype(s, u->faction->locale);
|
const resource_type * rtype = findresourcetype(s, u->faction->locale);
|
||||||
if (rtype==NULL || !fval(rtype, RTF_SNEAK))
|
if (rtype==NULL || !fval(rtype, RTF_SNEAK))
|
||||||
{
|
{
|
||||||
|
|
|
@ -408,16 +408,6 @@ teach(unit * u, struct order * ord)
|
||||||
if (ualias(u2))
|
if (ualias(u2))
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
/* this is pointless, as there currently is no way to negativly influence
|
|
||||||
* a unit by teaching it. */
|
|
||||||
/*
|
|
||||||
if (!ucontact(u2, u)) {
|
|
||||||
sprintf(buf, "Einheit %s hat keinen Kontakt mit uns aufgenommen",
|
|
||||||
unitid(u2));
|
|
||||||
mistake(u, u->thisorder, buf, MSG_EVENT);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (get_keyword(u2->thisorder) != K_STUDY) {
|
if (get_keyword(u2->thisorder) != K_STUDY) {
|
||||||
add_message(&u->faction->msgs,
|
add_message(&u->faction->msgs,
|
||||||
msg_feedback(u, u->thisorder, "teach_nolearn", "student", u2));
|
msg_feedback(u, u->thisorder, "teach_nolearn", "student", u2));
|
||||||
|
|
|
@ -169,7 +169,8 @@ give_men(int n, unit * u, unit * u2, struct order * ord)
|
||||||
error = 74;
|
error = 74;
|
||||||
} else if (u2 && (fval(u2, UFL_LOCKED)|| is_cursed(u2->attribs, C_SLAVE, 0))) {
|
} else if (u2 && (fval(u2, UFL_LOCKED)|| is_cursed(u2->attribs, C_SLAVE, 0))) {
|
||||||
error = 75;
|
error = 75;
|
||||||
} else if (u2 && u2->faction != u->faction && ucontact(u2, u) == 0) {
|
} else if (u2 && u2->faction != u->faction && !alliedunit(u2, u->faction, HELP_GIVE) && !ucontact(u2, u)) {
|
||||||
|
|
||||||
error = 73;
|
error = 73;
|
||||||
} else if (u2 && (has_skill(u, SK_MAGIC) || has_skill(u2, SK_MAGIC))) {
|
} else if (u2 && (has_skill(u, SK_MAGIC) || has_skill(u2, SK_MAGIC))) {
|
||||||
error = 158;
|
error = 158;
|
||||||
|
@ -326,7 +327,7 @@ give_unit(unit * u, unit * u2, order * ord)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ucontact(u2, u) == 0) {
|
if (!alliedunit(u2, u->faction, HELP_GIVE) && ucontact(u2, u) == 0) {
|
||||||
cmistake(u, ord, 73, MSG_COMMERCE);
|
cmistake(u, ord, 73, MSG_COMMERCE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -820,16 +820,16 @@ bewegung_blockiert_von(unit * reisender, region * r)
|
||||||
static boolean
|
static boolean
|
||||||
is_guardian(unit * u2, unit *u, unsigned int mask)
|
is_guardian(unit * u2, unit *u, unsigned int mask)
|
||||||
{
|
{
|
||||||
if (u2->faction != u->faction
|
if (u2->faction == u->faction) return false;
|
||||||
&& getguard(u2)&mask
|
if ((getguard(u2) & mask) == 0) return false;
|
||||||
&& u2->number
|
if (u2->number==0) return false;
|
||||||
&& !ucontact(u2, u) && !besieged(u2)
|
if (alliedunit(u2, u->faction, HELP_GUARD)) return false;
|
||||||
&& alliedunit(u2, u->faction, HELP_GUARD) != HELP_GUARD
|
if (ucontact(u2, u)) return false;
|
||||||
&& armedmen(u2)
|
if (besieged(u2)) return false;
|
||||||
&& cansee(u2->faction, u->region, u, 0)
|
if (!armedmen(u2)) return false;
|
||||||
) return true;
|
if (!cansee(u2->faction, u->region, u, 0)) return false;
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
unit *
|
unit *
|
||||||
|
|
|
@ -1952,12 +1952,12 @@ sp_treewalkexit(castorder *co)
|
||||||
|
|
||||||
u = pa->param[n]->data.u;
|
u = pa->param[n]->data.u;
|
||||||
|
|
||||||
if(!ucontact(u, mage)) {
|
if (!ucontact(u, mage)) {
|
||||||
sprintf(buf, "%s hat uns nicht kontaktiert.", unitname(u));
|
sprintf(buf, "%s hat uns nicht kontaktiert.", unitname(u));
|
||||||
addmessage(r, mage->faction, buf, MSG_MAGIC, ML_MISTAKE);
|
addmessage(r, mage->faction, buf, MSG_MAGIC, ML_MISTAKE);
|
||||||
} else {
|
} else {
|
||||||
int w = weight(u);
|
int w = weight(u);
|
||||||
if(!can_survive(u, rt)) {
|
if (!can_survive(u, rt)) {
|
||||||
cmistake(mage, co->order, 231, MSG_MAGIC);
|
cmistake(mage, co->order, 231, MSG_MAGIC);
|
||||||
} else if(remaining_cap - w < 0) {
|
} else if(remaining_cap - w < 0) {
|
||||||
sprintf(buf, "%s ist zu schwer.", unitname(u));
|
sprintf(buf, "%s ist zu schwer.", unitname(u));
|
||||||
|
@ -5837,8 +5837,8 @@ sp_enterastral(castorder *co)
|
||||||
if(pa->param[n]->flag == TARGET_NOTFOUND) continue;
|
if(pa->param[n]->flag == TARGET_NOTFOUND) continue;
|
||||||
u = pa->param[n]->data.u;
|
u = pa->param[n]->data.u;
|
||||||
|
|
||||||
if(!ucontact(u, mage)) {
|
if (!ucontact(u, mage)) {
|
||||||
if(power > 10 && !is_magic_resistant(mage, u, 0)
|
if (power > 10 && !is_magic_resistant(mage, u, 0)
|
||||||
&& can_survive(u, rt)) {
|
&& can_survive(u, rt)) {
|
||||||
sprintf(buf, "%s hat uns nicht kontaktiert, widersteht dem "
|
sprintf(buf, "%s hat uns nicht kontaktiert, widersteht dem "
|
||||||
"Zauber jedoch nicht.", unitname(u));
|
"Zauber jedoch nicht.", unitname(u));
|
||||||
|
@ -5964,7 +5964,7 @@ sp_pullastral(castorder *co)
|
||||||
|
|
||||||
u = pa->param[n]->data.u;
|
u = pa->param[n]->data.u;
|
||||||
|
|
||||||
if(!ucontact(u, mage)) {
|
if (!ucontact(u, mage)) {
|
||||||
if(power > 12 && pa->param[n]->flag == TARGET_RESISTS && can_survive(u, rt)) {
|
if(power > 12 && pa->param[n]->flag == TARGET_RESISTS && can_survive(u, rt)) {
|
||||||
sprintf(buf, "%s hat uns nicht kontaktiert, widersteht dem "
|
sprintf(buf, "%s hat uns nicht kontaktiert, widersteht dem "
|
||||||
"Zauber jedoch nicht.", unitname(u));
|
"Zauber jedoch nicht.", unitname(u));
|
||||||
|
@ -6084,8 +6084,8 @@ sp_leaveastral(castorder *co)
|
||||||
|
|
||||||
u = pa->param[n]->data.u;
|
u = pa->param[n]->data.u;
|
||||||
|
|
||||||
if(!ucontact(u, mage)) {
|
if (!ucontact(u, mage)) {
|
||||||
if(power > 10 && !pa->param[n]->flag == TARGET_RESISTS && can_survive(u, rt)) {
|
if (power > 10 && !pa->param[n]->flag == TARGET_RESISTS && can_survive(u, rt)) {
|
||||||
sprintf(buf, "%s hat uns nicht kontaktiert, widersteht dem "
|
sprintf(buf, "%s hat uns nicht kontaktiert, widersteht dem "
|
||||||
"Zauber jedoch nicht.", unitname(u));
|
"Zauber jedoch nicht.", unitname(u));
|
||||||
addmessage(r, mage->faction, buf, MSG_MAGIC, ML_INFO);
|
addmessage(r, mage->faction, buf, MSG_MAGIC, ML_INFO);
|
||||||
|
|
|
@ -424,10 +424,6 @@ ucontact(const unit * u, const unit * u2)
|
||||||
{
|
{
|
||||||
attrib *ru;
|
attrib *ru;
|
||||||
|
|
||||||
/* Alliierte kontaktieren immer */
|
|
||||||
if (alliedunit(u, u2->faction, HELP_GIVE) == HELP_GIVE)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
/* Explizites KONTAKTIERE */
|
/* Explizites KONTAKTIERE */
|
||||||
for (ru = a_find(u->attribs, &at_contact); ru; ru = ru->nexttype)
|
for (ru = a_find(u->attribs, &at_contact); ru; ru = ru->nexttype)
|
||||||
if (((unit*)ru->data.v) == u2)
|
if (((unit*)ru->data.v) == u2)
|
||||||
|
|
Loading…
Reference in New Issue