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:
Enno Rehling 2005-02-05 18:11:23 +00:00
parent 55c8f01b86
commit 2079db13cf
6 changed files with 24 additions and 37 deletions

View File

@ -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))
{

View File

@ -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));

View File

@ -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;
}

View File

@ -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;
return false;
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 true;
}
unit *

View File

@ -1952,12 +1952,12 @@ sp_treewalkexit(castorder *co)
u = pa->param[n]->data.u;
if(!ucontact(u, mage)) {
if (!ucontact(u, mage)) {
sprintf(buf, "%s hat uns nicht kontaktiert.", unitname(u));
addmessage(r, mage->faction, buf, MSG_MAGIC, ML_MISTAKE);
} else {
int w = weight(u);
if(!can_survive(u, rt)) {
if (!can_survive(u, rt)) {
cmistake(mage, co->order, 231, MSG_MAGIC);
} else if(remaining_cap - w < 0) {
sprintf(buf, "%s ist zu schwer.", unitname(u));
@ -5837,8 +5837,8 @@ sp_enterastral(castorder *co)
if(pa->param[n]->flag == TARGET_NOTFOUND) continue;
u = pa->param[n]->data.u;
if(!ucontact(u, mage)) {
if(power > 10 && !is_magic_resistant(mage, u, 0)
if (!ucontact(u, mage)) {
if (power > 10 && !is_magic_resistant(mage, u, 0)
&& can_survive(u, rt)) {
sprintf(buf, "%s hat uns nicht kontaktiert, widersteht dem "
"Zauber jedoch nicht.", unitname(u));
@ -5964,7 +5964,7 @@ sp_pullastral(castorder *co)
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)) {
sprintf(buf, "%s hat uns nicht kontaktiert, widersteht dem "
"Zauber jedoch nicht.", unitname(u));
@ -6084,8 +6084,8 @@ sp_leaveastral(castorder *co)
u = pa->param[n]->data.u;
if(!ucontact(u, mage)) {
if(power > 10 && !pa->param[n]->flag == TARGET_RESISTS && can_survive(u, rt)) {
if (!ucontact(u, mage)) {
if (power > 10 && !pa->param[n]->flag == TARGET_RESISTS && can_survive(u, rt)) {
sprintf(buf, "%s hat uns nicht kontaktiert, widersteht dem "
"Zauber jedoch nicht.", unitname(u));
addmessage(r, mage->faction, buf, MSG_MAGIC, ML_INFO);

View File

@ -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)