Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2002:
[Freeciv-Dev] Settlers are no more afraid of allies (PR#1931)
Home

[Freeciv-Dev] Settlers are no more afraid of allies (PR#1931)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Settlers are no more afraid of allies (PR#1931)
From: Mateusz Stefek <matusik_s@xxxxx>
Date: Fri, 16 Aug 2002 11:13:55 -0700 (PDT)

With this patch autosettlers don't treat allies as enemies.
(They used to do nothing if ally unit is near)

I changed the meaning of territory[][] table.

                       was             now
one player near| 1<<player_no     | 1<<player_no
more players near| 0              | bitfield
noone near     | 0xFFFFFFFF       | 0

Also added:

+static int enemy_bits[MAX_NUM_PLAYERS];
It is bitmask for each player recalculated each turn.

It is used like:
+     && !(territory[x][y]&enemy_bits[pplayer->player_no])
instead of:
-     && (territory[x][y]&(1<<pplayer->player_no))

New version which uses bitvectors is attached.

!(territory[x][y]&enemy_bits[pplayer->player_no])
is replaced by
!BV_CHECK_MASK(territory[x][y], enemies[pplayer->player_no)
It has the same meaning.

--
mateusz

Attachment: settlers4.diff
Description: Text Data


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Settlers are no more afraid of allies (PR#1931), Mateusz Stefek <=