[Freeciv-Dev] (PR#37321) Veteran status

2007-03-05 Thread Guest

URL: http://bugs.freeciv.org/Ticket/Display.html?id=37321 

 [guest - Sun Mar 04 19:29:33 2007]:
 
  [EMAIL PROTECTED] - Sat Mar 03 22:22:13 2007]:
  
 
 well i see that some of you say that the status should be dropped at 
 one stage, but i will disagree here.
 
 assume you have a elite carvel crew, you assign them to a new galeon. 
 they are very experianced with those kind of ships. so they would 
 probably stay elite
 same with frigates-ironclads

I think that is the main inconsistency. If you are assigned a new 
technology it does not assume that you become automatically experienced 
with it. For instance, Pikemen are upgraded to Musketeers. Do you 
really believe that an elite pikeman will become immediately an elite 
musketeer? They are using quite different weapons, tactics, etc. The 
same is for other technologies, such as catapults and cannons.

People even need time and training to move from one programming 
language to another, not talking about being an expert :-)

Sincerely,
Alexander

 
 when it comes to catipults and cannons, they both rely on aim. when 
you 
 upgrade them, the status should remain
 
 right now if you upgrade with money, status remians. the 
 workshop upgrades them for free. 
 
 so i ask u guys to make an option before u make the game for the 
 upgrading system-which one you prefer to play in
 -flamehawk96
 (aka eadle)
 
 


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#37592) Project directions

2007-03-05 Thread (Eddie_Anderson)

URL: http://bugs.freeciv.org/Ticket/Display.html?id=37592 

Since this discussion last summer, I've been thinking some more
about what Freeciv could be.  I've reached a few tentative
conclusions.  Some of the changes are simple; some are far-reaching.

I've already done some work (on my own copy of Freeciv) to
implement some of these ideas, but it has been several months since
I last worked on it.  So I figured that I would publish these ideas
to see if anyone else was interested in them.

I'll leave out some of the details in the interest of keeping
this email as brief as possible.  If there's any interest, then I
can post the details later.  Keep in mind that most of this is still
a thought experiment at this time.

Here are the ideas:

1) Add a new victory condition to Freeciv that is based on points.

   IIRC, Freeciv offers only 3 ways to win:

 a) Conquest of all opponents

 b) Being first to Alpha Centauri

 c) Winning on points after playing to endyear

   b) and c) require long games.  a) can be quicker but that
   requires players to focus on combat technology while ignoring
   many other aspects of Freeciv.  That tends to make the games very
   similar to each other.

   I propose that a fourth victory condition be added to Freeciv:

 d) The first player to X points wins.


   One of the biggest advantages of this is that it makes
   Freeciv games scalable.  E.g. if you want a short game, play to
   500 points; if you want a longer game, play 2000 points; etc.

   Another potential advantage is that the AI can be programmed
   to focus on accumulating points rather than trying to engineer
   a conquest.  Presumably the AI can be programmed to compare
   numbers more effectively than it can be programmed to build and
   move units.

2) Award points for things besides WoWs and techs.

   If victory can be determined by points, then there needs to be
   more ways for you to earn points.  Here are some suggestions:

 a) Award points for firsts like 50 points for the first player
to get two size 3 cities.

There could be multiple tiers.  (E.g. size 3 cites, size 5
cities, size 8 cities, etc.)   There could also be multiple
bonuses at each tier.  E.g. There could be two bonuses for
size 3:
  .a bonus for the first civ with *one* size 3 city and
  .a separate bonus for the first civ with two size 3 cities
   - and the civ that wins one bonus on that tier is
   ineligible to win the other.

There could be similar eligibility restrictions between
tiers.  E.g. if your civ wins a bonus for being the first
with one size 3 city, then your civ is ineligible to win
the bonus for being the first civ with one size *5* city.
But you *are* eligible to win the bonus for being the first
civ with *two* size 5 cities.

 b) Award 1 point on every turn for each surplus happy citizen

E.g. a size 3 city wuth 2 happy citizens and one unhappy
citizen would earn one point per turn.  But a city with 1
happy, 1 content, and 1 unhappy does not earn any points
(at least not based on this criterion; this city might still
earn points based on other criteria).

 c) Award points on every turn to the player who has the largest
city in the game.

E.g. if only one player has a size 5 city and at least one
other player has a size 4 city, then the player with the
size 5 city earns one point per turn for that difference.
Likewise if size 3 is the largest city owned by any other
player, then the player with the size 5 city would earn 2
points per turn.

 d) others

There could be many other conditions that generate points.
Which ones are implemented depends on what incentives that
the game needs.

E.g. you could award points for most WoWs, most buildings,
most units, highest number of techs, biggest population,
absence of pollution, lowest corruption losses, and on and
on.  But some of those characteristics (e.g. most buildings)
have intrinsic benefits - e.g. awarding points for having
the most buildings may make some buildings too desirable.

   One of the benefits of awarding points for things is that it
   makes it easier to tweak game balance and AI behavior.  E.g. it
   is easier to change a point value of something from 1 point to 2
   points than it is recode the AI to build more or less Settlers,
   Frigates, Caravans, etc.


Those are the biggest changes.  I believe that they will make
Freeciv games more scalable and more tune-able.  But what's even
more important is, I hope that they will expand the number of viable
strategies for winning.

There are other changes that I would like to see.  Most are not
as critical as those above.  Some of them are trivially simple.
I'll list them here 

[Freeciv-Dev] (PR#37596) 64bit lua -Werror

2007-03-05 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=37596 

 --enable-debug cannot be used at 64bit system, since:

../../../../src.patched/dependencies/lua/src/ltable.c: In function
'luaH_mainposition':../../../../src.patched/dependencies/lua/src/ltable.c:108:
warning: cast from pointer to integer of different size
../../../../src.patched/dependencies/lua/src/ltable.c:110: warning:
cast from pointer to integer of different size


 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#37596) 64bit lua -Werror

2007-03-05 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=37596 

On 3/5/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

  --enable-debug cannot be used at 64bit system, since:

 ../../../../src.patched/dependencies/lua/src/ltable.c: In function
 'luaH_mainposition':../../../../src.patched/dependencies/lua/src/ltable.c:108:
 warning: cast from pointer to integer of different size
 ../../../../src.patched/dependencies/lua/src/ltable.c:110: warning:
 cast from pointer to integer of different size

 When I updated lua to 5.1.1, I didn't got this error while compiling lua.
 But tolua did not compile against lua-5.1.1. I even got latest
version of tolua (which version we are using? Version number is not in
any obvious place)
 I tested also lua-5.0.3, but original problem is present there.


 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#37611) [Patch] ACTIVITY_BASE

2007-03-05 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=37611 

 This adds id of base being built to unit structure (activity_base).
Also new activity, ACTIVITY_BASE, is added. Old ACTIVITY_FORTRESS and
ACTIVITY_AIRBASE are reserved for savegame backward compatibility.
 This patch does not change savegame format at all.

 This version is far from ready.


 - ML



ActivityBase.diff.gz
Description: GNU Zip compressed data
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#37614) [Patch] Always claim base square for ClaimTerritory bases

2007-03-05 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=37614 

 Tile was claimed when BASE_FORTRESS was finished. This patch fixes it
to correctly check for ClaimTerritory flag (for any base type).


 - ML

diff -Nurd -X.diff_ignore freeciv/server/unittools.c freeciv/server/unittools.c
--- freeciv/server/unittools.c	2007-03-05 21:09:47.0 +0200
+++ freeciv/server/unittools.c	2007-03-06 02:04:09.0 +0200
@@ -713,7 +713,6 @@
 if (total_activity (ptile, ACTIVITY_FORTRESS)
 	= tile_activity_time(ACTIVITY_FORTRESS, ptile)) {
   tile_add_base(ptile, base_type_get_by_id(BASE_FORTRESS));
-  map_claim_ownership(ptile, unit_owner(punit), ptile);
   unit_activity_done = TRUE;
   new_base = TRUE;
 }
@@ -784,6 +783,11 @@
 /* watchtower becomes effective
  * FIXME: Reqs on other specials will not be updated immediately. */
 unit_list_refresh_vision(ptile-units);
+
+/* Claim base if it has ClaimTerritory flag */
+if (tile_has_base_flag(ptile, BF_CLAIM_TERRITORY)) {
+  map_claim_ownership(ptile, unit_owner(punit), ptile);
+}
   }
 
   if (unit_activity_done) {
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#37436) [Patch] Base UnitFlag requirements

2007-03-05 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=37436 

On 3/3/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

  Remove hardcoded unit type flag requirements for building base.
 Instead ruleset defined UnitFlag requirements are used.

 - Flag rename part removed from this patch.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/helpdata.c freeciv/client/helpdata.c
--- freeciv/client/helpdata.c	2007-03-03 18:28:05.0 +0200
+++ freeciv/client/helpdata.c	2007-03-06 02:16:59.0 +0200
@@ -891,9 +891,6 @@
   if (unit_type_flag(utype, F_TRANSFORM)) {
 sprintf(buf + strlen(buf), _(* Can transform tiles.\n));
   }
-  if (unit_type_flag(utype, F_AIRBASE)) {
-sprintf(buf + strlen(buf), _(* Can build airbases.\n));
-  }
   if (is_ground_unittype(utype)  !unit_type_flag(utype, F_SETTLERS)) {
 sprintf(buf + strlen(buf),
 	_(* May fortify, granting a 50%% defensive bonus.\n));
diff -Nurd -X.diff_ignore freeciv/common/base.c freeciv/common/base.c
--- freeciv/common/base.c	2007-03-05 00:51:27.0 +0200
+++ freeciv/common/base.c	2007-03-06 02:16:59.0 +0200
@@ -52,12 +52,6 @@
 bool can_build_base(const struct unit *punit, const struct base_type *pbase,
 const struct tile *ptile)
 {
-  if ((pbase-id == BASE_FORTRESS  !unit_flag(punit, F_SETTLERS)) ||
-  (pbase-id == BASE_AIRBASE  !unit_flag(punit, F_AIRBASE))) {
-/* This unit cannot build this kind of base */
-return FALSE;
-  }
-
   if (tile_get_city(ptile)) {
 /* Bases cannot be built inside cities */
 return FALSE;
diff -Nurd -X.diff_ignore freeciv/common/unittype.h freeciv/common/unittype.h
--- freeciv/common/unittype.h	2007-03-01 01:49:07.0 +0200
+++ freeciv/common/unittype.h	2007-03-06 02:18:13.0 +0200
@@ -80,7 +80,7 @@
   F_SPY,  /* Enhanced spy abilities */
   F_TRANSFORM,/* Can transform terrain types (Engineers) */
   F_PARATROOPERS,
-  F_AIRBASE,  /* Can build Airbases */
+  F_AIRBASE,  /* No hardcoded behavior, rulesets use for UnitFlag requirement */
   F_CITIES,   /* Can build cities */
   F_NO_LAND_ATTACK,   /* Cannot attack vs land squares (Submarine) */
   F_ADD_TO_CITY,  /* unit can add to city population */
diff -Nurd -X.diff_ignore freeciv/data/civ1/terrain.ruleset freeciv/data/civ1/terrain.ruleset
--- freeciv/data/civ1/terrain.ruleset	2007-03-04 22:55:01.0 +0200
+++ freeciv/data/civ1/terrain.ruleset	2007-03-06 02:16:59.0 +0200
@@ -617,6 +617,7 @@
 { type, name, range
   Tech, Construction, Player
   TerrainClass, Land, Local
+  UnitFlag, Settlers, Local
 }
 flags   = NoAggressive, DefenseBonus, Watchtower, ClaimTerritory,
   NoStackDeath, DiplomatDefense
diff -Nurd -X.diff_ignore freeciv/data/civ2/terrain.ruleset freeciv/data/civ2/terrain.ruleset
--- freeciv/data/civ2/terrain.ruleset	2007-03-04 22:55:02.0 +0200
+++ freeciv/data/civ2/terrain.ruleset	2007-03-06 02:19:07.0 +0200
@@ -709,6 +709,7 @@
 { type, name, range
   Tech, Construction, Player
   TerrainClass, Land, Local
+  UnitFlag, Settlers, Local
 }
 flags   = NoAggressive, DefenseBonus, Watchtower, ClaimTerritory,
   NoStackDeath, DiplomatDefense
@@ -719,6 +720,7 @@
 { type, name, range
   Tech, Radio, Player
   TerrainClass, Land, Local
+  UnitFlag, Airbase, Local
 }
 flags   = NoStackDeath, DiplomatDefense, Refuel, NoHPLoss,
   AttackUnreachable, ParadropFrom
diff -Nurd -X.diff_ignore freeciv/data/default/terrain.ruleset freeciv/data/default/terrain.ruleset
--- freeciv/data/default/terrain.ruleset	2007-03-04 22:55:02.0 +0200
+++ freeciv/data/default/terrain.ruleset	2007-03-06 02:18:54.0 +0200
@@ -776,6 +776,7 @@
 { type, name, range
   Tech, Construction, Player
   TerrainClass, Land, Local
+  UnitFlag, Settlers, Local
 }
 flags   = NoAggressive, DefenseBonus, Watchtower, ClaimTerritory,
   NoStackDeath, DiplomatDefense
@@ -786,6 +787,7 @@
 { type, name, range
   Tech, Radio, Player
   TerrainClass, Land, Local
+  UnitFlag, Airbase, Local
 }
 flags   = NoStackDeath, DiplomatDefense, Refuel, NoHPLoss,
   AttackUnreachable, ParadropFrom
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#37537) [Patch] Base build time

2007-03-05 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=37537 

On 3/5/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

  This makes built time property of base type.

 - Updated against svn
 - Necessary modifications to civ1  civ2 rulesets too


 - ML

diff -Nurd -X.diff_ignore freeciv/client/packhand.c freeciv/client/packhand.c
--- freeciv/client/packhand.c	2007-03-06 03:31:58.0 +0200
+++ freeciv/client/packhand.c	2007-03-06 03:45:35.0 +0200
@@ -2414,8 +2414,6 @@
   pterrain-transform_result = get_terrain(p-transform_result);
   pterrain-transform_time = p-transform_time;
   pterrain-rail_time = p-rail_time;
-  pterrain-airbase_time = p-airbase_time;
-  pterrain-fortress_time = p-fortress_time;
   pterrain-clean_pollution_time = p-clean_pollution_time;
   pterrain-clean_fallout_time = p-clean_fallout_time;
   
@@ -2481,6 +2479,8 @@
 
   pbase-native_to = p-native_to;
 
+  pbase-build_time = p-build_time;
+
   pbase-flags = p-flags;
 }
 
diff -Nurd -X.diff_ignore freeciv/common/base.h freeciv/common/base.h
--- freeciv/common/base.h	2007-03-06 03:31:58.0 +0200
+++ freeciv/common/base.h	2007-03-06 03:46:29.0 +0200
@@ -39,6 +39,7 @@
   char name_orig[MAX_LEN_NAME];
   int id;
   struct requirement_vector reqs;
+  int build_time;
   bv_unit_classes native_to;
 
   bv_base_flags flags;
diff -Nurd -X.diff_ignore freeciv/common/packets.def freeciv/common/packets.def
--- freeciv/common/packets.def	2007-03-06 03:31:58.0 +0200
+++ freeciv/common/packets.def	2007-03-06 03:47:22.0 +0200
@@ -1250,8 +1250,6 @@
   TERRAIN transform_result;
   UINT8 transform_time;
   UINT8 rail_time;
-  UINT8 airbase_time;
-  UINT8 fortress_time;
   UINT8 clean_pollution_time;
   UINT8 clean_fallout_time;
   
@@ -1272,6 +1270,7 @@
   STRING name[MAX_LEN_NAME];
   UINT8 reqs_count;
   REQUIREMENT reqs[MAX_NUM_REQS:reqs_count];
+  UINT8 build_time;
   BV_UNIT_CLASSES native_to;
   BV_BASE_FLAGS flags;
 end
diff -Nurd -X.diff_ignore freeciv/common/terrain.h freeciv/common/terrain.h
--- freeciv/common/terrain.h	2007-03-03 18:28:05.0 +0200
+++ freeciv/common/terrain.h	2007-03-06 03:45:35.0 +0200
@@ -144,8 +144,6 @@
   struct terrain *transform_result;
   int transform_time;
   int rail_time;
-  int airbase_time;
-  int fortress_time;
   int clean_pollution_time;
   int clean_fallout_time;
 
diff -Nurd -X.diff_ignore freeciv/common/tile.c freeciv/common/tile.c
--- freeciv/common/tile.c	2007-03-06 03:31:58.0 +0200
+++ freeciv/common/tile.c	2007-03-06 03:45:35.0 +0200
@@ -292,13 +292,13 @@
   case ACTIVITY_IRRIGATE:
 return ptile-terrain-irrigation_time * ACTIVITY_FACTOR;
   case ACTIVITY_FORTRESS:
-return ptile-terrain-fortress_time * ACTIVITY_FACTOR;
+return base_type_get_by_id(BASE_FORTRESS)-build_time * ACTIVITY_FACTOR;
   case ACTIVITY_RAILROAD:
 return ptile-terrain-rail_time * ACTIVITY_FACTOR;
   case ACTIVITY_TRANSFORM:
 return ptile-terrain-transform_time * ACTIVITY_FACTOR;
   case ACTIVITY_AIRBASE:
-return ptile-terrain-airbase_time * ACTIVITY_FACTOR;
+return base_type_get_by_id(BASE_AIRBASE)-build_time * ACTIVITY_FACTOR;
   case ACTIVITY_FALLOUT:
 return ptile-terrain-clean_fallout_time * ACTIVITY_FACTOR;
   default:
diff -Nurd -X.diff_ignore freeciv/data/civ1/terrain.ruleset freeciv/data/civ1/terrain.ruleset
--- freeciv/data/civ1/terrain.ruleset	2007-03-06 03:31:56.0 +0200
+++ freeciv/data/civ1/terrain.ruleset	2007-03-06 03:50:17.0 +0200
@@ -614,6 +614,7 @@
   Tech, Construction, Player
   TerrainClass, Land, Local
 }
+build_time  = 3
 native_to   = Land
 flags   = NoAggressive, DefenseBonus, ClaimTerritory,
   NoStackDeath, DiplomatDefense
@@ -624,5 +625,6 @@
 { type, name, range
   Tech, Never, Player
 }
+build_time  = 3
 native_to   = Air, Missile
 flags   = NoStackDeath, DiplomatDefense, ParadropFrom
diff -Nurd -X.diff_ignore freeciv/data/civ2/terrain.ruleset freeciv/data/civ2/terrain.ruleset
--- freeciv/data/civ2/terrain.ruleset	2007-03-06 03:31:57.0 +0200
+++ freeciv/data/civ2/terrain.ruleset	2007-03-06 03:48:58.0 +0200
@@ -706,6 +706,7 @@
   Tech, Construction, Player
   TerrainClass, Land, Local
 }
+build_time  = 3
 native_to   = Land
 flags   = NoAggressive, DefenseBonus, ClaimTerritory,
   NoStackDeath, DiplomatDefense
@@ -717,5 +718,6 @@
   Tech, Radio, Player
   TerrainClass, Land, Local
 }
+build_time  = 3
 native_to   = Air, Helicopter, Missile
 flags   = NoStackDeath, DiplomatDefense, ParadropFrom
diff -Nurd -X.diff_ignore freeciv/data/default/terrain.ruleset freeciv/data/default/terrain.ruleset
--- freeciv/data/default/terrain.ruleset	2007-03-06 03:31:57.0 +0200
+++ freeciv/data/default/terrain.ruleset	2007-03-06 03:48:08.0 +0200
@@ -773,6 +773,7 @@
   Tech, Construction, Player
   TerrainClass, Land, Local
 }
+build_time  = 3
 native_to   = Land
 flags   = 

Re: [Freeciv-Dev] (PR#37534) [Patch] Base gfx tags from ruleset

2007-03-05 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=37534 

On 3/5/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

  Get base gfx tags from ruleset.

 - Necessary modifications to all rulesets and tilesets
 - If primary gfx and alt gfx consisted different layers, parts of alt
gfx appeared in addition to primary gfx. Fixed.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/packhand.c freeciv/client/packhand.c
--- freeciv/client/packhand.c	2007-03-06 03:31:58.0 +0200
+++ freeciv/client/packhand.c	2007-03-06 04:53:52.0 +0200
@@ -2473,6 +2473,8 @@
 
   sz_strlcpy(pbase-name_orig, p-name);
   pbase-name = Q_(pbase-name_orig);
+  sz_strlcpy(pbase-graphic_str, p-graphic_str);
+  sz_strlcpy(pbase-graphic_alt, p-graphic_alt);
 
   for (i = 0; i  p-reqs_count; i++) {
 requirement_vector_append(pbase-reqs, p-reqs[i]);
@@ -2482,6 +2484,8 @@
   pbase-native_to = p-native_to;
 
   pbase-flags = p-flags;
+
+  tileset_setup_base(tileset, pbase);
 }
 
 /**
diff -Nurd -X.diff_ignore freeciv/client/tilespec.c freeciv/client/tilespec.c
--- freeciv/client/tilespec.c	2007-02-28 23:02:38.0 +0200
+++ freeciv/client/tilespec.c	2007-03-06 05:12:43.0 +0200
@@ -27,6 +27,7 @@
 #include string.h
 
 #include astring.h
+#include base.h
 #include capability.h
 #include fcintl.h
 #include game.h /* for fill_xxx */
@@ -241,9 +242,6 @@
   *irrigation[MAX_INDEX_CARDINAL],
   *pollution,
   *village,
-  *fortress,
-  *fortress_back,
-  *airbase,
   *fallout,
   *fog,
   **fullfog,
@@ -253,6 +251,12 @@
   } tx;/* terrain extra */
   struct {
 struct sprite
+  *background,
+  *middleground,
+  *foreground;
+  } bases[BASE_LAST];
+  struct {
+struct sprite
   *main[EDGE_COUNT],
   *city[EDGE_COUNT],
   *worked[EDGE_COUNT],
@@ -947,6 +951,9 @@
   government_iterate(gov) {
 tileset_setup_government(tileset, gov-index);
   } government_iterate_end;
+  base_type_iterate(pbase) {
+tileset_setup_base(tileset, pbase);
+  } base_type_iterate_end;
   for (id = 0; id  game.control.nation_count; id++) {
 tileset_setup_nation_flag(tileset, id);
   }
@@ -2259,9 +2266,6 @@
   SET_SPRITE(tx.fallout,tx.fallout);
   SET_SPRITE(tx.pollution,  tx.pollution);
   SET_SPRITE(tx.village,tx.village);
-  SET_SPRITE(tx.fortress,   tx.fortress);
-  SET_SPRITE_ALT(tx.fortress_back, tx.fortress_back, tx.fortress);
-  SET_SPRITE(tx.airbase,tx.airbase);
   SET_SPRITE(tx.fog,tx.fog);
 
   /* Load color sprites. */
@@ -2494,9 +2498,9 @@
   or else return NULL, and emit log message.
 ***/
 struct sprite* lookup_sprite_tag_alt(struct tileset *t,
-	const char *tag, const char *alt,
-	bool required, const char *what,
-	const char *name)
+ const char *tag, const char *alt,
+ bool required, const char *what,
+ const char *name)
 {
   struct sprite *sp;
   
@@ -2591,6 +2595,59 @@
 			presource-name);
 }
 
+/
+  Set base sprite values; should only happen after
+  tilespec_load_tiles().
+/
+void tileset_setup_base(struct tileset *t,
+const struct base_type *pbase)
+{
+  char full_tag_name[MAX_LEN_NAME + strlen(_fg)];
+  const int id = pbase-id;
+
+  assert(id = 0  id  game.control.num_base_types);
+
+  sz_strlcpy(full_tag_name, pbase-graphic_str);
+  strcat(full_tag_name, _bg);
+  t-sprites.bases[id].background = load_sprite(t, full_tag_name);
+
+  sz_strlcpy(full_tag_name, pbase-graphic_str);
+  strcat(full_tag_name, _mg);
+  t-sprites.bases[id].middleground = load_sprite(t, full_tag_name);
+
+  sz_strlcpy(full_tag_name, pbase-graphic_str);
+  strcat(full_tag_name, _fg);
+  t-sprites.bases[id].foreground = load_sprite(t, full_tag_name);
+
+  if (t-sprites.bases[id].background == NULL
+   t-sprites.bases[id].middleground == NULL
+   t-sprites.bases[id].foreground == NULL) {
+/* No primary graphics at all. Try alternative */
+freelog(LOG_VERBOSE,
+	_(Using alternate graphic %s (instead of %s) for base %s),
+pbase-graphic_alt, pbase-graphic_str, base_name(pbase));
+
+sz_strlcpy(full_tag_name, pbase-graphic_alt);
+strcat(full_tag_name, _bg);
+t-sprites.bases[id].background = load_sprite(t, full_tag_name);
+
+sz_strlcpy(full_tag_name, pbase-graphic_alt);
+strcat(full_tag_name, _mg);
+t-sprites.bases[id].middleground = load_sprite(t, full_tag_name);
+
+sz_strlcpy(full_tag_name, pbase-graphic_alt);
+strcat(full_tag_name, _fg);
+t-sprites.bases[id].foreground = load_sprite(t, full_tag_name);
+
+if (t-sprites.bases[id].background == NULL
+  

[Freeciv-Dev] (PR#37625) [Patch] count_my_units() uses unit class cache rather than move_type

2007-03-05 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=37625 

 count_my_units() determines where units can move from cached values
instead of move_type.
 stats.units.air field is renamed as more generic(?) stats.units.amphibious.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aicity.c freeciv/ai/aicity.c
--- freeciv/ai/aicity.c	2007-03-05 21:11:52.0 +0200
+++ freeciv/ai/aicity.c	2007-03-06 05:57:50.0 +0200
@@ -510,7 +510,7 @@
   case EFT_MOVE_BONUS:
 /* FIXME: check other reqs (e.g., unitclass) */
 v += (8 * v * amount + ai-stats.units.land
-	  + ai-stats.units.sea + ai-stats.units.air);
+	  + ai-stats.units.sea + ai-stats.units.amphibious);
 break;
   case EFT_UNIT_NO_LOSE_POP:
 v += unit_list_size(pcity-tile-units) * 2;
@@ -518,17 +518,17 @@
   case EFT_HP_REGEN:
 /* FIXME: check other reqs (e.g., unitclass) */
 v += (5 * c + ai-stats.units.land
-	  + ai-stats.units.sea + ai-stats.units.air);
+	  + ai-stats.units.sea + ai-stats.units.amphibious);
 break;
   case EFT_VETERAN_COMBAT:
 /* FIXME: check other reqs (e.g., unitclass) */
 v += (2 * c + ai-stats.units.land + ai-stats.units.sea
-	  + ai-stats.units.air);
+	  + ai-stats.units.amphibious);
 break;
   case EFT_VETERAN_BUILD:
 /* FIXME: check other reqs (e.g., unitclass, unitflag) */
 v += (3 * c + ai-stats.units.land + ai-stats.units.sea
-	  + ai-stats.units.air);
+	  + ai-stats.units.amphibious);
 break;
   case EFT_UPGRADE_UNIT:
 v += ai-stats.units.upgradeable;
diff -Nurd -X.diff_ignore freeciv/ai/aidata.c freeciv/ai/aidata.c
--- freeciv/ai/aidata.c	2007-03-05 21:11:52.0 +0200
+++ freeciv/ai/aidata.c	2007-03-06 05:54:36.0 +0200
@@ -186,20 +186,18 @@
   memset(ai-stats.units, 0, sizeof(ai-stats.units));
 
   unit_list_iterate(pplayer-units, punit) {
-switch (get_unit_move_type(unit_type(punit))) {
-case LAND_MOVING:
+struct unit_class *pclass = get_unit_class(unit_type(punit));
+
+if (pclass-ai.land_move != MOVE_NONE
+ pclass-ai.sea_move != MOVE_NONE) {
+  /* Can move both land and ocean */
+  ai-stats.units.amphibious++;
+} else if (pclass-ai.land_move != MOVE_NONE) {
+  /* Can move only at land */
   ai-stats.units.land++;
-  break;
-case SEA_MOVING:
+} else if (pclass-ai.sea_move != MOVE_NONE) {
+  /* Can move only at sea */
   ai-stats.units.sea++;
-  break;
-case HELI_MOVING:
-case AIR_MOVING:
-  ai-stats.units.air++;
-  break;
-default:
-  freelog(LOG_ERROR, Illegal move type in count_my_units()!);
-  break;
 }
 
 if (unit_flag(punit, F_TRIREME)) {
diff -Nurd -X.diff_ignore freeciv/ai/aidata.h freeciv/ai/aidata.h
--- freeciv/ai/aidata.h	2007-03-05 21:11:52.0 +0200
+++ freeciv/ai/aidata.h	2007-03-06 05:56:08.0 +0200
@@ -111,8 +111,8 @@
   /* Unit-flag counts. */
   int triremes, missiles;
 
-  /* Move-type counts (air includes helicoptor here). */
-  int land, sea, air;
+  /* Move-type counts */
+  int land, sea, amphibious;
 
   /* Upgradeable units */
   int upgradeable;
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#37626) [Patch] unit_move_turns() UCF_TERRAIN_SPEED

2007-03-05 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=37626 

 This makes unit_move_turns() to respect UCF_TERRAIN_SPEED instead of
considering AIR_MOVING and HELI_MOVING to have it.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aiunit.c freeciv/ai/aiunit.c
--- freeciv/ai/aiunit.c	2007-03-06 05:46:13.0 +0200
+++ freeciv/ai/aiunit.c	2007-03-06 06:11:32.0 +0200
@@ -260,35 +260,25 @@
 {
   int move_time;
   int move_rate = unit_move_rate(punit);
+  struct unit_class *pclass = get_unit_class(unit_type(punit));
 
-  switch (get_unit_move_type(unit_type(punit))) {
-  case LAND_MOVING:
-  
-   /* FIXME: IGTER units should have their move rates multiplied by 
-* igter_speedup. Note: actually, igter units should never have their 
-* move rates multiplied. The correct behaviour is to have every tile 
-* they cross cost 1/3 of a movement point. ---RK */
- 
+  if (!unit_class_flag(pclass, UCF_TERRAIN_SPEED)) {
+/* Unit does not care about terrain */
+move_time = real_map_distance(punit-tile, ptile) * SINGLE_MOVE / move_rate;
+  } else {
 if (unit_flag(punit, F_IGTER)) {
+  /* FIXME: IGTER units should have their move rates multiplied by 
+   * igter_speedup. Note: actually, igter units should never have their 
+   * move rates multiplied. The correct behaviour is to have every tile 
+   * they cross cost 1/3 of a movement point. ---RK */
   move_rate *= 3;
 }
-move_time = WARMAP_COST(ptile) / move_rate;
-break;
- 
-  case SEA_MOVING:
-move_time = WARMAP_SEACOST(ptile) / move_rate;
-break;
- 
-  case HELI_MOVING:
-  case AIR_MOVING:
- move_time = real_map_distance(punit-tile, ptile) 
-   * SINGLE_MOVE / move_rate;
- break;
- 
-  default:
-die(ai/aiunit.c:unit_move_turns: illegal move type %d,
-	get_unit_move_type(unit_type(punit)));
-move_time = 0;
+
+if (get_unit_move_type(unit_type(punit)) == SEA_MOVING) {
+  move_time = WARMAP_SEACOST(ptile) / move_rate;
+} else {
+  move_time = WARMAP_COST(ptile) / move_rate;
+}
   }
   return move_time;
 }
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#37627) [Patch] Remove obsolete is_air_unittype()

2007-03-05 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=37627 

 $subject


 - ML

diff -Nurd -X.diff_ignore freeciv/common/movement.c freeciv/common/movement.c
--- freeciv/common/movement.c	2007-03-06 05:35:14.0 +0200
+++ freeciv/common/movement.c	2007-03-06 06:24:07.0 +0200
@@ -129,15 +129,6 @@
 
 
 /
-  Return TRUE iff this unit type is an air unit type (including missiles).
-/
-bool is_air_unittype(const struct unit_type *punittype)
-{
-  return (get_unit_move_type(punittype) == AIR_MOVING);
-}
-
-
-/
   Return TRUE iff this unit type is a ground/land/normal unit type.
 /
 bool is_ground_unittype(const struct unit_type *punittype)
diff -Nurd -X.diff_ignore freeciv/common/movement.h freeciv/common/movement.h
--- freeciv/common/movement.h	2007-03-06 05:35:14.0 +0200
+++ freeciv/common/movement.h	2007-03-06 06:24:17.0 +0200
@@ -26,7 +26,6 @@
 bool is_air_unit(const struct unit *punit);
 bool is_ground_unit(const struct unit *punit);
 bool is_sailing_unittype(const struct unit_type *punittype);
-bool is_air_unittype(const struct unit_type *punittype);
 bool is_ground_unittype(const struct unit_type *punittype);
 
 bool is_native_tile(const struct unit_type *punittype,
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#37632) [Patch] Unit born turn

2007-03-05 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=37632 

 This stores turn unit has been born to unit structure. Main reason
for this is to get rid of the barbarian fuel hack.

 Another possibility is just to remove barbarian fuel hack. Seems like
it has never worked (before this patch), anyway. Barbarian fuel was
never set. This means it was zero from the very beginning (meaning
that barbarians have minimum lifespan of zero turns)


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aiunit.c freeciv/ai/aiunit.c
--- freeciv/ai/aiunit.c	2007-03-06 05:46:13.0 +0200
+++ freeciv/ai/aiunit.c	2007-03-06 07:06:58.0 +0200
@@ -2080,14 +2080,14 @@
 }
 
 /**
-  Barbarian units may disband spontaneously if their age is more then 5,
-  they are not in cities, and they are far from any enemy units. It is to 
-  remove barbarians that do not engage into any activity for a long time.
+  Barbarian units may disband spontaneously if their age is more than
+  BARBARIAN_MIN_LIFESPAN, they are not in cities, and they are far from
+  any enemy units. It is to remove barbarians that do not engage into any
+  activity for a long time.
 **/
 static bool unit_can_be_retired(struct unit *punit)
 {
-  if (punit-fuel  0) {	/* fuel abused for barbarian life span */
-punit-fuel--;
+  if (punit-born_turn + BARBARIAN_MIN_LIFESPAN  game.info.turn) {
 return FALSE;
   }
 
@@ -2431,7 +2431,8 @@
   } players_iterate_end;
 
   /* Disappearance - 33% chance on coast, when older than barbarian life span */
-  if (is_ocean_near_tile(leader-tile)  leader-fuel == 0) {
+  if (is_ocean_near_tile(leader-tile)
+   leader-born_turn + BARBARIAN_MIN_LIFESPAN  game.info.turn) {
 if(myrand(3) == 0) {
   UNIT_LOG(LOG_DEBUG, leader, barbarian leader disappearing...);
   wipe_unit(leader);
diff -Nurd -X.diff_ignore freeciv/common/unit.c freeciv/common/unit.c
--- freeciv/common/unit.c	2007-03-06 03:34:32.0 +0200
+++ freeciv/common/unit.c	2007-03-06 06:44:22.0 +0200
@@ -1268,6 +1268,7 @@
   punit-foul = FALSE;
   punit-debug = FALSE;
   punit-fuel = unit_type(punit)-fuel;
+  punit-born_turn = game.info.turn;
   punit-hp = unit_type(punit)-hp;
   punit-moves_left = unit_move_rate(punit);
   punit-moved = FALSE;
diff -Nurd -X.diff_ignore freeciv/common/unit.h freeciv/common/unit.h
--- freeciv/common/unit.h	2007-03-05 21:11:49.0 +0200
+++ freeciv/common/unit.h	2007-03-06 06:42:46.0 +0200
@@ -133,6 +133,7 @@
   int unhappiness;
   int upkeep[O_MAX];
   int fuel;
+  int born_turn;
   int bribe_cost;
   struct unit_ai ai;
   enum unit_activity activity;
diff -Nurd -X.diff_ignore freeciv/server/barbarian.h freeciv/server/barbarian.h
--- freeciv/server/barbarian.h	2007-03-05 21:09:47.0 +0200
+++ freeciv/server/barbarian.h	2007-03-06 07:05:14.0 +0200
@@ -27,6 +27,8 @@
 
 #define MAP_FACTOR 2000  /* adjust this to get a good uprising frequency */
 
+#define BARBARIAN_MIN_LIFESPAN 5
+
 bool unleash_barbarians(struct tile *ptile);
 void summon_barbarians(void);
 bool is_land_barbarian(struct player *pplayer);
diff -Nurd -X.diff_ignore freeciv/server/diplomats.c freeciv/server/diplomats.c
--- freeciv/server/diplomats.c	2007-03-06 03:34:32.0 +0200
+++ freeciv/server/diplomats.c	2007-03-06 06:45:27.0 +0200
@@ -461,6 +461,7 @@
   gained_unit-fuel= pvictim-fuel;
   gained_unit-foul= pvictim-foul;
   gained_unit-paradropped = pvictim-paradropped;
+  gained_unit-born_turn   = pvictim-born_turn;
 
   /* Inform owner about less than full fuel */
   send_unit_info(pplayer, gained_unit);
diff -Nurd -X.diff_ignore freeciv/server/savegame.c freeciv/server/savegame.c
--- freeciv/server/savegame.c	2007-03-05 21:09:47.0 +0200
+++ freeciv/server/savegame.c	2007-03-06 07:01:38.0 +0200
@@ -1683,6 +1683,8 @@
 punit-moves_left
   = secfile_lookup_int(file, player%d.u%d.moves, plrno, i);
 punit-fuel = secfile_lookup_int(file, player%d.u%d.fuel, plrno, i);
+punit-born_turn = secfile_lookup_int_default(file, game.info.turn,
+  player%d.u%d.born, plrno, i);
 activity = secfile_lookup_int(file, player%d.u%d.activity, plrno, i);
 if (activity == ACTIVITY_PATROL_UNUSED) {
   /* Previously ACTIVITY_PATROL and ACTIVITY_GOTO were used for
@@ -2922,6 +2924,8 @@
 		plrno, i);
 secfile_insert_int(file, punit-fuel, player%d.u%d.fuel,
 		plrno, i);
+secfile_insert_int(file, punit-born_turn, player%d.u%d.born,
+   plrno, i);
 secfile_insert_int(file, punit-battlegroup,
 		   player%d.u%d.battlegroup, plrno, i);
 
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#37634) [Patch] Fixes to non-air units with fuel

2007-03-05 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=37634 

 This fixes some problems with air units *without* fuel and non-air
units *with* fuel.


 - ML

diff -Nurd -X.diff_ignore freeciv/common/unit.c freeciv/common/unit.c
--- freeciv/common/unit.c	2007-03-06 03:34:32.0 +0200
+++ freeciv/common/unit.c	2007-03-06 07:26:56.0 +0200
@@ -992,7 +992,7 @@
   switch(punit-activity) {
case ACTIVITY_IDLE:
  moves_str = _(Moves);
- if (is_air_unit(punit)  unit_type(punit)-fuel  0) {
+ if (unit_type(punit)-fuel) {
int rate,f;
rate=unit_type(punit)-move_rate/SINGLE_MOVE;
f=((punit-fuel)-1);
diff -Nurd -X.diff_ignore freeciv/server/unittools.c freeciv/server/unittools.c
--- freeciv/server/unittools.c	2007-03-06 03:34:32.0 +0200
+++ freeciv/server/unittools.c	2007-03-06 07:22:12.0 +0200
@@ -348,7 +348,7 @@
 }
 
 /* 4) Rescue planes if needed */
-if (is_air_unit(punit)) {
+if (unit_type(punit)-fuel) {
   /* Shall we emergency return home on the last vapors? */
 
   /* I think this is strongly against the spirit of client goto.
@@ -441,8 +441,7 @@
 
   /* 7) Check if there are air units without fuel */
   unit_list_iterate_safe(pplayer-units, punit) {
-if (is_air_unit(punit)  punit-fuel = 0
- unit_type(punit)-fuel  0) {
+if (punit-fuel = 0  unit_type(punit)-fuel) {
   notify_player(pplayer, punit-tile, E_UNIT_LOST, 
 		   _(Your %s has run out of fuel.),
 		   unit_name(punit-type));
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev