[Freeciv-Dev] (PR#39456) celebrate hscale in Governor page
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39456 From Gilles Seguin: When you click on the right or the left on the cursor on a hscale in the Governor page, the value decrease or increase by 1. This is not the case of celebrate hscale, is this a bug or a forgotten stuff? --- cma_fe.c.yy 2007-07-09 08:27:31.0 -0400 +++ cma_fe.c2007-07-07 19:46:23.0 -0400 @@ -365,7 +365,7 @@ G_CALLBACK(hscale_changed), pdialog); pdialog-factor[NUM_STATS] = - GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, 50, 1, 0, 0)); + GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, 50, 1, 1, 0)); hscale = gtk_hscale_new(GTK_ADJUSTMENT(pdialog-factor[NUM_STATS])); gtk_table_attach_defaults(GTK_TABLE(table), hscale, 2, 3, Please, change it for 1.14, 2.0, 2.1 and trunk branches. Thank you --- cma_fe.c.yy 2007-07-09 08:27:31.0 -0400 +++ cma_fe.c2007-07-07 19:46:23.0 -0400 @@ -365,7 +365,7 @@ G_CALLBACK(hscale_changed), pdialog); pdialog-factor[NUM_STATS] = - GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, 50, 1, 0, 0)); + GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, 50, 1, 1, 0)); hscale = gtk_hscale_new(GTK_ADJUSTMENT(pdialog-factor[NUM_STATS])); gtk_table_attach_defaults(GTK_TABLE(table), hscale, 2, 3, ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39455)
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39455 Caused by the checkin in #15260. Here is a patch that works with both the 2.1 and trunk branches. Index: client/gui-gtk-2.0/menu.c === --- client/gui-gtk-2.0/menu.c (revision 13101) +++ client/gui-gtk-2.0/menu.c (arbetskopia) @@ -1270,6 +1270,7 @@ const char *path = menu_path_remove_uline(main/_Government/_Change Government); GtkWidget *parent = gtk_item_factory_get_widget(item_factory, path); +bool attached_to_player = (game.player_ptr != NULL); if (parent) { GList *list, *iter; @@ -1326,11 +1327,11 @@ /* If the client is not attached to a player these reports are * disabled. */ -menus_set_sensitive(main/_Reports/_Cities, game.player_ptr); -menus_set_sensitive(main/_Reports/_Units, game.player_ptr); -menus_set_sensitive(main/_Reports/_Economy, game.player_ptr); -menus_set_sensitive(main/_Reports/_Science, game.player_ptr); -menus_set_sensitive(main/_Reports/_Demographics, game.player_ptr); +menus_set_sensitive(main/_Reports/_Cities, attached_to_player); +menus_set_sensitive(main/_Reports/_Units, attached_to_player); +menus_set_sensitive(main/_Reports/_Economy, attached_to_player); +menus_set_sensitive(main/_Reports/_Science, attached_to_player); +menus_set_sensitive(main/_Reports/_Demographics, attached_to_player); menus_set_sensitive(main/_Reports/S_paceship, (game.player_ptr game.player_ptr-spaceship.state != SSHIP_NONE)); ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39455) Warning: makes integer from pointer without a cast in menu.c
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39455 [engla - Sam. Jul. 14 11:20:57 2007]: Caused by the checkin in #15260. Here is a patch that works with both the 2.1 and trunk branches. This patch looks very better. Thank you ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39450) Make rule names available in the scripting api
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39450 Ulrik Sverdrup wrote: But we could go for consistency the other way around and change our mind and use: :rule_name() :name_translation() :plural_translation() to follow the C function names yes. follow the C function names. I choose those names to indicate the translation, no misunderstandings. Another inconsistency in our code I noticed though is that some types (like tech/advance) use the index of the type, but others use the whole struct (for example unit_type). Nothing script authors will need to worry about of course. yes. long noted in the HACKING file. I was thinking about finishing the conversion that somebody started (from index to pointer), but unlike the bug fixes in my previous patches, I'm not aware of existing bugs that are caused by the inconsistency, so I've left it alone for now. Maybe next week ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39451) Add signal emit to scripting api
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39451 Ulrik Sverdrup wrote: As a third option, we could make more abstract functions for giving techs etc so that it would not be necessary to initiate signals in the code; really if a tech is given in a scenario script, the side effects (signals etc) should be so fundamental that we shouldn't need to send the signals manually. That sounds better to me. KISS. Remember, the lua code cannot do anything that requires understanding of the underlying structure, nor anything random (choosing), as that would break fundamental assumptions of the network, ruleset, and savegame code. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39456) celebrate hscale in Governor page
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39456 Pepeto _ wrote: Please, change it for 1.14, 2.0, 2.1 and trunk branches. Not a crashing bugfix, so 2.1 and trunk only. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39451) Add signal emit to scripting api
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39451 That sounds better to me. KISS. Remember, the lua code cannot do anything that requires understanding of the underlying structure, nor anything random (choosing), as that would break fundamental assumptions of the network, ruleset, and savegame code. Good catch: The hut code that per has been working on (and now I), uses api_utilities_random in server/scripting/api_utilities.c . That is a random outcome on the server, and should be reproducible since it uses myrand. Is this not safe in the long run? ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39455) Warning: makes integer from pointer without a cast in menu.c
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39455 Ulrik Sverdrup wrote: Thanks. You can check in that patch early since I broke the build; or I can take care of it with your permission. Generally, compile bugs should be checked in as fast as possible, by whomever finds and fixes them. Seems fine to me. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39455) Warning: makes integer from pointer without a cast in menu.c
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39455 Committed patch to 2.1 as r13102 and trunk as r13103 ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39450) Make unit_type etc names available in the scripting api
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39450 Patch attached, applies to trunk r13103 Now we have: :rule_name() :name_translation() and for Nation_Type there is also: :plural_translation() Index: server/scripting/api_methods.h === --- server/scripting/api_methods.h (revision 13103) +++ server/scripting/api_methods.h (arbetskopia) @@ -27,5 +27,21 @@ bool api_methods_building_type_is_small_wonder(Building_Type *pbuilding); bool api_methods_building_type_is_improvement(Building_Type *pbuilding); +/* rule name and translated name methods */ +const char *api_methods_government_rule_name(Government *pgovernment); +const char *api_methods_government_name_translation(Government *pgovernment); +const char *api_methods_nation_type_rule_name(Nation_Type *pnation); +const char *api_methods_nation_type_name_translation(Nation_Type *pnation); +const char *api_methods_nation_type_plural_translation(Nation_Type + *pnation); +const char *api_methods_building_type_rule_name(Building_Type *pbuilding); +const char *api_methods_building_type_name_translation(Building_Type + *pbuilding); +const char *api_methods_unit_type_rule_name(Unit_Type *punit_type); +const char *api_methods_unit_type_name_translation(Unit_Type *punit_type); +const char *api_methods_tech_type_rule_name(Tech_Type *ptech); +const char *api_methods_tech_type_name_translation(Tech_Type *ptech); +const char *api_methods_terrain_rule_name(Terrain *pterrain); +const char *api_methods_terrain_name_translation(Terrain *pterrain); #endif Index: server/scripting/api.pkg === --- server/scripting/api.pkg (revision 13103) +++ server/scripting/api.pkg (arbetskopia) @@ -94,16 +94,28 @@ /* Class methods. */ + +/* Player */ int api_methods_player_num_cities @ methods_player_num_cities (Player *pplayer); int api_methods_player_num_units @ methods_player_num_units (Player *pplayer); -bool api_methods_unit_type_has_flag - @ methods_unit_type_has_flag (Unit_Type *punit_type, const char *flag); -bool api_methods_unit_type_has_role - @ methods_unit_type_has_role (Unit_Type *punit_type, const char *role); +/* Government */ +const char *api_methods_government_rule_name + @ methods_government_rule_name (Government *pgovernment); +const char *api_methods_government_name_translation + @ methods_government_name_translation (Government *pgovernment); +/* Nation_Type */ +const char *api_methods_nation_type_rule_name + @ methods_nation_type_rule_name (Nation_Type *pnation); +const char *api_methods_nation_type_name_translation + @ methods_nation_type_name_translation (Nation_Type *pnation); +const char *api_methods_nation_type_plural_translation + @ methods_nation_type_plural_translation (Nation_Type *pnation); + +/* Building_Type */ bool api_methods_building_type_is_wonder @ methods_building_type_is_wonder (Building_Type *pbuilding); bool api_methods_building_type_is_great_wonder @@ -112,8 +124,33 @@ @ methods_building_type_is_small_wonder (Building_Type *pbuilding); bool api_methods_building_type_is_improvement @ methods_building_type_is_improvement (Building_Type *pbuilding); +const char *api_methods_building_type_rule_name + @ methods_building_type_rule_name (Building_Type *pbuilding); +const char *api_methods_building_type_name_translation + @ methods_building_type_name_translation (Building_Type *pbuilding); +/* Unit_Type */ +bool api_methods_unit_type_has_flag + @ methods_unit_type_has_flag (Unit_Type *punit_type, const char *flag); +bool api_methods_unit_type_has_role + @ methods_unit_type_has_role (Unit_Type *punit_type, const char *role); +const char *api_methods_unit_type_rule_name + @ methods_unit_type_rule_name (Unit_Type *punit_type); +const char *api_methods_unit_type_name_translation + @ methods_unit_type_name_translation (Unit_Type *punit_type); +/* Tech_Type */ +const char *api_methods_tech_type_rule_name + @ methods_tech_type_rule_name (Tech_Type *ptech); +const char *api_methods_tech_type_name_translation + @ methods_tech_type_name_translation (Tech_Type *ptech); + +/* Terrain */ +const char *api_methods_terrain_rule_name + @ methods_terrain_rule_name (Terrain *pterrain); +const char *api_methods_terrain_name_translation + @ methods_terrain_name_translation (Terrain *pterrain); + $[ -- Player methods. function Player:is_human() @@ -133,6 +170,28 @@ return find.city(self.owner, self.homecity_id) end +-- Government methods +function Government:rule_name() + return methods_government_rule_name(self) +end + +function Government:name_translation() + return methods_government_name_translation(self) +end + +-- Nation_Type methods +function Nation_Type:rule_name() + return methods_nation_type_rule_name(self) +end + +function Nation_Type:name_translation() +
[Freeciv-Dev] (PR#17187) Move hut code into lua script
URL: http://bugs.freeciv.org/Ticket/Display.html?id=17187 Here are the three patches for this ticket and its two children: #39450: Make unit_type etc names available in the scripting api api_class_names_v3.diff #39451: Add signal emit to scripting api techsig_v1.diff #17187: Move hut code into lua script hut_v3.diff Applies to trunk r13103 They are interdependent and should be applied in from top to bottom. I used git to sort out the interlocking patches, apply to test with cat ../api_class_names_v3.diff ../techsig_v1.diff ../hut_v3.diff | patch -p1 The patches can and should be checked in in succession, none of them break the build. Name api changes: Now we have: :rule_name() :name_translation() and for Nation_Type there is also: :plural_translation() Techsig changes: the api action give_technology now takes a reason string as well; a script signal with the given reason is sent; it was decided in #39451 that the signal events are so fundamental that scripts should not directly emit them. Hut changes: Ported hut_get_barbarian as noted in previous emails. unleash_barbarians is available as an api action, as noted before. Introduced hut_get_limited for ai players with handicap H_LIMITEDHUTS; we cannot put this in the script file without passing irrelevant parameters to the hut_entered signal callback, or opening ai handicaps etc to the script api. hut_get_limited is a simplified version of the previous behavior; 25 gold is given as before, but with 1/12 chance the unit is simply wiped (normally unleash_barbarians) would be called; but as the wipe is the most common outcome this was simplified. One hut issue remains: Only Legions are given as mercenaries. This can be solved by porting a method to find a unittype for role, or simplified now that different rulesets can customize by script. Ready for comments diff --git a/server/scripting/api.pkg b/server/scripting/api.pkg index 6f0af93..d8a5986 100644 --- a/server/scripting/api.pkg +++ b/server/scripting/api.pkg @@ -94,16 +94,28 @@ struct Terrain { /* Class methods. */ + +/* Player */ int api_methods_player_num_cities @ methods_player_num_cities (Player *pplayer); int api_methods_player_num_units @ methods_player_num_units (Player *pplayer); -bool api_methods_unit_type_has_flag - @ methods_unit_type_has_flag (Unit_Type *punit_type, const char *flag); -bool api_methods_unit_type_has_role - @ methods_unit_type_has_role (Unit_Type *punit_type, const char *role); - +/* Government */ +const char *api_methods_government_rule_name + @ methods_government_rule_name (Government *pgovernment); +const char *api_methods_government_name_translation + @ methods_government_name_translation (Government *pgovernment); + +/* Nation_Type */ +const char *api_methods_nation_type_rule_name + @ methods_nation_type_rule_name (Nation_Type *pnation); +const char *api_methods_nation_type_name_translation + @ methods_nation_type_name_translation (Nation_Type *pnation); +const char *api_methods_nation_type_plural_translation + @ methods_nation_type_plural_translation (Nation_Type *pnation); + +/* Building_Type */ bool api_methods_building_type_is_wonder @ methods_building_type_is_wonder (Building_Type *pbuilding); bool api_methods_building_type_is_great_wonder @@ -112,7 +124,32 @@ bool api_methods_building_type_is_small_wonder @ methods_building_type_is_small_wonder (Building_Type *pbuilding); bool api_methods_building_type_is_improvement @ methods_building_type_is_improvement (Building_Type *pbuilding); +const char *api_methods_building_type_rule_name + @ methods_building_type_rule_name (Building_Type *pbuilding); +const char *api_methods_building_type_name_translation + @ methods_building_type_name_translation (Building_Type *pbuilding); +/* Unit_Type */ +bool api_methods_unit_type_has_flag + @ methods_unit_type_has_flag (Unit_Type *punit_type, const char *flag); +bool api_methods_unit_type_has_role + @ methods_unit_type_has_role (Unit_Type *punit_type, const char *role); +const char *api_methods_unit_type_rule_name + @ methods_unit_type_rule_name (Unit_Type *punit_type); +const char *api_methods_unit_type_name_translation + @ methods_unit_type_name_translation (Unit_Type *punit_type); + +/* Tech_Type */ +const char *api_methods_tech_type_rule_name + @ methods_tech_type_rule_name (Tech_Type *ptech); +const char *api_methods_tech_type_name_translation + @ methods_tech_type_name_translation (Tech_Type *ptech); + +/* Terrain */ +const char *api_methods_terrain_rule_name + @ methods_terrain_rule_name (Terrain *pterrain); +const char *api_methods_terrain_name_translation + @ methods_terrain_name_translation (Terrain *pterrain); $[ -- Player methods. @@ -133,6 +170,28 @@ function Unit:homecity() return find.city(self.owner, self.homecity_id) end +-- Government methods +function Government:rule_name() + return methods_government_rule_name(self) +end + +function Government:name_translation() + return methods_government_name_translation(self)
Re: [Freeciv-Dev] (PR#39387) replace match_style = full with pair
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39387 Re-reading the original posting, that should be match_style. After much testing, I've completely eliminated match_style, and its parameters none, bool, and full. Instead, I've replaced it with match_with, a listing of match_types. This allows completely orthogonal operations between styles. Styles are determined automagically (internally). That is, layer0_match_style = bool layer0_match_type = hills becomes layer0_match_type = hills layer0_match_with = hills Simple enough. The elegance comes as more match_with types are added: layer0_match_type = shallow layer0_match_with = land, deep The above is the equivalent of the old match_style = full, but doesn't interfere with other tiles' matching styles. *And* may be extensible to more than 3 types! (Currently limited to 3 as before.) This patch doesn't make any substantive changes. It continues to operate in exactly the same manner as before, so that old savegames will run without modification. Never-the-less, this is the big one! Old tilesets will no longer work. (Replacements are provided for the main 5 here.) I've tested 2.1 savegames against all 5 tilesets, and also trunk edit savegames (with deep water) against all 5 tilesets. Index: data/trident.tilespec === --- data/trident.tilespec (revision 13103) +++ data/trident.tilespec (working copy) @@ -2,7 +2,7 @@ [tilespec] ; Format and options of this tilespec file: -options = +tilespec4.2007.Feb.20 +options = +tilespec4.2007.Jul.13 ; A simple name for the tileset specified by this file: name = Trident @@ -86,169 +86,138 @@ ; Terrain info - see README.graphics [layer0] -match_style = BOOL match_types = arctic, desert, forest, grassland, hills, jungle, mountains, water, plains, swamp, tundra [layer1] -match_style = BOOL match_types = water [layer2] -match_style = BOOL match_types = water ; Water graphics referenced by terrain.ruleset ; -[terrain_coast] +[tile_coast] is_blended = 0 num_layers = 3 -layer0_match_style = none layer0_match_type = water -layer1_match_style = bool layer1_match_type = water -layer2_match_style = bool +layer1_match_with = water layer2_match_type = water -layer2_cell_type = rect +layer2_match_with = water +layer2_sprite_type = corner -[terrain_shelf] +[tile_shelf] is_blended = 0 num_layers = 3 -layer0_match_style = none layer0_match_type = water -layer1_match_style = bool layer1_match_type = water -layer2_match_style = bool +layer1_match_with = water layer2_match_type = water -layer2_cell_type = rect +layer2_match_with = water +layer2_sprite_type = corner -[terrain_floor] +[tile_floor] is_blended = 0 num_layers = 3 -layer0_match_style = none layer0_match_type = water -layer1_match_style = bool layer1_match_type = water -layer2_match_style = bool +layer1_match_with = water layer2_match_type = water -layer2_cell_type = rect +layer2_match_with = water +layer2_sprite_type = corner -[terrain_trench] +[tile_trench] is_blended = 0 num_layers = 3 -layer0_match_style = none layer0_match_type = water -layer1_match_style = bool layer1_match_type = water -layer2_match_style = bool +layer1_match_with = water layer2_match_type = water -layer2_cell_type = rect +layer2_match_with = water +layer2_sprite_type = corner -[terrain_ridge] +[tile_ridge] is_blended = 0 num_layers = 3 -layer0_match_style = none layer0_match_type = water -layer1_match_style = bool layer1_match_type = water -layer2_match_style = bool +layer1_match_with = water layer2_match_type = water -layer2_cell_type = rect +layer2_match_with = water +layer2_sprite_type = corner -[terrain_vent] +[tile_vent] is_blended = 0 num_layers = 3 -layer0_match_style = none layer0_match_type = water -layer1_match_style = bool layer1_match_type = water -layer2_match_style = bool +layer1_match_with = water layer2_match_type = water -layer2_cell_type = rect +layer2_match_with = water +layer2_sprite_type = corner ; Land graphics referenced by terrain.ruleset ; -[terrain_arctic] +[tile_arctic] is_blended = 0 num_layers = 1 -layer0_match_style = bool layer0_match_type = arctic +layer0_match_with = arctic mine_sprite = tx.oil_mine -[terrain_desert] +[tile_desert] is_blended = 0 num_layers = 1 -layer0_match_style = bool layer0_match_type = desert +layer0_match_with = desert mine_sprite = tx.oil_mine -[terrain_forest] +[tile_forest] is_blended = 0 num_layers = 1 -layer0_match_style = bool layer0_match_type = forest +layer0_match_with = forest -[terrain_grassland] +[tile_grassland] is_blended = 0 num_layers = 1 -layer0_match_style = bool layer0_match_type = grassland +layer0_match_with = grassland -[terrain_hills] +[tile_hills] is_blended = 0 num_layers = 1 -layer0_match_style = bool layer0_match_type = hills +layer0_match_with = hills mine_sprite = tx.mine -[terrain_jungle] +[tile_jungle]
Re: [Freeciv-Dev] (PR#39387) replace match_style = full
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39387 While I was changing tilesets, the sections now are [tile_*], instead of [terrain_*] (the latter is already used in terrain.ruleset). And cell_type is now sprite_type, matching its actual function. The default (a whole tile) made no sense at all as a type of cell -- by definition a fraction of a tile. And more useful parameter names are used (added in an earlier patch), in this instance corner -- for a corner sprite. The old rect wasn't very enlightening, and in most tilesets isn't even rectangular. Internally, variables that are not terrain were renamed to their (current) use. My guess is that once-upon-a-time the tiles and terrain were joined. Now, several terrain can use the same graphic, and each tile graphic actually be many cell sprites. Various indexed arrays (used over and over) were changed to use pointers. Committed trunk revision 13104. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39458)
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39458 The function do_unit_goto() doesn't work anymore since 2.1. This is annoying when you load save game and you have to reset destination for every unit. The function always returns 2 (GR_OUT_OF_MOVEPOINTS). It should be nice if could work. Thank you. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev