[Freeciv-Dev] (PR#40617) Assertion with RiverNative flag
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40617 Hi, On the trunk, when giving the trireme RiverNative flag, the game forces us to change it's movement type to Both in order of it to work. But doing so cause a in advmilitary.c. The backtrace: civserver: advmilitary.c:1183: kill_something_with: Assertion `SEA_MOVING == utype_move_type(boattype)' failed. Program received signal SIGABRT, Aborted. 0x7feec1c313c5 in raise () from /lib/libc.so.6 (gdb) backtrace #0 0x7feec1c313c5 in raise () from /lib/libc.so.6 #1 0x7feec1c3273e in abort () from /lib/libc.so.6 #2 0x7feec1c2ab1f in __assert_fail () from /lib/libc.so.6 #3 0x004c415c in kill_something_with (pplayer=0x898100, pcity=0x1bd2b40, myunit=0x1bcecb0, choice=0x1bd38e0) at advmilitary.c:1183 #4 0x004c437a in military_advisor_choose_build (pplayer=0x898100, pcity=0x1bd2b40, choice=0x1bd38e0) at advmilitary.c:1512 #5 0x004ccb33 in ai_manage_cities (pplayer=0x898100) at aicity.c:1754 #6 0x004d1942 in ai_do_last_activities (pplayer=0x898100) at aihand.c:460 #7 0x0046d64d in srv_running () at srv_main.c:795 #8 0x0046dc86 in srv_main () at srv_main.c:2259 #9 0x00404236 in main (argc=3, argv=0x7fffca829328) at civserver.c:283 The AI exepcts the transport to be a boat, moving over seas. Is this check really neccesary? Should we check if the suggested unit can reach the target unit some other way, or at least check that the movement type is not land? ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] music
On Fri, Jan 2, 2009 at 12:15 AM, Brandon Van Every bvanev...@gmail.com wrote: I was made aware of various FTP resources. I noticed there's a ftp://ftp.freeciv.org/freeciv/contrib/audio/music/ directory with a lot of tunes that I've never heard in a Freeciv game. Were these intended to get into the game somehow? What happened? The various artists never finished a complete series of tunes for the ages, and I never wrote the music manager code as I had planned (and never will). - Per ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] debugging with Eclipse on Windows
On Fri, Jan 2, 2009 at 12:06 AM, Brandon Van Every bvanev...@gmail.com wrote: SPECLIST has still got me stuck. Blah VC9 C requires __inline Cheers, Brandon Van Every ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] Patch: Generalizing bonus such F_HORSE vs. F_PIKEMEN
The reason I have not written similar patch is that it would require too many unit classes to be practical. You didn't include ruleset changes to your patch, but if you do those properly you will notice how much duplicate entries you have to write (if you have classes Horses, Pikemen and Land, you need to include similar effects for all three classes in effects.ruleset). It would be a bit better if you target unit types instead of unit classes, but then we have hardcoded limit of four types to have bonuses against. Hmm... Actually that limit might be quite bad for class based approach too - if number of classes explodes like Land + Horses + Pikemen, you need three slots just for land moving units. Anyway, these things need to be generalized (there's old ticket about this somewhere, possibly with additional info) so I would very much like to see somehow improved version of this patch. 2009/1/2 Yoav Luft: B. The code on helpdata.c does not work, it always see NULL pointers, altough everywhere else it doesn't happen. Help is in client side while all the other code you touch is in server side. You need to change network protocol and to send this new information to client side as well. - ML ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#40617) Assertion with RiverNative flag
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40617 2009/1/2 Yoav Luft: On the trunk, when giving the trireme RiverNative flag, the game forces us to change it's movement type to Both in order of it to work. But doing so cause a in advmilitary.c. The backtrace: civserver: advmilitary.c:1183: kill_something_with: Assertion `SEA_MOVING == utype_move_type(boattype)' failed. Interesting. It seems like this has been broken always, and not only since riverboats were introduced. IIRC AI should not even consider using transports other than sea moving. (LAND_MOVING transports would make no sense at all to ferryboat code). The AI exepcts the transport to be a boat, moving over seas. Is this check really neccesary? Should we check if the suggested unit can reach the target unit some other way, I'm afraid other parts of AI code couldn't handle such a generic case, so... or at least check that the movement type is not land? ...this sounds like a most sensible solution. I think I have already converted some other similar assertions to this form (hmm... maybe I have caused this particular assertion by allowing Both moving units to reach this point of code...) - ML ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] compilers that aren't C99
I've got some of a Microsoft Visual Studio 2008 build of Freeciv working. I've run into an impediment, however: VC9 does not support variable length arrays. http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=333273 VLAs are part of the C99 standard, so you can say Microsoft is the bad guy here. My question is whether you're willing to support the bad guy's compiler. Or, put another way, compilers that aren't GCC and aren't C99. I could make all the needed changes, but there would be little point if they won't ever be accepted. Cheers, Brandon Van Every ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#40612) Patch: migration
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40612 Am Friday 02 January 2009 07:08:22 schrieb Madeline Book: URL: http://bugs.freeciv.org/Ticket/Display.html?id=40612 Most of the time I just put in printfs for debugging and remove them later. ;) This is also possible; I think it is the easiest way to get some debugging output ... The attached version 5 of the migration patch has the following changes: * check for wonders (higher score; never disband a city with a wonder) * reduced messages to the player (some text was not usefull at all) * use LOG_VERBOSE Matthias diff -ur -X./freeciv-2.1.99svn15391/diff_ignore freeciv-2.1.99svn15391/common/game.c freeciv-2.1.99svn.patch_migration/common/game.c --- freeciv-2.1.99svn15391/common/game.c 2008-12-25 19:45:44.0 +0100 +++ freeciv-2.1.99svn.patch_migration/common/game.c 2008-12-31 16:37:12.0 +0100 @@ -275,6 +275,10 @@ game.info.celebratesize = GAME_DEFAULT_CELEBRATESIZE; game.info.savepalace= GAME_DEFAULT_SAVEPALACE; game.info.natural_city_names = GAME_DEFAULT_NATURALCITYNAMES; + game.info.migrationturn = GAME_DEFAULT_MIGRATION_TURN; + 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.99svn15391/diff_ignore freeciv-2.1.99svn15391/common/game.h freeciv-2.1.99svn.patch_migration/common/game.h --- freeciv-2.1.99svn15391/common/game.h 2008-12-30 23:29:33.0 +0100 +++ freeciv-2.1.99svn.patch_migration/common/game.h 2008-12-31 17:39:10.0 +0100 @@ -250,6 +250,22 @@ #define GAME_DEFAULT_NATURALCITYNAMES TRUE +#define GAME_DEFAULT_MIGRATION_TURN 0 /* 0 = no migration */ +#define GAME_MIN_MIGRATION_TURN 0 +#define GAME_MAX_MIGRATION_TURN 100 + +#define GAME_DEFAULT_MIGRATION_DIST 3 +#define GAME_MIN_MIGRATION_DIST 1 +#define GAME_MAX_MIGRATION_DIST 7 + +#define GAME_DEFAULT_MIGRATION_PLAYER 50 +#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.99svn15391/diff_ignore freeciv-2.1.99svn15391/common/packets.def freeciv-2.1.99svn.patch_migration/common/packets.def --- freeciv-2.1.99svn15391/common/packets.def 2008-12-30 23:29:33.0 +0100 +++ freeciv-2.1.99svn.patch_migration/common/packets.def 2008-12-31 16:37:16.0 +0100 @@ -414,6 +414,10 @@ UINT8 razechance; BOOL savepalace; BOOL natural_city_names; + UINT8 migrationturn; + UINT8 migrationdist; + UINT8 migrationplayer; + UINT8 migrationworld; BOOL turnblock; BOOL fixedlength; BOOL auto_ai_toggle; diff -ur -X./freeciv-2.1.99svn15391/diff_ignore freeciv-2.1.99svn15391/server/cityturn.c freeciv-2.1.99svn.patch_migration/server/cityturn.c --- freeciv-2.1.99svn15391/server/cityturn.c 2008-12-25 19:45:49.0 +0100 +++ freeciv-2.1.99svn.patch_migration/server/cityturn.c 2009-01-02 03:54:53.0 +0100 @@ -90,6 +90,12 @@ static void update_city_activity(struct player *pplayer, struct city *pcity); static void nullify_caravan_and_disband_plus(struct city *pcity); +static float city_score(const struct city *pcity); +static bool make_city_migration(const struct player *pplayer_from, +struct city *pcity_from, +const struct player *pplayer_to, +struct city *pcity_to); + /** ... **/ @@ -1867,3 +1873,363 @@ remove_city(pcity); return TRUE; } + +/*** + Helper function to calculate a score of a city. It indicates the + migration desirability of the city. The higher the score the more likely + citizens will migrate to it. + + The score depends on the city size, the feeling of its citizens and the + surplus of trade, luxury and science. + + formula: +score = ([city size] + feeling) * factors + + * feeling of the citizens +feeling = 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 + (1 - exp(-[build shield cost]/1000))/5) +* the trade of the city + f = (1 + (1 - exp(-[city surplus trade]/100))/5) +* the luxury within the city + f = (1 + (1 - exp(-[city surplus luxury]/100))/5) +* the
Re: [Freeciv-Dev] compilers that aren't C99
We made the decision a few years ago to support some of the features of C99, with a check for each. Variable-length arrays was one of them, and a very useful one in a lot of the code it's used in. I don't think we should go back. -jason ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] compilers that aren't C99
2009/1/2 Brandon Van Every: I've got some of a Microsoft Visual Studio 2008 build of Freeciv working. I've run into an impediment, however: VC9 does not support variable length arrays. http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=333273 VLAs are part of the C99 standard, so you can say Microsoft is the bad guy here. My question is whether you're willing to support the bad guy's compiler. Or, put another way, compilers that aren't GCC and aren't C99. I could make all the needed changes, but there would be little point if they won't ever be accepted. I have been told that VisualStudio lacks several C99 features (and has incompatible implementation for some, I believe) simply because it's not even meant to be C compiler. It's an C++ compiler. - ML ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] compilers that aren't C99
On Fri, Jan 2, 2009 at 3:08 PM, Marko Lindqvist cazf...@gmail.com wrote: I have been told that VisualStudio lacks several C99 features (and has incompatible implementation for some, I believe) simply because it's not even meant to be C compiler. It's an C++ compiler. I don't think meant to be is quite the right turn of phrase, since it is a C compiler. Rather, as noted in that wontfix notice, Microsoft feels that its customers are C++ centric. So they put their development resources into that, and not C99. I must admit, C++ having far more users than C is an argument with some weight. Especially in the game industry: C is done for some things, but C++ is the primary resume skill. You may not care about resume skills around here, but a lot of people feel that kind of justification is important for what projects they work on. I have wondered how Freeciv is strictly C might impede developer retention. One could argue that GNU is C centric, being obsessed with the ability to bring up programs on all systems, no matter how obscure. Also, most advanced languages that are not C++, like Scheme or Lisp or OCaml or whatnot, have a much easier time talking to C. Cheers, Brandon Van Every ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#40620) fortress vanished after save/load
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40620 see engineer near Vigo; after that turn the fortress will be build save the game and reload it - no fortress (it is a network game) civgame-0625.sav.bz2 Description: BZip2 compressed data ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#40619) gold upkeep
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40619 This patch gives the possibility to take the gold for the units from the overall finances _after_ all cities have added their gold surplus. There is a ruleset parameters used to describe the economic system 0: gold upkeep for buildings and units has to be paid by the city 1: gold upkeep for buildings and units comes from the overall finances (default is economicsystem = 0 = old system) For the old system it is done for each city: 1. get the gold needed for all improvements 2. get the gold needed for all units 3. check if there is enough gold 4. if not, sell buildings 5. if not, disband units which need gold upkeep For the new system it is changed as 1. iterate over all cities 1.1 get the gold needed for all improvements 1.2. get the gold needed for all units 2. check if there is enough gold 3. if not, sell buildings (randomly chosen) 4. if not, disband units which need gold upkeep It is possible to add economic systems in-between: only pay for the buildings or unit from the overall finances, ... the freeciv-svn15391-shuffle.patch is needed for this patch. diff -ur -X./freeciv-2.1.99svn15391/diff_ignore freeciv-2.1.99svn15931/common/game.h freeciv-2.1.99svn.patch_gold/common/game.h --- freeciv-2.1.99svn15931/common/game.h 2008-12-30 23:29:33.0 +0100 +++ freeciv-2.1.99svn.patch_gold/common/game.h 2009-01-02 21:14:42.0 +0100 @@ -183,6 +183,10 @@ #define GAME_MIN_AIFILL 0 #define GAME_MAX_AIFILL GAME_MAX_MAX_PLAYERS +#define GAME_DEFAULT_ECONOMIC_SYSTEM 0 +#define GAME_MIN_ECONOMIC_SYSTEM 1 +#define GAME_MAX_ECONOMIC_SYSTEM 2 + #define GAME_DEFAULT_FOODBOX 100 #define GAME_MIN_FOODBOX 1 #define GAME_MAX_FOODBOX 1 diff -ur -X./freeciv-2.1.99svn15391/diff_ignore freeciv-2.1.99svn15931/common/packets.def freeciv-2.1.99svn.patch_gold/common/packets.def --- freeciv-2.1.99svn15931/common/packets.def 2008-12-30 23:29:33.0 +0100 +++ freeciv-2.1.99svn.patch_gold/common/packets.def 2009-01-02 21:14:43.0 +0100 @@ -389,6 +389,7 @@ UINT8 diplcost, freecost, conquercost; UINT8 angrycitizen; UINT8 techpenalty; + UINT8 economicsystem; UINT32 foodbox; UINT32 shieldbox; UINT32 sciencebox; diff -ur -X./freeciv-2.1.99svn15391/diff_ignore freeciv-2.1.99svn15931/data/civ1/game.ruleset freeciv-2.1.99svn.patch_gold/data/civ1/game.ruleset --- freeciv-2.1.99svn15931/data/civ1/game.ruleset 2008-12-30 23:29:34.0 +0100 +++ freeciv-2.1.99svn.patch_gold/data/civ1/game.ruleset 2009-01-02 21:26:10.0 +0100 @@ -56,6 +56,11 @@ ; Fallout - Nuclear Fallout (distinct from industrial/population). nuke_contamination = Pollution +; Parameters used to describe the economic system +; 0: gold upkeep for buildings and units has to be paid by the city +; 1: gold upkeep for buildings and units comes from the overall finances +economicsystem = 0 + ; Parameters used to generalize the calculation of city granary size: ; if city_size = num_inis: ; city_granary_size = (granary_food_ini[city_size] * foodbox / 100) diff -ur -X./freeciv-2.1.99svn15391/diff_ignore freeciv-2.1.99svn15931/data/civ2/game.ruleset freeciv-2.1.99svn.patch_gold/data/civ2/game.ruleset --- freeciv-2.1.99svn15931/data/civ2/game.ruleset 2008-12-30 23:29:34.0 +0100 +++ freeciv-2.1.99svn.patch_gold/data/civ2/game.ruleset 2009-01-02 21:26:09.0 +0100 @@ -50,6 +50,11 @@ ; Fallout - Nuclear Fallout (distinct from industrial/population). nuke_contamination = Pollution +; Parameters used to describe the economic system +; 0: gold upkeep for buildings and units has to be paid by the city +; 1: gold upkeep for buildings and units comes from the overall finances +economicsystem = 0 + ; Parameters used to generalize the calculation of city granary size: ; if city_size = num_inis: ; city_granary_size = (granary_food_ini[city_size] * foodbox / 100) diff -ur -X./freeciv-2.1.99svn15391/diff_ignore freeciv-2.1.99svn15931/data/default/game.ruleset freeciv-2.1.99svn.patch_gold/data/default/game.ruleset --- freeciv-2.1.99svn15931/data/default/game.ruleset 2008-12-30 23:29:34.0 +0100 +++ freeciv-2.1.99svn.patch_gold/data/default/game.ruleset 2009-01-02 21:26:07.0 +0100 @@ -68,6 +68,11 @@ ; Fallout - Nuclear Fallout (distinct from industrial/population). nuke_contamination = Fallout +; Parameters used to describe the economic system +; 0: gold upkeep for buildings and units has to be paid by the city +; 1: gold upkeep for buildings and units comes from the overall finances +economicsystem = 0 + ; Parameters used to generalize the calculation of city granary size: ; if city_size = num_inis: ; city_granary_size = (granary_food_ini[city_size] * foodbox / 100) diff -ur -X./freeciv-2.1.99svn15391/diff_ignore freeciv-2.1.99svn15931/server/cityturn.c
[Freeciv-Dev] (PR#40621) [Patch] Separate governor menu in city report
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40621 Attached patch makes the Citizen Governor menu accessible from the main city report menu via a Governor menu item, rather than from Production/Change/Citizen Governor. See: http://forum.freeciv.org/viewtopic.php?t=5737 --- 能がない知事は処刑される。 diff --git a/client/gui-gtk-2.0/cityrep.c b/client/gui-gtk-2.0/cityrep.c index f16e0a4..1cb3cb1 100644 --- a/client/gui-gtk-2.0/cityrep.c +++ b/client/gui-gtk-2.0/cityrep.c @@ -95,15 +95,17 @@ static void popup_last_menu(GtkMenuShell *menu, gpointer data); static void popup_first_menu(GtkMenuShell *menu, gpointer data); static void popup_next_menu(GtkMenuShell *menu, gpointer data); -static GtkWidget *city_center_command, *city_popup_command, *city_buy_command; +static GtkWidget *city_center_command; +static GtkWidget *city_popup_command; +static GtkWidget *city_buy_command; static GtkWidget *city_production_command; +static GtkWidget *city_governor_command; static GtkWidget *city_total_buy_cost_label; static GtkWidget *change_improvements_item; static GtkWidget *change_units_item; static GtkWidget *change_wonders_item; -static GtkWidget *change_cma_item; static GtkWidget *last_improvements_item; static GtkWidget *last_units_item; @@ -542,6 +544,11 @@ static void append_cma_to_menu_item(GtkMenuItem *parent_item, bool change_cma) struct cm_parameter parameter; GtkWidget *w; + w = gtk_menu_item_get_submenu(parent_item); + if (w != NULL GTK_WIDGET_VISIBLE(w)) { +return; + } + gtk_menu_item_remove_submenu(parent_item); if (!can_client_issue_orders()) { return; @@ -713,6 +720,11 @@ static GtkWidget *create_city_report_menubar(void) gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); create_last_menu(item); + item = gtk_menu_item_new_with_mnemonic(_(Gover_nor)); + city_governor_command = item; + gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item); + append_cma_to_menu_item(GTK_MENU_ITEM(item), TRUE); + item = gtk_menu_item_new_with_mnemonic(_(_Select)); gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item); create_select_menu(item); @@ -1178,6 +1190,10 @@ void city_report_dialog_update(void) city_selection_changed_callback(city_selection); +if (GTK_WIDGET_SENSITIVE(city_governor_command)) { + append_cma_to_menu_item(GTK_MENU_ITEM(city_governor_command), TRUE); +} + select_menu_cached = FALSE; } } @@ -1233,8 +1249,6 @@ static void create_change_menu(GtkWidget *item) gtk_menu_shell_append(GTK_MENU_SHELL(menu), change_improvements_item); change_wonders_item = gtk_menu_item_new_with_label(_(Wonders)); gtk_menu_shell_append(GTK_MENU_SHELL(menu), change_wonders_item); - change_cma_item = gtk_menu_item_new_with_label(_(Citizen Governor)); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), change_cma_item); } / @@ -1317,7 +1331,6 @@ static void popup_change_menu(GtkMenuShell *menu, gpointer data) FALSE, TRUE, CO_CHANGE, can_city_build_now, G_CALLBACK(select_impr_or_unit_callback), n); - append_cma_to_menu_item(GTK_MENU_ITEM(change_cma_item), TRUE); } / @@ -1639,6 +1652,8 @@ static void city_selection_changed_callback(GtkTreeSelection *selection) gtk_widget_set_sensitive(city_production_command, n 0 can_client_issue_orders()); + gtk_widget_set_sensitive(city_governor_command, + n 0 can_client_issue_orders()); gtk_widget_set_sensitive(city_center_command, n 0); gtk_widget_set_sensitive(city_popup_command, n 0); gtk_widget_set_sensitive(city_buy_command, ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#40618) randomize genlist
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40618 [matthias.pfaffer...@mapfa.de - Fri Jan 02 21:15:47 2009]: This patch adds the possibility to randomize the lists used by freeciv. I think array_shuffle() would be better placed in utility/ shared.[ch], since it is useful for more than just genlists, and shared.h already has some array related stuff. Also, it should probably use myrand() from utility/rand.[ch] instead of the system rand(). This will make it possible to reproduce the same random behavior via seed parameters (e.g. mapseed, gameseed), which helps in debugging. Lastly, the two for lines in genlist_shuffle() are missing some spaces. ;) I also replace the randomize algorithm in server/ plrhand.c:shuffle_players(). Ok. --- トランプ手品は見たいですか。 ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev