version 1.40 | | version 1.41 |
---|
| | |
/* | | /* |
* static char *rcsid_attack_c = | | * static char *rcsid_attack_c = |
* "$Id: attack.c,v 1.40 2001/07/14 04:11:18 mwedel Exp $"; | | * "$Id: attack.c,v 1.41 2001/08/21 05:39:30 mwedel Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
| | |
/* Something could have happened to 'tmp' while 'tmp->below' was processed. | | /* Something could have happened to 'tmp' while 'tmp->below' was processed. |
* For example, 'tmp' was put in an icecube. | | * For example, 'tmp' was put in an icecube. |
| | * This is one of the few cases where on_same_map should not be used. |
*/ | | */ |
if (tmp->map != map || tmp->x != x || tmp->y != y) | | if (tmp->map != map || tmp->x != x || tmp->y != y) |
continue; | | continue; |
| | |
} | | } |
if (QUERY_FLAG (*target, FLAG_REMOVED) | | if (QUERY_FLAG (*target, FLAG_REMOVED) |
|| QUERY_FLAG (*hitter, FLAG_REMOVED) | | || QUERY_FLAG (*hitter, FLAG_REMOVED) |
|| (*hitter)->map == NULL || (*hitter)->map != (*target)->map) | | || (*hitter)->map == NULL || !on_same_map((*hitter), (*target))) |
{ | | { |
LOG (llevError, "BUG: hitter (arch %s, name %s) with no relation to " | | LOG (llevError, "BUG: hitter (arch %s, name %s) with no relation to " |
"target\n", (*hitter)->arch->name, (*hitter)->name); | | "target\n", (*hitter)->arch->name, (*hitter)->name); |
| | |
new_mode = 1; | | new_mode = 1; |
else if (QUERY_FLAG (hitter, FLAG_REMOVED) | | else if (QUERY_FLAG (hitter, FLAG_REMOVED) |
|| QUERY_FLAG (target, FLAG_REMOVED) | | || QUERY_FLAG (target, FLAG_REMOVED) |
|| hitter->map == NULL || hitter->map != target->map) | | || hitter->map == NULL || !on_same_map(hitter, target)) |
return 1; | | return 1; |
else | | else |
new_mode = 0; | | new_mode = 0; |
| | |
add_kill_to_party(no,query_name(hitter),query_name(op),exp); | | add_kill_to_party(no,query_name(hitter),query_name(op),exp); |
#endif | | #endif |
for(pl=first_player;pl!=NULL;pl=pl->next) { | | for(pl=first_player;pl!=NULL;pl=pl->next) { |
if(pl->ob->contr->party_number==no && (pl->ob->map == hitter->map)) { | | if(pl->ob->contr->party_number==no && on_same_map(pl->ob, hitter)) { |
count++; | | count++; |
shares+=(pl->ob->level+4); | | shares+=(pl->ob->level+4); |
} | | } |
| | |
else { | | else { |
int share=exp/shares,given=0,nexp; | | int share=exp/shares,given=0,nexp; |
for(pl=first_player;pl!=NULL;pl=pl->next) { | | for(pl=first_player;pl!=NULL;pl=pl->next) { |
if(pl->ob->contr->party_number==no && (pl->ob->map == hitter->map)) | | if(pl->ob->contr->party_number==no && on_same_map(pl->ob, hitter)) |
{ | | { |
nexp=(pl->ob->level+4)*share; | | nexp=(pl->ob->level+4)*share; |
add_exp(pl->ob,nexp); | | add_exp(pl->ob,nexp); |
| | |
int adjust=0; | | int adjust=0; |
| | |
/* safety */ | | /* safety */ |
if(!target||!hitter||!hitter->map||!target->map||hitter->map!=target->map) { | | if(!target||!hitter||!hitter->map||!target->map||!on_same_map(hitter,target)) { |
LOG (llevError, "BUG: adj_attackroll(): hitter and target not on same " | | LOG (llevError, "BUG: adj_attackroll(): hitter and target not on same " |
"map\n"); | | "map\n"); |
return 0; | | return 0; |