[Freeciv-Dev] (PR#16811) Issue tracking system for Freeciv

2008-12-30 Thread Kevin Benton

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

 [book - Mon Dec 29 08:39:03 2008]:
 
 Here is what needs to happen:
 1. A host for the bug tracker must be found. This is
either a machine someone can install/configure
bugzilla on, or a service hosting bugzilla.
 2. The current RT system needs to be frozen, all
new requests redirected to the new tracker, and
the public bug report address updated everywhere.
 3. Current outstanding tickets and history should be
moved to the new tracker.
 
 The problem has always been 1, since a dedicated
 machine (e.g. in a data center) costs money, or a
 free service is restricted (e.g. in allowed space)
 or missing some key functionality.

I have to ask yet again - though it isn't Bugzilla, has anyone seriously
looked into sourceforge/tigris ?  If not, has anyone considered going to
any of the big hosting companies and see if they'd consider donating
hosting?

 Assuming a solution to the above exists, 2 is hard
 because the only people (person?) with the required
 access to the RT machine is not an active developer
 and/or checks freeciv-dev only infrequently (besides
 probably not having the time to make the changes in
 RT, if that is even possible).

I've done things like this in the past where all that was required was
to replace all the CGI executables in such a way that they simply
redirect the user to the new equivalent program.  For example, when
looking at this issue, the redirect CGI would display a message that the
new location has moved for ten seconds and offer the user the ability to
click to go there faster, or automatically go to
.../show_bug.cgi?bug_id=RT16811 where Bugzilla would automatically
translate from the bug alias to the proper bug ID in the new system.

That is generally extremely easy to do.

 3 is not crucial; I assume there are less than 100
 important open tickets, which can be moved by hand
 as they are handled, and the RT system could be kept
 in read-only mode to make the history available
 (in the minimum-effort scenario).

Importing ticket history is relatively straightforward with Bugzilla. 
Doing that is as simple as adding comments to the appropriate table, and
activity to the activity log.

 If as you said using bugzilla would help encourage
 developer contributions from the community then I am
 strongly for it. This project is in great need of help
 from competent coders to handle bug reports, assist
 less experienced programmers with their ideas, and fix
 the design mistakes that have broken past working
 features (e.g. borders) and are causing new development
 to stagnate.

My experience is that open source projects benefit from transparency
with users and developers.  When it's easy for a wanna-be developer to
look through issue lists, they can often pick something that'll be easy
for them to get their feet wet in contributing.

Bugzilla developers use this very method to mentor new developers -
encouraging new developers to take on small changes to learn how the
Bugzilla development process works and to get to know the new developers
coding style.  Developers mentor new developers through code reviews. 
Once code makes it through a review process, it goes through a similar
approval process then gets published.

I could go on, but I think you get the idea.  It's appropriate to guard
potential security issues from most others, but everything else is
pretty much open game.

KB

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


Re: [Freeciv-Dev] (PR#16811) Issue tracking system for Freeciv

2008-12-30 Thread Brandon J. Van Every

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

On Tue, Dec 30, 2008 at 4:44 AM, Kevin Benton kben...@bentonfam.org wrote:

 My experience is that open source projects benefit from transparency
 with users and developers.  When it's easy for a wanna-be developer to
 look through issue lists, they can often pick something that'll be easy
 for them to get their feet wet in contributing.

Hi, I'm a developer, but not a wannabe.  That is to say, I'm an expert
coder and have used more than one bug tracker in more than one open
source project over the years.  I'm possibly interested in modifying
the Freeciv sources, I'm still evaluating that.  Your choice of bug
tracker has nothing whatsoever to do with my evaluation.  I think
perhaps you're assuming a particular target audience, a newbie or
intermediate level coder who doesn't quite know what they want to do,
that you as more senior developers want to structure and direct
somehow.  There are other kinds of potential project contributors out
there and perhaps considering their motivations and tastes would be of
greater benefit to your ongoing efforts.  I don't see any big deal
with RT because it's not my first instinct to look for someone else's
bug to work on.  My first instincts are to:

1) get the source code built.  If I can't build it, good chance the
project isn't mature and I move on.  I've been able to build Freeciv,
although on Windows it's less pleasurable than it could be.

2) evaluate the readability of the source code.  So far, I find it readable.

3) evaluate the modifiability of the source code.  So far, I'm not
sure the AI code conceptualizes anything the way I would.  My instinct
is to throw chunks of it out.  Either start from scratch, or determine
if a plugin architecture is reasonable.  But, I haven't finished
looking at it, so I will patiently evaluate what is reasonable to do.

4) evaluate the political tone and management of the project.  What do
people really spend their time on?  What do they stew and get to
loggerheads about?  What do they fail to get done?  What do they
actively obstruct?

To the last point: I went back and read the full history of this
ticket.  This has been all talk and no action for 2 years.  In an open
source community, if someone steps forward and provides the elbow
grease to get something done, just go for it.  Maybe RT vs. Bugzilla
isn't super valuable in the scheme of things, as you don't have that
many tickets, or developers willing to work on tickets.  Gosh, have
you ever looked through Mozilla's tickets and seen all the stuff
that's been sitting around for years and years, that again was all
talk and no action?  It's documentation and process for it's own sake,
it has no end result.  BUT, if you've got a gung ho volunteer who
actually will steward a new bug tracker, it's worth something just to
add that guy's ongoing manpower to the project.  I imagine Bugzilla
*is* better than RT in some fashion, that some kind of gain can be
made from changing, even if it is only a long term incremental gain.
The more important consideration is you get this guy working on the
project, stewarding something he considers Good.  That's how you build
project loyalty.

Resources, schmesources.  Don't any of you guys have a back pocket?
For cheapskates, I Googled a little.  What about these guys?
http://teamforge.net/


Cheers,
Brandon Van Every



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


Re: [Freeciv-Dev] freeciv 2.1.8

2008-12-30 Thread Per Inge Mathisen
On Tue, Dec 30, 2008 at 4:06 AM, Auel Neider auelneide...@gmail.com wrote:
 hi, im very like with your game. but unfortunately, freeciv 2.1.8 made my
 system crashed. im using mandriva 2009.0 and i downloaded freeciv from
 official source (RPM). the crashed system happened after i played for hours,
 when the crash almost same with when you logged out (x server restarted),
 then want to log in again, its happen repeatedly so i have no choice than to
 ¨hard-shutdown¨ it. then i played the autosave again. one day my system cant
 recover after the crash so it wont boot. i reinstall my system again. so i
 would be pleased if this dont happened again. tx for your attention.

It seems rather unlikely that Freeciv would have anything to do with
such a crash. The window system and the kernel would not permit
Freeciv to take down the rest of the system in the event of a failure
inside Freeciv itself. The only issue could be if you play in
fullscreen mode, and somehow it gets stuck in that state in the event
of an error, but I do not know much about that since I never play in
fullscreen mode.

  - Per

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


Re: [Freeciv-Dev] freeciv 2.1.8

2008-12-30 Thread Brandon Van Every
On Tue, Dec 30, 2008 at 7:41 AM, Per Inge Mathisen
per.mathi...@gmail.com wrote:
 On Tue, Dec 30, 2008 at 4:06 AM, Auel Neider auelneide...@gmail.com wrote:
 hi, im very like with your game. but unfortunately, freeciv 2.1.8 made my
 system crashed. im using mandriva 2009.0

 It seems rather unlikely that Freeciv would have anything to do with
 such a crash. The window system and the kernel would not permit
 Freeciv to take down the rest of the system in the event of a failure
 inside Freeciv itself. The only issue could be if you play in
 fullscreen mode, and somehow it gets stuck in that state in the event
 of an error, but I do not know much about that since I never play in
 fullscreen mode.

I disagree.  Freeciv 2.1.8 windowed GTK client froze me out of my
Windows Vista system the other day, while playing multiplayer.  Mouse
pointer simply stopped responding.  I was shocked.  I had to hard
reboot.  I have no other history of freezes on my system.  Could it be
some kind of GTK deadlock?

Other thing that happens in GTK, with 100% predictability, is after
it's been running a long time the GUI windows start painting garbage.
About 10 seconds later the app freezes.  Vista terminates this just
fine, it's pretty much gotten to be a routine.  I have no exact
reproducer for the problem though, so I haven't filed a bug report.
Something is definitely unhealthy in GTK land though.  Some kind of
resource leak.


Cheers,
Brandon Van Every

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


Re: [Freeciv-Dev] freeciv 2.1.8

2008-12-30 Thread Jordi Negrevernis i Font

En/na Auel Neider ha escrit:
 hi, im very like with your game. 
?
 but unfortunately, freeciv 2.1.8 made my system crashed. im using 
 mandriva 2009.0 and i downloaded freeciv from official source (RPM). 
 the crashed system happened after i played for hours, when the crash 
 almost same with when you logged out (x server restarted), then want 
 to log in again, its happen repeatedly so i have no choice than to 
 ¨hard-shutdown¨ it. then i played the autosave again. one day my 
 system cant recover after the crash so it wont boot. i reinstall my 
 system again. so i would be pleased if this dont happened again. tx 
 for your attention.
Sorry, i really doubt that freeciv could crash your system... in 
fact, it crashes very often but not the whole system... ;-)

Either your OS has some serious problems or you have faulty hardware...

Thanks


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


[Freeciv-Dev] (PR#40612) Patch: migration

2008-12-30 Thread Madeline Book

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

 [matthias.pfaffer...@mapfa.de - Tue Dec 30 21:34:34 2008]:
 
 here is an updated version of the patch.

Unfortunately I just made adjustements to you previous
patch today, and was about to post the updated version
when I noticed you already did. :(

Anyway, please at least read over the code in the file
migrate_v3.patch and make sure your patch follows the
same style. Maybe integrate some of the ideas in it,
such as a setting to control the number of turns
between migrations (perhaps better than the hard-coded
5).

In particular:
- No lines longer than 76 characters + 1 newline.
- Multi-line function arguments lined up to column one
  past the initial '(' and similarly for if-statements.
- Use city_tile(pcity) instead of pcity-tile, and similar.
- Use LOG_DEBUG not LOG_NORMAL for debugging messages.
- Use is_capital(pcity) directly instead of find_palace().
- Use const in function arguments if the function
  does not modify the arguments (e.g. the score function).
- Make the default setting values disable migration.

I also wonder if there could arise a situation where
migration happens from city A to city B, and then back
again from city B to city A, because A happened to be
before B in the city list. Perhaps the migration score
should first be calculated for all possible source
and destination cities, then the migrations actually
performed?


Anyway I'll check it again in at least a few days and
when I'm sure you are not working on it too. ;)


---
私の人生は大移住の話から始まります。
 common/game.c  |1 +
 common/game.h  |4 ++
 common/packets.def |1 +
 server/cityturn.c  |  135 
 server/cityturn.h  |3 +
 server/savegame.c  |4 ++
 server/settings.c  |   13 +
 server/srv_main.c  |7 +++
 8 files changed, 168 insertions(+), 0 deletions(-)

diff --git a/common/game.c b/common/game.c
index f0d4378..0d5bfab 100644
--- a/common/game.c
+++ b/common/game.c
@@ -275,6 +275,7 @@ void game_init(void)
   game.info.celebratesize = GAME_DEFAULT_CELEBRATESIZE;
   game.info.savepalace= GAME_DEFAULT_SAVEPALACE;
   game.info.natural_city_names = GAME_DEFAULT_NATURALCITYNAMES;
+  game.info.migration = GAME_DEFAULT_MIGRATION;
   game.info.angrycitizen  = GAME_DEFAULT_ANGRYCITIZEN;
   game.info.foodbox   = GAME_DEFAULT_FOODBOX;
   game.info.shieldbox = GAME_DEFAULT_SHIELDBOX;
diff --git a/common/game.h b/common/game.h
index 4e75ece..f593bf2 100644
--- a/common/game.h
+++ b/common/game.h
@@ -250,6 +250,10 @@ bool setting_class_is_changeable(enum sset_class class);
 
 #define GAME_DEFAULT_NATURALCITYNAMES TRUE
 
+#define GAME_DEFAULT_MIGRATION   0
+#define GAME_MIN_MIGRATION   0
+#define GAME_MAX_MIGRATION   100
+
 #define GAME_DEFAULT_AQUEDUCTLOSS0
 #define GAME_MIN_AQUEDUCTLOSS0
 #define GAME_MAX_AQUEDUCTLOSS100
diff --git a/common/packets.def b/common/packets.def
index 8455fda..a00a2c4 100644
--- a/common/packets.def
+++ b/common/packets.def
@@ -414,6 +414,7 @@ PACKET_GAME_INFO=15; sc
   UINT8 razechance;
   BOOL savepalace;
   BOOL natural_city_names;
+  UINT8 migration;
   BOOL turnblock;
   BOOL fixedlength;
   BOOL auto_ai_toggle;
diff --git a/server/cityturn.c b/server/cityturn.c
index b860a5e..412eddc 100644
--- a/server/cityturn.c
+++ b/server/cityturn.c
@@ -1867,3 +1867,138 @@ static bool disband_city(struct city *pcity)
   remove_city(pcity);
   return TRUE;
 }
+
+/***
+  Helper function to find the migration desirability of a city. The higher
+  the score the more likely citizens will migrate to it.
+
+  The score depends on the total trade and shield output of the city, its
+  size, number of ocean squares around it, and the shield cost of all the
+  improvements in the city. The score is doubled for the player's capital
+  city (the one containing the palace small wonder).
+***/
+static int city_migration_score(const struct city *pcity)
+{
+  int score = 0;
+
+  if (!pcity) {
+return 0;
+  }
+
+  score = pcity-prod[O_TRADE] + pcity-prod[O_SHIELD];
+  score += 10 * pcity-size;
+  square_iterate(city_tile(pcity), 2, ptile) {
+if (is_ocean(tile_terrain(ptile))) {
+  score += 2;
+}
+  } square_iterate_end;
+
+  city_built_iterate(pcity, pimprove) {
+score += impr_build_shield_cost(pimprove) * 2;
+  } city_built_iterate_end;
+
+  if (find_palace(city_owner(pcity)) == pcity) {
+score *= 2;
+  }
+
+  return score;
+}
+
+/**
+  Do the migrations between the cities that overlap. Migrants go to the
+  city with higher city_migration_score(), if the growth of the target
+  city is not blocked due to a missing improvement.
+
+  The setting 

Re: [Freeciv-Dev] (PR#40612) updated patch

2008-12-30 Thread Matthias Pfafferodt

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

Hello all,

here is an updated version of the patch. The changes are

* I added 3 configuration options

game.info.migrationdist:
- distance for migration (largest value)

game.info.migrationplayer:
- chance for migration within one nation

game.info.migrationworld:
- chance for migration between nations


* the score for the cities is calculated as

   score = (city size + feeling) * factors

with 'feeling' as measurement for the attitude of the citizens
   feelings = 1.00 * happy citizens
 + 0.00 * content citizens
 - 0.25 * unhappy citizens
 - 0.50 * unhappy citizens

and the factors take into account the buildings as well as the surplus of the 
city
   * the build costs of all buildings
 f = (1.0 + [build shield cost]/1000)
   * the trade of the city
 f = (1 + [city surplus trade]/100)
   * the gold within the city
 f = (1 + [city surplus gold]/100)
   * the luxury within the city
 f = (1 + [city surplus luxury]/100)
   * the science within the city
 f = (1 + [city surplus science]/100)


For the Migration between two cities their score is modified. If the migrants 
go from city A to city B the following values are calculated

* for city A take into account the persistence factor (=2)
A = score A * 2

* for city B take into account the distance between both cities
B = score B * (MIGRATION_MAX_DIST - distance A-B) / MIGRATION_MAX_DIST
with MIGRATION_MAX_DIST = 7

If A  B some citizens will migrate from city A to city B. If city A has a 
size of 1 it will be disbanded. This will _not_ happen if it is the last city 
of a nation. Also citizens will never migrate out of the capital.

It game.info.migrationdist is equal to 0 migration will be disabled.

Have a nice time

Matthias

diff -ur -X./freeciv-2.1.99svn15387/diff_ignore freeciv-2.1.99svn15387/common/game.c freeciv-2.1.99svn.patch/common/game.c
--- freeciv-2.1.99svn15387/common/game.c	2008-12-25 19:45:44.0 +0100
+++ freeciv-2.1.99svn.patch/common/game.c	2008-12-30 19:04:41.0 +0100
@@ -275,6 +275,9 @@
   game.info.celebratesize = GAME_DEFAULT_CELEBRATESIZE;
   game.info.savepalace= GAME_DEFAULT_SAVEPALACE;
   game.info.natural_city_names = GAME_DEFAULT_NATURALCITYNAMES;
+  game.info.migrationdist = GAME_DEFAULT_MIGRATION_DIST;
+  game.info.migrationworld = GAME_DEFAULT_MIGRATION_WORLD;
+  game.info.migrationplayer = GAME_DEFAULT_MIGRATION_PLAYER;
   game.info.angrycitizen  = GAME_DEFAULT_ANGRYCITIZEN;
   game.info.foodbox   = GAME_DEFAULT_FOODBOX;
   game.info.shieldbox = GAME_DEFAULT_SHIELDBOX;
diff -ur -X./freeciv-2.1.99svn15387/diff_ignore freeciv-2.1.99svn15387/common/game.h freeciv-2.1.99svn.patch/common/game.h
--- freeciv-2.1.99svn15387/common/game.h	2008-12-25 19:45:44.0 +0100
+++ freeciv-2.1.99svn.patch/common/game.h	2008-12-30 21:38:38.0 +0100
@@ -248,6 +248,18 @@
 
 #define GAME_DEFAULT_NATURALCITYNAMES TRUE
 
+#define GAME_DEFAULT_MIGRATION_DIST   4
+#define GAME_MIN_MIGRATION_DIST   0 /* 0 = no migration */
+#define GAME_MAX_MIGRATION_DIST   7
+
+#define GAME_DEFAULT_MIGRATION_PLAYER 70
+#define GAME_MIN_MIGRATION_PLAYER0
+#define GAME_MAX_MIGRATION_PLAYER100
+
+#define GAME_DEFAULT_MIGRATION_WORLD 10
+#define GAME_MIN_MIGRATION_WORLD 0
+#define GAME_MAX_MIGRATION_WORLD 100
+
 #define GAME_DEFAULT_AQUEDUCTLOSS0
 #define GAME_MIN_AQUEDUCTLOSS0
 #define GAME_MAX_AQUEDUCTLOSS100
diff -ur -X./freeciv-2.1.99svn15387/diff_ignore freeciv-2.1.99svn15387/common/packets.def freeciv-2.1.99svn.patch/common/packets.def
--- freeciv-2.1.99svn15387/common/packets.def	2008-12-27 17:25:16.0 +0100
+++ freeciv-2.1.99svn.patch/common/packets.def	2008-12-30 19:01:07.0 +0100
@@ -414,6 +414,9 @@
   UINT8 razechance;
   BOOL savepalace;
   BOOL natural_city_names;
+  UINT8 migrationdist;
+  UINT8 migrationplayer;
+  UINT8 migrationworld;
   BOOL turnblock;
   BOOL fixedlength;
   BOOL auto_ai_toggle;
diff -ur -X./freeciv-2.1.99svn15387/diff_ignore freeciv-2.1.99svn15387/server/cityturn.c freeciv-2.1.99svn.patch/server/cityturn.c
--- freeciv-2.1.99svn15387/server/cityturn.c	2008-12-25 19:45:49.0 +0100
+++ freeciv-2.1.99svn.patch/server/cityturn.c	2008-12-30 22:16:17.0 +0100
@@ -1867,3 +1867,303 @@
   remove_city(pcity);
   return TRUE;
 }
+
+/**
+ Helpful function to make a score of a city.
+
+ formula:
+   score = (city size + feeling) * factors
+
+ * feeling of the citizens
+ + 1.00 * happy citizens
+ + 0.00 * content citizens
+ - 0.25 * unhappy citizens
+ - 0.50 * unhappy citizens
+
+ * factors
+   * the build costs of all buildings
+ f = (1.0 + [build shield cost]/1000)
+   * the trade of the city
+ f = (1 + [city surplus trade]/100)
+   * the gold within the city
+ f = (1 + [city surplus gold]/100)
+   * the luxury within the 

Re: [Freeciv-Dev] (PR#40612) updated patch

2008-12-30 Thread Matthias Pfafferodt

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

Hello all,

missed to small changes (city_refresh = city_refresh_vision)

Matthias

diff -ur -X./freeciv-2.1.99svn15387/diff_ignore freeciv-2.1.99svn15387/common/game.c freeciv-2.1.99svn.patch/common/game.c
--- freeciv-2.1.99svn15387/common/game.c	2008-12-25 19:45:44.0 +0100
+++ freeciv-2.1.99svn.patch/common/game.c	2008-12-30 19:04:41.0 +0100
@@ -275,6 +275,9 @@
   game.info.celebratesize = GAME_DEFAULT_CELEBRATESIZE;
   game.info.savepalace= GAME_DEFAULT_SAVEPALACE;
   game.info.natural_city_names = GAME_DEFAULT_NATURALCITYNAMES;
+  game.info.migrationdist = GAME_DEFAULT_MIGRATION_DIST;
+  game.info.migrationworld = GAME_DEFAULT_MIGRATION_WORLD;
+  game.info.migrationplayer = GAME_DEFAULT_MIGRATION_PLAYER;
   game.info.angrycitizen  = GAME_DEFAULT_ANGRYCITIZEN;
   game.info.foodbox   = GAME_DEFAULT_FOODBOX;
   game.info.shieldbox = GAME_DEFAULT_SHIELDBOX;
diff -ur -X./freeciv-2.1.99svn15387/diff_ignore freeciv-2.1.99svn15387/common/game.h freeciv-2.1.99svn.patch/common/game.h
--- freeciv-2.1.99svn15387/common/game.h	2008-12-25 19:45:44.0 +0100
+++ freeciv-2.1.99svn.patch/common/game.h	2008-12-30 21:38:38.0 +0100
@@ -248,6 +248,18 @@
 
 #define GAME_DEFAULT_NATURALCITYNAMES TRUE
 
+#define GAME_DEFAULT_MIGRATION_DIST   4
+#define GAME_MIN_MIGRATION_DIST   0 /* 0 = no migration */
+#define GAME_MAX_MIGRATION_DIST   7
+
+#define GAME_DEFAULT_MIGRATION_PLAYER 70
+#define GAME_MIN_MIGRATION_PLAYER0
+#define GAME_MAX_MIGRATION_PLAYER100
+
+#define GAME_DEFAULT_MIGRATION_WORLD 10
+#define GAME_MIN_MIGRATION_WORLD 0
+#define GAME_MAX_MIGRATION_WORLD 100
+
 #define GAME_DEFAULT_AQUEDUCTLOSS0
 #define GAME_MIN_AQUEDUCTLOSS0
 #define GAME_MAX_AQUEDUCTLOSS100
diff -ur -X./freeciv-2.1.99svn15387/diff_ignore freeciv-2.1.99svn15387/common/packets.def freeciv-2.1.99svn.patch/common/packets.def
--- freeciv-2.1.99svn15387/common/packets.def	2008-12-27 17:25:16.0 +0100
+++ freeciv-2.1.99svn.patch/common/packets.def	2008-12-30 19:01:07.0 +0100
@@ -414,6 +414,9 @@
   UINT8 razechance;
   BOOL savepalace;
   BOOL natural_city_names;
+  UINT8 migrationdist;
+  UINT8 migrationplayer;
+  UINT8 migrationworld;
   BOOL turnblock;
   BOOL fixedlength;
   BOOL auto_ai_toggle;
diff -ur -X./freeciv-2.1.99svn15387/diff_ignore freeciv-2.1.99svn15387/server/cityturn.c freeciv-2.1.99svn.patch/server/cityturn.c
--- freeciv-2.1.99svn15387/server/cityturn.c	2008-12-25 19:45:49.0 +0100
+++ freeciv-2.1.99svn.patch/server/cityturn.c	2008-12-30 22:56:57.0 +0100
@@ -1867,3 +1867,303 @@
   remove_city(pcity);
   return TRUE;
 }
+
+/**
+ Helpful function to make a score of a city.
+
+ formula:
+   score = (city size + feeling) * factors
+
+ * feeling of the citizens
+ + 1.00 * happy citizens
+ + 0.00 * content citizens
+ - 0.25 * unhappy citizens
+ - 0.50 * unhappy citizens
+
+ * factors
+   * the build costs of all buildings
+ f = (1.0 + [build shield cost]/1000)
+   * the trade of the city
+ f = (1 + [city surplus trade]/100)
+   * the gold within the city
+ f = (1 + [city surplus gold]/100)
+   * the luxury within the city
+ f = (1 + [city surplus luxury]/100)
+   * the science within the city
+ f = (1 + [city surplus science]/100)
+**/
+static float city_score(struct city *pcity)
+{
+  float score = 0.0;
+  float feeling = 0.0;
+  float f_build_cost, f_trade, f_gold, f_luxury, f_science = 0.0;
+  int build_shield_cost = 0;
+
+  /* feeling of the citizens */
+  feeling = 1.00 * pcity-feel[CITIZEN_HAPPY][FEELING_FINAL]
+  + 0.00 * pcity-feel[CITIZEN_CONTENT][FEELING_FINAL]
+  - 0.25 * pcity-feel[CITIZEN_UNHAPPY][FEELING_FINAL]
+  - 0.50 * pcity-feel[CITIZEN_ANGRY][FEELING_FINAL];
+
+  /* take shild costs of all buidings into account */
+  city_built_iterate(pcity, pimprove) {
+build_shield_cost += impr_build_shield_cost(pimprove);
+  } city_built_iterate_end;
+  f_build_cost = (1.0 + (float)build_shield_cost/1000);
+  /* take trade into account */
+  f_trade  = (1.0 + (float)pcity-surplus[O_TRADE]/100);
+  /* take gold into account */
+  f_gold   = (1.0 + (float)pcity-surplus[O_GOLD]/100);
+  /* take luxury into account */
+  f_luxury = (1.0 + (float)pcity-surplus[O_LUXURY]/100);
+  /* take science into account */
+  f_science= (1.0 + (float)pcity-surplus[O_SCIENCE]/100);
+
+  score = (pcity-size + feeling) * f_build_cost * f_trade * f_gold
+  * f_luxury * f_science;
+
+  freelog(LOG_DEBUG, [M] %s score: (%d + %6.3f) * (%5.3f * %5.3f 
+  * %5.3f * %5.3f * %5.3f) = %6.3f,
+  city_name(pcity), pcity-size, feeling,
+  f_build_cost, f_trade, f_gold,