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);
|
||||
return;
|
||||
}
|
||||
if (!ucontact(u2, u)) {
|
||||
if (!alliedunit(u2, u->faction, HELP_GIVE) && !ucontact(u2, u)) {
|
||||
cmistake(u, ord, 40, MSG_EVENT);
|
||||
return;
|
||||
}
|
||||
|
@ -551,7 +551,7 @@ give_cmd(unit * u, order * ord)
|
|||
return;
|
||||
}
|
||||
|
||||
if (u2 && !ucontact(u2, u)) {
|
||||
if (u2 && !alliedunit(u2, u->faction, HELP_GIVE) && !ucontact(u2, u)) {
|
||||
cmistake(u, ord, 40, MSG_COMMERCE);
|
||||
return;
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ give_cmd(unit * u, order * ord)
|
|||
if (findparam(s, u->faction->locale) == P_ANY) { /* Alle Gegenstände übergeben */
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ give_cmd(unit * u, order * ord)
|
|||
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);
|
||||
if (rtype==NULL || !fval(rtype, RTF_SNEAK))
|
||||
{
|
||||
|
|
|
@ -408,16 +408,6 @@ teach(unit * u, struct order * ord)
|
|||
if (ualias(u2))
|
||||
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) {
|
||||
add_message(&u->faction->msgs,
|
||||
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;
|
||||
} else if (u2 && (fval(u2, UFL_LOCKED)|| is_cursed(u2->attribs, C_SLAVE, 0))) {
|
||||
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;
|
||||
} else if (u2 && (has_skill(u, SK_MAGIC) || has_skill(u2, SK_MAGIC))) {
|
||||
error = 158;
|
||||
|
@ -326,7 +327,7 @@ give_unit(unit * u, unit * u2, order * ord)
|
|||
return;
|
||||
}
|
||||
|
||||
if (ucontact(u2, u) == 0) {
|
||||
if (!alliedunit(u2, u->faction, HELP_GIVE) && ucontact(u2, u) == 0) {
|
||||
cmistake(u, ord, 73, MSG_COMMERCE);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -820,16 +820,16 @@ bewegung_blockiert_von(unit * reisender, region * r)
|
|||
static boolean
|
||||
is_guardian(unit * u2, unit *u, unsigned int mask)
|
||||
{
|
||||
if (u2->faction != u->faction
|
||||
&& getguard(u2)&mask
|
||||
&& u2->number
|
||||
&& !ucontact(u2, u) && !besieged(u2)
|
||||
&& alliedunit(u2, u->faction, HELP_GUARD) != HELP_GUARD
|
||||
&& armedmen(u2)
|
||||
&& cansee(u2->faction, u->region, u, 0)
|
||||
) return true;
|
||||
if (u2->faction == u->faction) return false;
|
||||
if ((getguard(u2) & mask) == 0) return false;
|
||||
if (u2->number==0) return false;
|
||||
if (alliedunit(u2, u->faction, HELP_GUARD)) return false;
|
||||
if (ucontact(u2, u)) return false;
|
||||
if (besieged(u2)) return false;
|
||||
if (!armedmen(u2)) return false;
|
||||
if (!cansee(u2->faction, u->region, u, 0)) return false;
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
unit *
|
||||
|
|
|
@ -424,10 +424,6 @@ ucontact(const unit * u, const unit * u2)
|
|||
{
|
||||
attrib *ru;
|
||||
|
||||
/* Alliierte kontaktieren immer */
|
||||
if (alliedunit(u, u2->faction, HELP_GIVE) == HELP_GIVE)
|
||||
return true;
|
||||
|
||||
/* Explizites KONTAKTIERE */
|
||||
for (ru = a_find(u->attribs, &at_contact); ru; ru = ru->nexttype)
|
||||
if (((unit*)ru->data.v) == u2)
|
||||
|
|
Loading…
Reference in New Issue