[Freeciv-Dev] (PR#40322) [editor] Allow default F1-F12 handlers; startpos shortcut key
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40322 Patch allows the default handlers for F1-F12 in edit mode. Also implements the shortcut key 'p' for the player start position tool. -- 仕事は続く〜 diff --git a/client/gui-gtk-2.0/editgui.c b/client/gui-gtk-2.0/editgui.c index bedb738..fd32851 100644 --- a/client/gui-gtk-2.0/editgui.c +++ b/client/gui-gtk-2.0/editgui.c @@ -1586,6 +1586,9 @@ gboolean handle_edit_key_press(GdkEventKey *ev) case GDK_b: ett = ETT_TERRITORY; break; + case GDK_p: +ett = ETT_STARTPOS; +break; case GDK_plus: case GDK_equal: case GDK_KP_Add: @@ -1631,6 +1634,20 @@ gboolean handle_edit_key_press(GdkEventKey *ev) case GDK_Tab: editgui_run_tool_selection(editor_get_tool()); break; + case GDK_F1: + case GDK_F2: + case GDK_F3: + case GDK_F4: + case GDK_F5: + case GDK_F6: + case GDK_F7: + case GDK_F8: + case GDK_F9: + case GDK_F10: + case GDK_F11: + case GDK_F12: +return FALSE; /* Allow default handler. */ +break; default: return TRUE; /* Gobbled... */ break; ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] My units in enemy city
I sent this to [EMAIL PROTECTED] but it bounced. I'm playing the trunk version with the civ2 ruleset (plus one change I made to set City_Unhappy_Size). svn revision is 14814 I incited a revolt in an enemy city Batu with my (Cornish) diplomat. It was successful. However, the city still belongs to the Majapahits, which I am at war with. I gained control of the Archer that was in the city, but not the city itself. I was able to move my Legion into and out of the city, but it still does not appear on my city list, and still shows on the view with the Majapahit flag. Save game is attached. mycity.sav.bz2 Description: application/bzip ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#40323) [editor] Disregard size when applying tool to selection
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40323 When the brush size parameter was greater than one, applying the current editor tool to a selection of tiles (e.g. by selecting with right-click drag and pressing space) would affect more tiles than just those that were selected. This patch fixes that situation by making the tool only apply to the selected tiles regardless of the size parameter (except for the city tool, where the size parameter means something else). Also, some functions were given better names and comments updated. -- 火曜日は働く代わりに放火しています。 diff --git a/client/editor.c b/client/editor.c index e703774..2dc5362 100644 --- a/client/editor.c +++ b/client/editor.c @@ -448,7 +448,8 @@ void editor_mouse_button_press(int canvas_x, int canvas_y, editor_grab_applied_player(ptile); } else if (modifiers == EKM_NONE) { editor-tool_active = TRUE; - editor_apply_tool_single(ptile); + editor_apply_tool(ptile, FALSE); + editor_notify_edit_finished(); editor_set_current_tile(ptile); } break; @@ -629,7 +630,8 @@ void editor_mouse_move(int canvas_x, int canvas_y, int modifiers) } if (editor-tool_active old != NULL old != ptile) { -editor_apply_tool_single(ptile); +editor_apply_tool(ptile, FALSE); +editor_notify_edit_finished(); editor_set_current_tile(ptile); } @@ -643,27 +645,20 @@ void editor_mouse_move(int canvas_x, int canvas_y, int modifiers) a hint for the server to now do any checks it has saved while the batch was being processed. / -void editor_apply_tool_batch_finished(void) +void editor_notify_edit_finished(void) { send_packet_edit_check_tiles(client.conn); } / - Apply the current tool at the given tile as a single operation rather - than in a batch. -/ -void editor_apply_tool_single(const struct tile *ptile) -{ - editor_apply_tool_batch(ptile); - editor_apply_tool_batch_finished(); -} - -/ Apply the current editor tool to the given tile. This function is - suitable to called over multiple tiles at once. One the batch of - operations is finished you should call editor_apply_tool_batch_finished. + suitable to called over multiple tiles at once. Once the batch of + operations is finished you should call editor_notify_edit_finished. + The 'part_of_selection' parameter should be TRUE if the tool is + being applied to a tile from a selection. / -void editor_apply_tool_batch(const struct tile *ptile) +void editor_apply_tool(const struct tile *ptile, + bool part_of_selection) { enum editor_tool_type ett; int value, size, count, apno; @@ -695,6 +690,10 @@ void editor_apply_tool_batch(const struct tile *ptile) return; } + if (part_of_selection ett != ETT_CITY) { +size = 1; + } + switch (ett) { case ETT_TERRAIN: @@ -885,10 +884,10 @@ void editor_apply_tool_to_selection(void) connection_do_buffer(client.conn); whole_map_iterate(ptile) { if (editor_tile_is_selected(ptile)) { - editor_apply_tool_batch(ptile); + editor_apply_tool(ptile, TRUE); } } whole_map_iterate_end; - editor_apply_tool_batch_finished(); + editor_notify_edit_finished(); connection_do_unbuffer(client.conn); } diff --git a/client/editor.h b/client/editor.h index 02db456..683f0ea 100644 --- a/client/editor.h +++ b/client/editor.h @@ -80,9 +80,9 @@ void editor_mouse_button_release(int canvas_x, int canvas_y, void editor_mouse_move(int canvas_x, int canvas_y, int modifiers); void editor_redraw(void); -void editor_apply_tool_single(const struct tile *ptile); -void editor_apply_tool_batch(const struct tile *ptile); -void editor_apply_tool_batch_finished(void); +void editor_apply_tool(const struct tile *ptile, + bool part_of_selection); +void editor_notify_edit_finished(void); void editor_toggle_erase_mode(void); void editor_selection_clear(void); ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#40324) [patch] Hash table iterators and fast clear
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40324 The attached patch implements GtkTreeIter style iterators for hash tables: { struct hash_iter iter; if (!hash_get_start_iter(h, iter)) { /* Hash table 'h' is empty. */ } do { void *key = hash_iter_get_key(iter); void *value = hash_iter_get_value(iter); /* Use key and/or value. */ } while (hash_iter_next(iter); } The point of the above interface is to avoid the O(N^2) cost of using hash_{key,value}_by_number to iterate over all items in a hash table (each call to *_by_number being O(N), with N the number of items in the table). The patch also implements hash_fast_clear which does the same as hash_delete_all_entries but much more quickly and efficiently. (It cannot be used unfortunately if the keys or values have associated free_funcs.) These hash table improvements are needed for my improved implementation of editor tile selection (much cleaner than the current one using bitvectors). -- 水曜日は働く代わりにほかの惑星で水を探しています。 diff --git a/utility/hash.c b/utility/hash.c index e2e7dc2..e915bd6 100644 --- a/utility/hash.c +++ b/utility/hash.c @@ -771,3 +771,94 @@ const void *hash_value_by_number(const struct hash_table *h, { return hash_lookup_data(h, hash_key_by_number(h, entry_number)); } + +/** + If the hash table is not empty, sets 'iter' to point to the start of the + hash table and returns TRUE. Otherwise returns FALSE. +**/ +bool hash_get_start_iter(const struct hash_table *h, + struct hash_iter *iter) +{ + if (!h || !iter || hash_num_entries(h) 1) { +return FALSE; + } + + iter-table = h; + iter-index = -1; + return hash_iter_next(iter); +} + +/** + Set the iterator 'iter' to the next item in the hash table. Returns + FALSE if there are no more items. +**/ +bool hash_iter_next(struct hash_iter *iter) +{ + const struct hash_table *h; + struct hash_bucket *bucket; + + if (!iter || !iter-table) { +return FALSE; + } + + h = iter-table; + iter-index++; + + while (iter-index hash_num_buckets(h)) { +bucket = h-buckets + iter-index; +if (bucket bucket-used == BUCKET_USED) { + iter-key = bucket-key; + iter-value = bucket-data; + return TRUE; +} +iter-index++; + } + + return FALSE; +} + +/** + Returns the key of the hash table item pointed to by this iterator. +**/ +void *hash_iter_get_key(struct hash_iter *iter) +{ + if (!iter) { +return NULL; + } + return (void *) iter-key; +} + +/** + Returns the value (or data) of the hash table item pointed to by this + iterator. +**/ +void *hash_iter_get_value(struct hash_iter *iter) +{ + if (!iter) { +return NULL; + } + return (void *) iter-value; +} + +/** + Quickly erase all items in the hash table returning it to an empty + state. + + NB: This function MUST NOT be used if you supplied a free_key_func + or free_data_func to hash_new_*. In that case you must use + hash_delete_all_entries instead. +**/ +void hash_fast_clear(struct hash_table *h) +{ + if (!h) { +return; + } + + assert(h-free_key_func == NULL); + assert(h-free_data_func == NULL); + + memset(h-buckets, 0, sizeof(struct hash_bucket) * h-num_buckets); + h-num_entries = 0; + h-num_deleted = 0; + h-frozen = FALSE; +} diff --git a/utility/hash.h b/utility/hash.h index 9dc6e1d..b53f413 100644 --- a/utility/hash.h +++ b/utility/hash.h @@ -79,4 +79,19 @@ unsigned int hash_num_entries(const struct hash_table *h); unsigned int hash_num_buckets(const struct hash_table *h); unsigned int hash_num_deleted(const struct hash_table *h); +void hash_fast_clear(struct hash_table *h); + +struct hash_iter { + const struct hash_table *table; + int index; + const void *key; + const void *value; +}; + +bool hash_get_start_iter(const struct hash_table *h, + struct hash_iter *iter); +bool hash_iter_next(struct hash_iter *iter); +void *hash_iter_get_key(struct hash_iter *iter); +void *hash_iter_get_value(struct hash_iter *iter); + #endif /* FC__HASH_H */ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#40325) Trouble compiling non gtk-2.0 client
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40325 Hello, I get a compilation error in client/editor.c when compiling a non gtk-2.0 client, because editgui_popup_properties() from gtk-2.0 is used in client/editor.c. Code in editor.c should really be common to all clients. Here is the error: gcc -Wall -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -pthread -g -O2 -L/usr/local/lib -o civclient attribute.o citydlg_common.o cityrepdata.o civclient.o chatline_common.o connectdlg_common.o climisc.o climap.o clinet.o colors_common.o control.o editor.o ggzclient.o goto.o helpdata.o mapctrl_common.o mapview_common.o messagewin_common.o overview_common.o packhand.o packhand_gen.o plrdlg_common.o options.o repodlgs_common.o reqtree.o servers.o text.o themes_common.o tilespec.o audio.o audio_none.o ../utility/libcivutility.a ../common/libcivcommon.a ../common/aicore/libaicore.a agents/libagents.a gui-web/libguiclient.a ../utility/libcivutility.a ../common/libcivcommon.a ../common/aicore/libaicore.a agents/libagents.a gui-web/libguiclient.a -lm -lmicrohttpd -lggzmod -lbz2 -lz editor.o: In function `editor_mouse_button_press': /home/andreas/freeciv/backup/freeciv-svn16/client/editor.c:476: undefined reference to `editgui_popup_properties' editor.o: In function `editor_grab_applied_player': /home/andreas/freeciv/backup/freeciv-svn16/client/editor.c:313: undefined reference to `editgui_refresh' packhand.o: In function `update_client_state': /home/andreas/freeciv/backup/freeciv-svn16/client/packhand.c:423: undefined reference to `editgui_tileset_changed' packhand.o: In function `handle_player_info': /home/andreas/freeciv/backup/freeciv-svn16/client/packhand.c:1864: undefined reference to `editgui_refresh' collect2: ld returned 1 exit status make[3]: *** [civclient] Error 1 ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#40325) Trouble compiling non gtk-2.0 client
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40325 2008/6/25 Andreas Røsdal: Hello, I get a compilation error in client/editor.c when compiling a non gtk-2.0 client, because editgui_popup_properties() from gtk-2.0 is used in client/editor.c. Code in editor.c should really be common to all clients. Fix - ML diff -Nurd -X.diff_ignore freeciv/client/gui-ftwl/gui_main.c freeciv/client/gui-ftwl/gui_main.c --- freeciv/client/gui-ftwl/gui_main.c 2008-02-02 09:04:26.0 +0200 +++ freeciv/client/gui-ftwl/gui_main.c 2008-06-25 11:24:16.0 +0300 @@ -18,17 +18,22 @@ #include stdio.h #include assert.h +/* utility */ #include fcintl.h #include fciconv.h #include log.h #include registry.h +/* client */ +#include clinet.h +#include editgui_g.h +#include graphics_g.h + #include chatline.h #include colors_common.h #include colors.h #include back_end.h #include widget.h -#include graphics_g.h #include civclient.h #include shared.h #include support.h @@ -37,7 +42,6 @@ #include chat.h #include mapview.h #include control.h -#include clinet.h #include gui_main.h @@ -345,3 +349,21 @@ { sw_add_timeout(-1, callback, data); } + +/ + Stub for editor function +/ +void editgui_tileset_changed(void) +{} + +/ + Stub for editor function +/ +void editgui_refresh(void) +{} + +/ + Stub for editor function +/ +void editgui_popup_properties(const struct tile_list *tiles) +{} diff -Nurd -X.diff_ignore freeciv/client/gui-sdl/gui_main.c freeciv/client/gui-sdl/gui_main.c --- freeciv/client/gui-sdl/gui_main.c 2008-03-08 16:13:02.0 +0200 +++ freeciv/client/gui-sdl/gui_main.c 2008-06-25 11:20:42.0 +0300 @@ -51,6 +51,7 @@ /* client */ #include civclient.h #include clinet.h +#include editgui_g.h #include ggzclient.h #include tilespec.h @@ -1120,3 +1121,21 @@ callback_list_prepend(callbacks, cb); } + +/ + Stub for editor function +/ +void editgui_tileset_changed(void) +{} + +/ + Stub for editor function +/ +void editgui_refresh(void) +{} + +/ + Stub for editor function +/ +void editgui_popup_properties(const struct tile_list *tiles) +{} diff -Nurd -X.diff_ignore freeciv/client/gui-stub/gui_main.c freeciv/client/gui-stub/gui_main.c --- freeciv/client/gui-stub/gui_main.c 2007-08-04 18:39:12.0 +0300 +++ freeciv/client/gui-stub/gui_main.c 2008-06-25 11:25:29.0 +0300 @@ -17,10 +17,13 @@ #include stdio.h +/* utility */ #include fciconv.h #include log.h +/* client */ #include civclient.h +#include editgui_g.h #include options.h #include gui_main.h @@ -170,3 +173,21 @@ freelog(LOG_ERROR, Unimplemented add_idle_callback.); (callback)(data); } + +/ + Stub for editor function +/ +void editgui_tileset_changed(void) +{} + +/ + Stub for editor function +/ +void editgui_refresh(void) +{} + +/ + Stub for editor function +/ +void editgui_popup_properties(const struct tile_list *tiles) +{} diff -Nurd -X.diff_ignore freeciv/client/gui-win32/gui_main.c freeciv/client/gui-win32/gui_main.c --- freeciv/client/gui-win32/gui_main.c 2008-02-04 08:53:36.0 +0200 +++ freeciv/client/gui-win32/gui_main.c 2008-06-25 11:26:10.0 +0300 @@ -41,6 +41,7 @@ #include connectdlg.h #include control.h #include dialogs.h +#include editgui_g.h #include gotodlg.h #include gui_stuff.h #include graphics.h @@ -906,3 +907,21 @@ callback_list_prepend(callbacks, cb); } + +/ + Stub for editor function +/ +void
[Freeciv-Dev] (PR#40326) S2_0: build out of srcdir is broken
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40326 Good daytime! In common/Makefile.am there is a call to ./generate_packets.py In S2_1 and later this is already fixed. Backport from S2_1 attached. -- Thanks, evyscr --- common/Makefile.am.orig 2006-02-16 15:47:00 +0300 +++ common/Makefile.am 2008-06-25 12:24:25 +0400 @@ -68,7 +68,7 @@ packets_gen.h packets_gen.c: packets_generate .INTERMEDIATE: packets_generate packets_generate: packets.def generate_packets.py - ./generate_packets.py + cd $(srcdir) ./generate_packets.py touch packets_generate #libcivcommon_a_DEPENDENCIES = ../utility/libcivutility.a ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#40327) My units in enemy city
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40327 Hi Andrew. Thanks for the report and savegame! The current bug reporting address is [EMAIL PROTECTED]. I have already forwarded your report there. I'm curious: where did you see the old bug reporting address? If you remember where it was, I will try and update it. Best, ~Daniel --- Forwarded message --- From: Andrew McGuinness [EMAIL PROTECTED] To: freeciv-dev@gna.org Cc: Subject: [Freeciv-Dev] My units in enemy city Date: Wed, 25 Jun 2008 14:25:19 +0900 I sent this to [EMAIL PROTECTED] but it bounced. I'm playing the trunk version with the civ2 ruleset (plus one change I made to set City_Unhappy_Size). svn revision is 14814 I incited a revolt in an enemy city Batu with my (Cornish) diplomat. It was successful. However, the city still belongs to the Majapahits, which I am at war with. I gained control of the Archer that was in the city, but not the city itself. I was able to move my Legion into and out of the city, but it still does not appear on my city list, and still shows on the view with the Majapahit flag. Save game is attached. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ mycity.sav.bz2 Description: application/bzip2 ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39767) pf code doesn't allow to bribe sea units
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39767 [pepeto - Thu Oct 11 13:59:25 2007]: 2- Bribing units on sea is a feature, then pf code should allow it. Index: common/aicore/pf_tools.c === --- common/aicore/pf_tools.c (révision 14852) +++ common/aicore/pf_tools.c (copie de travail) @@ -161,7 +161,10 @@ int move_cost; if (!is_native_tile_to_class(param-uclass, ptile1)) { -if (unit_class_transporter_capacity(ptile1, param-owner, param-uclass) 0) { +if (unit_class_transporter_capacity(ptile1, param-owner, param-uclass) 0 + || (!is_ocean(ptile-terrain) + is_non_allied_unit_tile(ptile1, param-owner) + unit_list_size(ptile1-units) == 1)) { move_cost = SINGLE_MOVE; } else { move_cost = PF_IMPOSSIBLE_MC; @@ -301,7 +304,10 @@ int move_cost; if (!is_native_tile_to_class(param-uclass, ptile1)) { -if (unit_class_transporter_capacity(ptile1, param-owner, param-uclass) 0) { +if (unit_class_transporter_capacity(ptile1, param-owner, param-uclass) 0 + || (!is_ocean(ptile-terrain) + is_non_allied_unit_tile(ptile1, param-owner) + unit_list_size(ptile1-units) == 1)) { move_cost = MOVE_COST_ROAD; } else { move_cost = PF_IMPOSSIBLE_MC; Index: common/aicore/pf_tools.c === --- common/aicore/pf_tools.c (révision 14865) +++ common/aicore/pf_tools.c (copie de travail) @@ -128,7 +128,10 @@ int move_cost; if (is_ocean(terrain1)) { -if (ground_unit_transporter_capacity(ptile1, param-owner) 0) { +if (ground_unit_transporter_capacity(ptile1, param-owner) 0 +|| (!is_ocean(ptile-terrain) + is_non_allied_unit_tile(ptile1, param-owner) + unit_list_size(ptile1-units) == 1)) { move_cost = SINGLE_MOVE; } else { move_cost = PF_IMPOSSIBLE_MC; @@ -274,7 +277,10 @@ int move_cost; if (is_ocean(ptile1-terrain)) { -if (ground_unit_transporter_capacity(ptile1, param-owner) 0) { +if (ground_unit_transporter_capacity(ptile1, param-owner) 0 +|| (!is_ocean(ptile-terrain) + is_non_allied_unit_tile(ptile1, param-owner) + unit_list_size(ptile1-units) == 1)) { move_cost = MOVE_COST_ROAD; } else { move_cost = PF_IMPOSSIBLE_MC; Index: common/aicore/pf_tools.c === --- common/aicore/pf_tools.c (révision 14865) +++ common/aicore/pf_tools.c (copie de travail) @@ -128,7 +128,11 @@ int move_cost; if (is_ocean(terrain1)) { -if (ground_unit_transporter_capacity(ptile1, param-owner) 0) { +if (ground_unit_transporter_capacity(ptile1, param-owner) 0 + || (BV_ISSET(param-unit_flags, F_DIPLOMAT) + !is_ocean(ptile-terrain) + is_non_allied_unit_tile(ptile1, param-owner) + unit_list_size(ptile1-units) == 1)) { move_cost = SINGLE_MOVE; } else { move_cost = PF_IMPOSSIBLE_MC; @@ -275,7 +279,11 @@ int move_cost; if (is_ocean(ptile1-terrain)) { -if (ground_unit_transporter_capacity(ptile1, param-owner) 0) { +if (ground_unit_transporter_capacity(ptile1, param-owner) 0 + || (BV_ISSET(param-unit_flags, F_DIPLOMAT) + !is_ocean(ptile-terrain) + is_non_allied_unit_tile(ptile1, param-owner) + unit_list_size(ptile1-units) == 1)) { move_cost = MOVE_COST_ROAD; } else { move_cost = PF_IMPOSSIBLE_MC; ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39767) pf code doesn't allow to bribe sea units
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39767 2008/6/24 Pepeto [EMAIL PROTECTED]: URL: http://bugs.freeciv.org/Ticket/Display.html?id=39767 [pepeto - Thu Oct 11 13:59:25 2007]: 2- Bribing units on sea is a feature, then pf code should allow it. How does it take care of not allowing also attack to ocean tile? Also, in S2_2 and TRUNK should not check against is_ocean, but against non-native terrain in general. - ML ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#40319) Removing a player causes client disonnection
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40319 Pepeto wrote: URL: http://bugs.freeciv.org/Ticket/Display.html?id=40319 I am not sure about it, but I think that the packet game_info is received before the packet remove_player. This causes a invalid set of game.nplayers: No. In fact it appears there is no game_info being received in pregame. -jason ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#40326) S2_0: build out of srcdir is broken
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40326 Egor Vyscrebentsov wrote: URL: http://bugs.freeciv.org/Ticket/Display.html?id=40326 Good daytime! In common/Makefile.am there is a call to ./generate_packets.py In S2_1 and later this is already fixed. Backport from S2_1 attached. Hm, shouldn't the generated files be put into the build dir? or does generate_packets already do this? In that case it'd be more like: cd $(builddir) $(srcdir)/generate_packets.py -jason ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#40327) My units in enemy city
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40327 When logged in to RT as guest, there is a box in the middle of the dark-blue area at the top, which says Guests should email [EMAIL PROTECTED] to create tickets. It's in an html span element with class topactions There is also in the top left of the screen, send email to [EMAIL PROTECTED], but I missed that. Daniel Markstedt wrote: URL: http://bugs.freeciv.org/Ticket/Display.html?id=40327 Hi Andrew. Thanks for the report and savegame! The current bug reporting address is [EMAIL PROTECTED]. I have already forwarded your report there. I'm curious: where did you see the old bug reporting address? If you remember where it was, I will try and update it. Best, ~Daniel ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#40324) [patch] Hash table iterators and fast clear
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40324 Madeline Book wrote: The patch also implements hash_fast_clear which does the same as hash_delete_all_entries but much more quickly and efficiently. (It cannot be used unfortunately if the keys or values have associated free_funcs.) Why not just give hash_delete_all_entries a special case after a check for if there's a free_func? Having a second function that does almost the same thing isn't so good. -jason ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39131) Connection troubles
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39131 It actually occurs when the client connection is broken by the server whereas the server is reading a packet from. A simple example is when you attempt to cut yourself from the server. Then, your chat packet is parsed by the server, server breaks your connection and tries to send you processing_finished packet. For an unknown reason by me, the client is not able to recognize anymore it is connected to the server after reconnection. So it seems a double bug between the server and client side. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] Freeciv web client demo
Hello! Here is a new demo of the Freeciv web client: http://freeciv-web.game-host.org:8080/freeciv-web/login.jsp The game is almost playable, with authentication support and a custom pubserver. You can use the normal keyboard shortcuts from the GTK+ version. Only the left mouse button is useful, since browsers don't allow overriding the right mouse button. It works with Firefox 1.5+, Safari, Opera. It currently works best with a recent Firefox version. It also works with Internet Explorer 7+ if you have Silverlight installed, through excanvas. Note that my bandwidth is quite limited, which could make loading times quite high. Let me know if this works for you. It isn't quite the google-maps experience yet :-) - Andreas R. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] Freeciv web client demo
Andreas Røsdal wrote: Hello! Here is a new demo of the Freeciv web client: http://freeciv-web.game-host.org:8080/freeciv-web/login.jsp The game is almost playable, with authentication support and a custom pubserver. You can use the normal keyboard shortcuts from the GTK+ version. Only the left mouse button is useful, since browsers don't allow overriding the right mouse button. It works with Firefox 1.5+, Safari, Opera. It currently works best with a recent Firefox version. It also works with Internet Explorer 7+ if you have Silverlight installed, through excanvas. Note that my bandwidth is quite limited, which could make loading times quite high. Let me know if this works for you. It isn't quite the google-maps experience yet :-) Very nice indeed. But why doesn't it use ggz! -jason ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#40324) [patch] Hash table iterators and fast clear
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40324 [EMAIL PROTECTED] - Wed Jun 25 17:31:41 2008]: Madeline Book wrote: The patch also implements hash_fast_clear which does the same as hash_delete_all_entries but much more quickly and efficiently. (It cannot be used unfortunately if the keys or values have associated free_funcs.) Why not just give hash_delete_all_entries a special case after a check for if there's a free_func? Having a second function that does almost the same thing isn't so good. Oh, very good point. Version 2 of the patch makes the body of hash_fast_clear a special case of hash_delete_all_entries when there are no free_funcs. Also added is a wrapper macro for iteration, hash_iterate, to make the iteration interface analogous to list iteration. Finally, for the case when the programmer knows it would be more efficient if the hash table did not shrink automatically, a function hash_set_no_shrink is added. -- 木曜日は働く代わりに木を食べようとします。 diff --git a/utility/hash.c b/utility/hash.c index e2e7dc2..f1fbcb7 100644 --- a/utility/hash.c +++ b/utility/hash.c @@ -130,6 +130,7 @@ struct hash_table { unsigned int num_entries; /* does not included deleted entries */ unsigned int num_deleted; bool frozen; /* do not auto-resize when set */ + bool no_shrink; /* Do no shrink, settable by user. */ }; /* Calculate hash value given hash_table ptr and key: */ @@ -158,6 +159,7 @@ static void zero_htable(struct hash_table *h) h-free_data_func = NULL; h-num_buckets = h-num_entries = h-num_deleted = 0; h-frozen = FALSE; + h-no_shrink = FALSE; } @@ -438,6 +440,9 @@ static void hash_maybe_resize(struct hash_table *h, bool expandingp) if (h-frozen) { return; } + if (!expandingp h-no_shrink) { +return; + } num_used = h-num_entries + h-num_deleted; if (expandingp) { limit = FULL_RATIO * h-num_buckets; @@ -663,9 +668,16 @@ void hash_delete_all_entries(struct hash_table *h) { unsigned int bucket_nr; - /* Modeled after hash_key_by_number and hash_delete_entry. */ - for (bucket_nr = 0; bucket_nr h-num_buckets; bucket_nr++) { -hash_delete_bucket(h, h-buckets[bucket_nr], NULL, NULL); + if (h-free_key_func == NULL h-free_data_func == NULL) { +memset(h-buckets, 0, sizeof(struct hash_bucket) * h-num_buckets); +h-num_entries = 0; +h-num_deleted = 0; +h-frozen = FALSE; + } else { +/* Modeled after hash_key_by_number and hash_delete_entry. */ +for (bucket_nr = 0; bucket_nr h-num_buckets; bucket_nr++) { + hash_delete_bucket(h, h-buckets[bucket_nr], NULL, NULL); +} } hash_maybe_shrink(h); } @@ -771,3 +783,84 @@ const void *hash_value_by_number(const struct hash_table *h, { return hash_lookup_data(h, hash_key_by_number(h, entry_number)); } + +/** + If the hash table is not empty, sets 'iter' to point to the start of the + hash table and returns TRUE. Otherwise returns FALSE. +**/ +bool hash_get_start_iter(const struct hash_table *h, + struct hash_iter *iter) +{ + if (!h || !iter || hash_num_entries(h) 1) { +return FALSE; + } + + iter-table = h; + iter-index = -1; + return hash_iter_next(iter); +} + +/** + Set the iterator 'iter' to the next item in the hash table. Returns + FALSE if there are no more items. +**/ +bool hash_iter_next(struct hash_iter *iter) +{ + const struct hash_table *h; + struct hash_bucket *bucket; + + if (!iter || !iter-table) { +return FALSE; + } + + h = iter-table; + iter-index++; + + while (iter-index hash_num_buckets(h)) { +bucket = h-buckets + iter-index; +if (bucket bucket-used == BUCKET_USED) { + iter-key = bucket-key; + iter-value = bucket-data; + return TRUE; +} +iter-index++; + } + + return FALSE; +} + +/** + Returns the key of the hash table item pointed to by this iterator. +**/ +void *hash_iter_get_key(struct hash_iter *iter) +{ + if (!iter) { +return NULL; + } + return (void *) iter-key; +} + +/** + Returns the value (or data) of the hash table item pointed to by this + iterator. +**/ +void *hash_iter_get_value(struct hash_iter *iter) +{ + if (!iter) { +return NULL; + } + return (void *) iter-value; +} + +/** + Prevent or allow the hash table
Re: [Freeciv-Dev] Freeciv web client demo
Andreas Røsdal wrote: On Wed, 25 Jun 2008, Jason Dorje Short wrote: Andreas Røsdal wrote: Hello! Here is a new demo of the Freeciv web client: http://freeciv-web.game-host.org:8080/freeciv-web/login.jsp The game is almost playable, with authentication support and a custom pubserver. You can use the normal keyboard shortcuts from the GTK+ version. Only the left mouse button is useful, since browsers don't allow overriding the right mouse button. It works with Firefox 1.5+, Safari, Opera. It currently works best with a recent Firefox version. It also works with Internet Explorer 7+ if you have Silverlight installed, through excanvas. Note that my bandwidth is quite limited, which could make loading times quite high. Let me know if this works for you. It isn't quite the google-maps experience yet :-) Very nice indeed. But why doesn't it use ggz! GGZ would be ideal for this, but it is more complex, and it doesn't have a HTTP interface and doesn't support launching civclients... What's needed is a server-side library that can interface with your code (i.e., the http interface). Speaking of which, where is your code? -jason ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#40315) gtk client: unplayabe resizing of panel
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40315 Madeline Book wrote: URL: http://bugs.freeciv.org/Ticket/Display.html?id=40315 [EMAIL PROTECTED] - Tue Jun 24 09:31:17 2008]: This obnoxious hack fixes the problem. I have the very strong feeling there is some simple gtk setting to control this but i have no idea what it is. You could also try using gtk_label_set_max_width_chars (possibly in conjunction with size request) on the offending label, or just not put such a long string into it. I don't think that will necessarily help with variable-width texts. Or shorten some of the rather long terrain names in the ruleset. ;) Should be done anyway, but again won't always help. This problem has always happened even in the original rulesets. The behavior that's causing it is a bug in the GUI design. -jason ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#40315) gtk client: unplayabe resizing of panel
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40315 [EMAIL PROTECTED] - Tue Jun 24 09:31:17 2008]: This obnoxious hack fixes the problem. I have the very strong feeling there is some simple gtk setting to control this but i have no idea what it is. You could also try using gtk_label_set_max_width_chars (possibly in conjunction with size request) on the offending label, or just not put such a long string into it. Or shorten some of the rather long terrain names in the ruleset. ;) - 金曜日は働く代わりに私の地下室に金を掘っています。 ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] Freeciv web client demo
On Wed, 25 Jun 2008, Jason Dorje Short wrote: Andreas Røsdal wrote: Hello! Here is a new demo of the Freeciv web client: http://freeciv-web.game-host.org:8080/freeciv-web/login.jsp The game is almost playable, with authentication support and a custom pubserver. You can use the normal keyboard shortcuts from the GTK+ version. Only the left mouse button is useful, since browsers don't allow overriding the right mouse button. It works with Firefox 1.5+, Safari, Opera. It currently works best with a recent Firefox version. It also works with Internet Explorer 7+ if you have Silverlight installed, through excanvas. Note that my bandwidth is quite limited, which could make loading times quite high. Let me know if this works for you. It isn't quite the google-maps experience yet :-) Very nice indeed. But why doesn't it use ggz! GGZ would be ideal for this, but it is more complex, and it doesn't have a HTTP interface and doesn't support launching civclients... - Andreas___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev