Idiotic Visual Studio has no separate C and C++ modes, and puts curly lines under the word "friend". So they can't be called that.

This commit is contained in:
Enno Rehling 2010-10-31 19:31:45 -07:00
parent fa6ea0a626
commit 03fd39ac63
1 changed files with 11 additions and 9 deletions

View File

@ -152,17 +152,17 @@ dfindhash(int no)
return 0; return 0;
} }
typedef struct friend { typedef struct buddy {
struct friend * next; struct buddy * next;
int number; int number;
faction * faction; faction * faction;
unit * unit; unit * unit;
} friend; } buddy;
static friend * static buddy *
get_friends(const unit * u, int * numfriends) get_friends(const unit * u, int * numfriends)
{ {
friend * friends = 0; buddy * friends = 0;
faction * f = u->faction; faction * f = u->faction;
region * r = u->region; region * r = u->region;
int number = 0; int number = 0;
@ -178,14 +178,14 @@ get_friends(const unit * u, int * numfriends)
allied = 1; allied = 1;
} }
if (allied) { if (allied) {
friend * nf, ** fr = &friends; buddy * nf, ** fr = &friends;
/* some units won't take stuff: */ /* some units won't take stuff: */
if (u2->race->ec_flags & GETITEM) { if (u2->race->ec_flags & GETITEM) {
while (*fr && (*fr)->faction->no<u2->faction->no) fr = &(*fr)->next; while (*fr && (*fr)->faction->no<u2->faction->no) fr = &(*fr)->next;
nf = *fr; nf = *fr;
if (nf==NULL || nf->faction!=u2->faction) { if (nf==NULL || nf->faction!=u2->faction) {
nf = malloc(sizeof(friend)); nf = malloc(sizeof(buddy));
nf->next = *fr; nf->next = *fr;
nf->faction = u2->faction; nf->faction = u2->faction;
nf->unit = u2; nf->unit = u2;
@ -219,6 +219,8 @@ gift_items(unit * u, int flags)
int retval = 0; int retval = 0;
int rule = rule_give(); int rule = rule_give();
assert(u->region);
if ((u->faction->flags&FFL_QUIT)==0 || (rule&GIVE_ONDEATH)==0) { if ((u->faction->flags&FFL_QUIT)==0 || (rule&GIVE_ONDEATH)==0) {
if ((rule&GIVE_ALLITEMS)==0 && (flags&GIFT_FRIENDS)) flags-=GIFT_FRIENDS; if ((rule&GIVE_ALLITEMS)==0 && (flags&GIFT_FRIENDS)) flags-=GIFT_FRIENDS;
if ((rule&GIVE_PEASANTS)==0 && (flags&GIFT_PEASANTS)) flags-=GIFT_PEASANTS; if ((rule&GIVE_PEASANTS)==0 && (flags&GIFT_PEASANTS)) flags-=GIFT_PEASANTS;
@ -257,10 +259,10 @@ gift_items(unit * u, int flags)
/* if I have friends, I'll try to give my stuff to them */ /* if I have friends, I'll try to give my stuff to them */
if (u->faction && (flags & GIFT_FRIENDS)) { if (u->faction && (flags & GIFT_FRIENDS)) {
int number = 0; int number = 0;
friend * friends = get_friends(u, &number); buddy * friends = get_friends(u, &number);
while (friends) { while (friends) {
struct friend * nf = friends; struct buddy * nf = friends;
unit * u2 = nf->unit; unit * u2 = nf->unit;
item * itm = u->items; item * itm = u->items;
while (itm!=NULL) { while (itm!=NULL) {