[Freeciv-commits] r25005 - /trunk/common/unit.c
Author: pepeto Date: Mon Jun 2 09:14:01 2014 New Revision: 25005 URL: http://svn.gna.org/viewcvs/freeciv?rev=25005view=rev Log: Do not slow down unit_transport_get() with the useless usage of game_unit_by_number(). See gna patch #4694 Modified: trunk/common/unit.c Modified: trunk/common/unit.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.c?rev=25005r1=25004r2=25005view=diff == --- trunk/common/unit.c (original) +++ trunk/common/unit.c Mon Jun 2 09:14:01 2014 @@ -2350,12 +2350,7 @@ { fc_assert_ret_val(pcargo != NULL, NULL); - if (pcargo-transporter == NULL) { -return NULL; - } else { -/* Need this as the return value is not 'const'! */ -return game_unit_by_number(pcargo-transporter-id); - } + return pcargo-transporter; } /* ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25006 - /branches/S2_5/common/unit.c
Author: pepeto Date: Mon Jun 2 09:14:09 2014 New Revision: 25006 URL: http://svn.gna.org/viewcvs/freeciv?rev=25006view=rev Log: Do not slow down unit_transport_get() with the useless usage of game_unit_by_number(). See gna patch #4694 Modified: branches/S2_5/common/unit.c Modified: branches/S2_5/common/unit.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/unit.c?rev=25006r1=25005r2=25006view=diff == --- branches/S2_5/common/unit.c (original) +++ branches/S2_5/common/unit.c Mon Jun 2 09:14:09 2014 @@ -2373,12 +2373,7 @@ { fc_assert_ret_val(pcargo != NULL, NULL); - if (pcargo-transporter == NULL) { -return NULL; - } else { -/* Need this as the return value is not 'const'! */ -return game_unit_by_number(pcargo-transporter-id); - } + return pcargo-transporter; } /* ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25007 - /branches/S2_4/common/unit.c
Author: pepeto Date: Mon Jun 2 09:14:14 2014 New Revision: 25007 URL: http://svn.gna.org/viewcvs/freeciv?rev=25007view=rev Log: Do not slow down unit_transport_get() with the useless usage of game_unit_by_number(). See gna patch #4694 Modified: branches/S2_4/common/unit.c Modified: branches/S2_4/common/unit.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/common/unit.c?rev=25007r1=25006r2=25007view=diff == --- branches/S2_4/common/unit.c (original) +++ branches/S2_4/common/unit.c Mon Jun 2 09:14:14 2014 @@ -2144,12 +2144,7 @@ { fc_assert_ret_val(pcargo != NULL, NULL); - if (pcargo-transporter == NULL) { -return NULL; - } else { -/* Need this as the return value is not 'const'! */ -return game_unit_by_number(pcargo-transporter-id); - } + return pcargo-transporter; } /* ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25009 - /branches/S2_5/client/packhand.c
Author: pepeto Date: Mon Jun 2 09:18:49 2014 New Revision: 25009 URL: http://svn.gna.org/viewcvs/freeciv?rev=25009view=rev Log: Add error messages to catch packets from server for unknown units, allowing client hackers to guess units known seen. See gna patch #4725 Modified: branches/S2_5/client/packhand.c Modified: branches/S2_5/client/packhand.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/packhand.c?rev=25009r1=25008r2=25009view=diff == --- branches/S2_5/client/packhand.c (original) +++ branches/S2_5/client/packhand.c Mon Jun 2 09:18:49 2014 @@ -385,6 +385,9 @@ bool need_economy_report_update; if (!punit) { +log_error(Server wants us to remove unit id %d, + but we don't know about this unit!, + unit_id); return; } @@ -1674,6 +1677,10 @@ punit-client.transported_by = -1; client_remove_unit(punit); +} else { + log_error(Server wants us to move unit id %d out of sight, +but we don't know about this unit!, +packet-id); } return; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25008 - /trunk/client/packhand.c
Author: pepeto Date: Mon Jun 2 09:18:45 2014 New Revision: 25008 URL: http://svn.gna.org/viewcvs/freeciv?rev=25008view=rev Log: Add error messages to catch packets from server for unknown units, allowing client hackers to guess units known seen. See gna patch #4725 Modified: trunk/client/packhand.c Modified: trunk/client/packhand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/packhand.c?rev=25008r1=25007r2=25008view=diff == --- trunk/client/packhand.c (original) +++ trunk/client/packhand.c Mon Jun 2 09:18:45 2014 @@ -379,6 +379,9 @@ bool need_economy_report_update; if (!punit) { +log_error(Server wants us to remove unit id %d, + but we don't know about this unit!, + unit_id); return; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25010 - in /trunk: common/generate_packets.py common/government.c utility/genhash.c utility/genhash.h utility/spechash.h
Author: pepeto Date: Mon Jun 2 09:24:46 2014 New Revision: 25010 URL: http://svn.gna.org/viewcvs/freeciv?rev=25010view=rev Log: Do not assume the hash values of the caller will match the number of buckets. Move the modulo inside genhash module. See gna patch #4729 Modified: trunk/common/generate_packets.py trunk/common/government.c trunk/utility/genhash.c trunk/utility/genhash.h trunk/utility/spechash.h Modified: trunk/common/generate_packets.py URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/generate_packets.py?rev=25010r1=25009r2=25010view=diff == --- trunk/common/generate_packets.py(original) +++ trunk/common/generate_packets.pyMon Jun 2 09:24:46 2014 @@ -716,7 +716,7 @@ if len(self.key_fields)==0: return #define hash_%(name)s hash_const\n\n%self.__dict__ else: -intro='''static genhash_val_t hash_%(name)s(const void *vkey, size_t num_buckets) +intro='''static genhash_val_t hash_%(name)s(const void *vkey) { '''%self.__dict__ @@ -731,7 +731,7 @@ a=(%s 8) ^ %s%(keys[0], keys[1]) else: assert 0 -body=body+(' return ((%s) %% num_buckets);\n'%a) +body=body+(' return %s;\n'%a) extro=}\n\n return intro+body+extro @@ -1640,7 +1640,7 @@ #include packets.h -static genhash_val_t hash_const(const void *vkey, size_t num_buckets) +static genhash_val_t hash_const(const void *vkey) { return 0; } Modified: trunk/common/government.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/government.c?rev=25010r1=25009r2=25010view=diff == --- trunk/common/government.c (original) +++ trunk/common/government.c Mon Jun 2 09:24:46 2014 @@ -192,13 +192,9 @@ / Hash function. / -static genhash_val_t nation_hash_val(const struct nation_type *pnation, - size_t num_buckets) -{ - genhash_val_t base = (NULL != pnation ? nation_number(pnation) -: nation_count()); - - return base % num_buckets; +static genhash_val_t nation_hash_val(const struct nation_type *pnation) +{ + return NULL != pnation ? nation_number(pnation) : nation_count(); } / Modified: trunk/utility/genhash.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/genhash.c?rev=25010r1=25009r2=25010view=diff == --- trunk/utility/genhash.c (original) +++ trunk/utility/genhash.c Mon Jun 2 09:24:46 2014 @@ -105,7 +105,7 @@ A supplied genhash function appropriate to nul-terminated strings. Prefers table sizes that are prime numbers. / -genhash_val_t genhash_str_val_func(const void *vkey, size_t num_buckets) +genhash_val_t genhash_str_val_func(const void *vkey) { const char *key = (const char *) vkey; unsigned long result = 0; @@ -115,7 +115,7 @@ result += *key; } result = 0x; /* To make results independent of sizeof(long) */ - return (result % num_buckets); + return result; } / @@ -150,10 +150,10 @@ themselves; this way a void* (or, with casting, a long) can be used as a key, and also without having allocated space for it. ***/ -genhash_val_t genhash_ptr_val_func(const void *vkey, size_t num_buckets) +genhash_val_t genhash_ptr_val_func(const void *vkey) { intptr_t result = ((intptr_t) vkey); - return (result % num_buckets); + return result; } / @@ -361,7 +361,7 @@ end = bucket + pgenhash-num_buckets; for (; bucket end; bucket++) { for (iter = *bucket; NULL != iter; iter = next) { - slot = new_buckets + key_val_func(iter-key, new_nbuckets); + slot = new_buckets + (key_val_func(iter-key) % new_nbuckets); next = iter-next; iter-next = *slot; *slot = iter; @@ -429,7 +429,7 @@ struct genhash_entry **slot; for (slot = (pgenhash-buckets - + pgenhash-key_val_func(key, pgenhash-num_buckets)); + + (pgenhash-key_val_func(key) % pgenhash-num_buckets)); NULL != *slot; slot = (*slot)-next) { if (pgenhash-key_comp_func((*slot)-key, key)) { return slot; Modified: trunk/utility/genhash.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/genhash.h?rev=25010r1=25009r2=25010view=diff
[Freeciv-commits] r25011 - /trunk/utility/genhash.c
Author: pepeto Date: Mon Jun 2 09:26:58 2014 New Revision: 25011 URL: http://svn.gna.org/viewcvs/freeciv?rev=25011view=rev Log: Cache the hash values for every entry of the hash tables. See gna patch #4730 Modified: trunk/utility/genhash.c Modified: trunk/utility/genhash.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/genhash.c?rev=25011r1=25010r2=25011view=diff == --- trunk/utility/genhash.c (original) +++ trunk/utility/genhash.c Mon Jun 2 09:26:58 2014 @@ -75,6 +75,7 @@ struct genhash_entry { void *key; void *data; + genhash_val_t hash_val; struct genhash_entry *next; }; @@ -351,7 +352,6 @@ { struct genhash_entry **new_buckets, **bucket, **end, **slot; struct genhash_entry *iter, *next; - genhash_val_fn_t key_val_func = pgenhash-key_val_func; fc_assert(new_nbuckets = pgenhash-num_entries); @@ -361,7 +361,7 @@ end = bucket + pgenhash-num_buckets; for (; bucket end; bucket++) { for (iter = *bucket; NULL != iter; iter = next) { - slot = new_buckets + (key_val_func(iter-key) % new_nbuckets); + slot = new_buckets + (iter-hash_val % new_nbuckets); next = iter-next; iter-next = *slot; *slot = iter; @@ -424,14 +424,16 @@ it should go if it is to be a new key. / static inline struct genhash_entry ** -genhash_slot_lookup(const struct genhash *pgenhash, const void *key) +genhash_slot_lookup(const struct genhash *pgenhash, +const void *key, +genhash_val_t hash_val) { struct genhash_entry **slot; - for (slot = (pgenhash-buckets - + (pgenhash-key_val_func(key) % pgenhash-num_buckets)); + for (slot = (pgenhash-buckets + (hash_val % pgenhash-num_buckets)); NULL != *slot; slot = (*slot)-next) { -if (pgenhash-key_comp_func((*slot)-key, key)) { +if (hash_val == (*slot)-hash_val + pgenhash-key_comp_func((*slot)-key, key)) { return slot; } } @@ -472,12 +474,14 @@ / static inline void genhash_slot_create(struct genhash *pgenhash, struct genhash_entry **slot, - const void *key, const void *data) + const void *key, const void *data, + genhash_val_t hash_val) { struct genhash_entry *entry = fc_malloc(sizeof(*entry)); entry-key = pgenhash-key_copy_func(key); entry-data = pgenhash-data_copy_func(data); + entry-hash_val = hash_val; entry-next = *slot; *slot = entry; } @@ -572,8 +576,10 @@ for (; src_bucket end; src_bucket++, dest_bucket++) { dest_slot = dest_bucket; -for (src_iter = *src_bucket; NULL != src_iter; src_iter = src_iter-next) { - genhash_slot_create(new_genhash, dest_slot, src_iter-key, src_iter-data); +for (src_iter = *src_bucket; NULL != src_iter; + src_iter = src_iter-next) { + genhash_slot_create(new_genhash, dest_slot, src_iter-key, + src_iter-data, src_iter-hash_val); dest_slot = (*dest_slot)-next; } } @@ -610,15 +616,17 @@ const void *data) { struct genhash_entry **slot; + genhash_val_t hash_val; fc_assert_ret_val(NULL != pgenhash, FALSE); genhash_maybe_expand(pgenhash); - slot = genhash_slot_lookup(pgenhash, key); + hash_val = pgenhash-key_val_func(key); + slot = genhash_slot_lookup(pgenhash, key, hash_val); if (NULL != *slot) { return FALSE; } else { -genhash_slot_create(pgenhash, slot, key, data); +genhash_slot_create(pgenhash, slot, key, data, hash_val); pgenhash-num_entries++; return TRUE; } @@ -649,12 +657,14 @@ void **old_pdata) { struct genhash_entry **slot; + genhash_val_t hash_val; fc_assert_action(NULL != pgenhash, genhash_default_get(old_pkey, old_pdata); return FALSE); genhash_maybe_expand(pgenhash); - slot = genhash_slot_lookup(pgenhash, key); + hash_val = pgenhash-key_val_func(key); + slot = genhash_slot_lookup(pgenhash, key, hash_val); if (NULL != *slot) { /* Replace. */ genhash_slot_get(slot, old_pkey, old_pdata); @@ -663,7 +673,7 @@ } else { /* Insert. */ genhash_default_get(old_pkey, old_pdata); -genhash_slot_create(pgenhash, slot, key, data); +genhash_slot_create(pgenhash, slot, key, data, hash_val); pgenhash-num_entries++; return FALSE; } @@ -681,7 +691,7 @@ fc_assert_action(NULL != pgenhash, genhash_default_get(NULL, pdata); return FALSE); - slot = genhash_slot_lookup(pgenhash, key); + slot = genhash_slot_lookup(pgenhash, key, pgenhash-key_val_func(key)); if (NULL != *slot) { genhash_slot_get(slot,
[Freeciv-commits] r25013 - in /trunk: ai/default/ client/ client/gui-gtk-2.0/ client/gui-gtk-3.0/ client/gui-sdl/ client/gui-sdl2/ client/gui-...
Author: pepeto Date: Mon Jun 2 09:47:46 2014 New Revision: 25013 URL: http://svn.gna.org/viewcvs/freeciv?rev=25013view=rev Log: Rename 'player_research' to 'research'. See gna patch #4727 Modified: trunk/ai/default/advdiplomacy.c trunk/ai/default/aidiplomat.c trunk/ai/default/aihand.c trunk/ai/default/aitech.c trunk/client/climisc.c trunk/client/gui-gtk-2.0/inteldlg.c trunk/client/gui-gtk-2.0/repodlgs.c trunk/client/gui-gtk-3.0/inteldlg.c trunk/client/gui-gtk-3.0/repodlgs.c trunk/client/gui-sdl/inteldlg.c trunk/client/gui-sdl/mapview.c trunk/client/gui-sdl/repodlgs.c trunk/client/gui-sdl2/inteldlg.c trunk/client/gui-sdl2/mapview.c trunk/client/gui-sdl2/repodlgs.c trunk/client/gui-xaw/inteldlg.c trunk/client/gui-xaw/repodlgs.c trunk/client/packhand.c trunk/client/reqtree.c trunk/client/text.c trunk/common/game.c trunk/common/player.c trunk/common/research.c trunk/common/research.h trunk/common/tech.c trunk/common/tech.h trunk/server/advisors/advdata.c trunk/server/diplomats.c trunk/server/edithand.c trunk/server/notify.c trunk/server/plrhand.c trunk/server/report.c trunk/server/savegame.c trunk/server/savegame2.c trunk/server/score.c trunk/server/scripting/api_server_edit.c trunk/server/srv_main.c trunk/server/techtools.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/ai/default/advdiplomacy.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/advdiplomacy.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/ai/default/aidiplomat.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aidiplomat.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/ai/default/aihand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aihand.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/ai/default/aitech.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aitech.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/climisc.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/climisc.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/gui-gtk-2.0/inteldlg.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/inteldlg.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/gui-gtk-2.0/repodlgs.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/repodlgs.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/gui-gtk-3.0/inteldlg.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/inteldlg.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/gui-gtk-3.0/repodlgs.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/repodlgs.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/gui-sdl/inteldlg.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl/inteldlg.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/gui-sdl/mapview.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl/mapview.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/gui-sdl/repodlgs.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl/repodlgs.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/gui-sdl2/inteldlg.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/inteldlg.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/gui-sdl2/mapview.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/mapview.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/gui-sdl2/repodlgs.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/repodlgs.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/gui-xaw/inteldlg.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-xaw/inteldlg.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/gui-xaw/repodlgs.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-xaw/repodlgs.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/packhand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/packhand.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/reqtree.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/reqtree.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/client/text.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/text.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/common/game.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/game.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/common/player.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/player.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/common/research.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/research.c?rev=25013r1=25012r2=25013view=diff Modified: trunk/common/research.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/research.h?rev=25013r1=25012r2=25013view=diff Modified: trunk/common/tech.c URL:
[Freeciv-commits] r25014 - in /trunk: common/research.c common/research.h server/notify.c server/techtools.c
Author: pepeto Date: Mon Jun 2 09:51:03 2014 New Revision: 25014 URL: http://svn.gna.org/viewcvs/freeciv?rev=25014view=rev Log: Add utility to iterate players which share the same research. See gna patch #4728 Modified: trunk/common/research.c trunk/common/research.h trunk/server/notify.c trunk/server/techtools.c Modified: trunk/common/research.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/research.c?rev=25014r1=25013r2=25014view=diff == --- trunk/common/research.c (original) +++ trunk/common/research.c Mon Jun 2 09:51:03 2014 @@ -23,6 +23,8 @@ /* common */ #include fc_types.h #include game.h +#include player.h +#include team.h #include research.h @@ -32,6 +34,15 @@ int index; }; #define RESEARCH_ITER(p) ((struct research_iter *) p) + +struct research_player_iter { + struct iterator vtable; + union { +struct player *pplayer; +struct player_list_link *plink; + }; +}; +#define RESEARCH_PLAYER_ITER(p) ((struct research_player_iter *) p) static struct research research_array[MAX_NUM_PLAYER_SLOTS]; @@ -57,6 +68,25 @@ } / + Returns the index of the research in the array. +/ +int research_number(const struct research *presearch) +{ + fc_assert_ret_val(NULL != presearch, -1); + return presearch - research_array; +} + +/ + Returns the research for the given index. +/ +struct research *research_by_number(int number) +{ + fc_assert_ret_val(0 = number, NULL); + fc_assert_ret_val(ARRAY_SIZE(research_array) number, NULL); + return research_array[number]; +} + +/ Returns the research structure associated with the player. / struct research *research_get(const struct player *pplayer) @@ -159,3 +189,100 @@ base-next(base); return base; } + +/ + Returns the real size of the research player iterator. +/ +size_t research_player_iter_sizeof(void) +{ + return sizeof(struct research_player_iter); +} + +/ + Returns player of the iterator. +/ +static void research_player_iter_validate(struct iterator *it) +{ + const struct player *pplayer; + + for (pplayer = iterator_get(it); NULL != pplayer !pplayer-is_alive; + pplayer = iterator_get(it)) { +iterator_next(it); + } +} + +/ + Returns player of the iterator. +/ +static void *research_player_iter_pooled_get(const struct iterator *it) +{ + return player_list_link_data(RESEARCH_PLAYER_ITER(it)-plink); +} + +/ + Returns the next player sharing the research. +/ +static void research_player_iter_pooled_next(struct iterator *it) +{ + struct research_player_iter *rpit = RESEARCH_PLAYER_ITER(it); + + rpit-plink = player_list_link_next(rpit-plink); + research_player_iter_validate(it); +} + +/ + Returns whether the iterate is valid. +/ +static bool research_player_iter_pooled_valid(const struct iterator *it) +{ + return NULL != RESEARCH_PLAYER_ITER(it)-plink; +} + +/ + Returns player of the iterator. +/ +static void *research_player_iter_not_pooled_get(const struct iterator *it) +{ + return RESEARCH_PLAYER_ITER(it)-pplayer; +} + +/ + Invalidate the iterator. +/ +static void research_player_iter_not_pooled_next(struct iterator *it) +{ + RESEARCH_PLAYER_ITER(it)-pplayer = NULL; +} + +/ + Returns whether the iterate is valid. +/ +static bool
[Freeciv-commits] r25015 - in /trunk: ./ client/ common/ data/alien/ data/civ1/ data/civ2/ data/civ2civ3/ data/classic/ data/experimental/ dat...
Author: cazfi Date: Mon Jun 2 19:14:15 2014 New Revision: 25015 URL: http://svn.gna.org/viewcvs/freeciv?rev=25015view=rev Log: Support versioning of custom rulesets. See patch #4734 Modified: trunk/client/helpdata.c trunk/common/packets.def trunk/data/alien/game.ruleset trunk/data/civ1/game.ruleset trunk/data/civ2/game.ruleset trunk/data/civ2civ3/game.ruleset trunk/data/classic/game.ruleset trunk/data/experimental/game.ruleset trunk/data/multiplayer/game.ruleset trunk/fc_version trunk/server/ruleset.c trunk/tools/ruledit/rulesave.c trunk/tools/ruledit/tab_misc.cpp trunk/tools/ruledit/tab_misc.h Modified: trunk/client/helpdata.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/helpdata.c?rev=25015r1=25014r2=25015view=diff == --- trunk/client/helpdata.c (original) +++ trunk/client/helpdata.c Mon Jun 2 19:14:15 2014 @@ -2358,25 +2358,54 @@ Q_(HELP_RULESET_ITEM)); pitem-topic = fc_strdup(name); if (game.control.description[0] != '\0') { - int len = strlen(_(game.control.name)) -+ strlen(\n\n) -+ strlen(_(game.control.description)) -+ 1; - - pitem-text = fc_malloc(len); - fc_snprintf(pitem-text, len, %s\n\n%s, - _(game.control.name), _(game.control.description)); + if (game.control.version[0] != '\0') { +int len = strlen(_(game.control.name)) + + strlen( ) + + strlen(game.control.version) + + strlen(\n\n) + + strlen(_(game.control.description)) + + 1; + +pitem-text = fc_malloc(len); +fc_snprintf(pitem-text, len, %s %s\n\n%s, +_(game.control.name), game.control.version, +_(game.control.description)); + } else { +int len = strlen(_(game.control.name)) + + strlen(\n\n) + + strlen(_(game.control.description)) + + 1; + +pitem-text = fc_malloc(len); +fc_snprintf(pitem-text, len, %s\n\n%s, +_(game.control.name), _(game.control.description)); + } } else { const char *nodesc = _(Current ruleset contains no description.); - int len = strlen(_(game.control.name)) -+ strlen(\n\n) -+ strlen(nodesc) -+ 1; - - pitem-text = fc_malloc(len); - fc_snprintf(pitem-text, len, %s\n\n%s, - _(game.control.name), - nodesc); + + if (game.control.version[0] != '\0') { +int len = strlen(_(game.control.name)) + + strlen( ) + + strlen(game.control.version) + + strlen(\n\n) + + strlen(nodesc) + + 1; + +pitem-text = fc_malloc(len); +fc_snprintf(pitem-text, len, %s %s\n\n%s, +_(game.control.name), game.control.version, +nodesc); + } else { +int len = strlen(_(game.control.name)) + + strlen(\n\n) + + strlen(nodesc) + + 1; + +pitem-text = fc_malloc(len); +fc_snprintf(pitem-text, len, %s\n\n%s, +_(game.control.name), +nodesc); + } } help_list_append(help_nodes, pitem); break; Modified: trunk/common/packets.def URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/packets.def?rev=25015r1=25014r2=25015view=diff == --- trunk/common/packets.def(original) +++ trunk/common/packets.defMon Jun 2 19:14:15 2014 @@ -1633,6 +1633,7 @@ BOOL popup_tech_help; STRING name[MAX_LEN_NAME]; + STRING version[MAX_LEN_NAME]; STRING description[MAX_LEN_PACKET]; end Modified: trunk/data/alien/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/game.ruleset?rev=25015r1=25014r2=25015view=diff == --- trunk/data/alien/game.ruleset (original) +++ trunk/data/alien/game.ruleset Mon Jun 2 19:14:15 2014 @@ -7,6 +7,9 @@ [about] ; Ruleset name name = _(Alien World) + +; There's no separate versioning in rulesets part of main freeciv distribution +;version = ; Description of the ruleset description = _(One of the design goals of this ruleset is that it has to \ Modified: trunk/data/civ1/game.ruleset URL:
[Freeciv-commits] r25016 - /trunk/common/borders.c
Author: cazfi Date: Mon Jun 2 19:48:42 2014 New Revision: 25016 URL: http://svn.gna.org/viewcvs/freeciv?rev=25016view=rev Log: When determining borders, use owner of the border claiming base, not tile owner. See bug #22110 Modified: trunk/common/borders.c Modified: trunk/common/borders.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/borders.c?rev=25016r1=25015r2=25016view=diff == --- trunk/common/borders.c (original) +++ trunk/common/borders.c Mon Jun 2 19:48:42 2014 @@ -110,7 +110,7 @@ return TRUE; } - if (tile_owner(ptile) != NULL) { + if (base_owner(ptile) != NULL) { base_type_iterate(pbase) { if (tile_has_base(ptile, pbase) territory_claiming_base(pbase)) { return TRUE; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25017 - in /trunk: translations/Strings.txt win32/installer/Makefile
Author: cazfi Date: Mon Jun 2 20:26:32 2014 New Revision: 25017 URL: http://svn.gna.org/viewcvs/freeciv?rev=25017view=rev Log: Made windows installer build followtag win32-S2_6 in trunk. See patch #4748 Modified: trunk/translations/Strings.txt trunk/win32/installer/Makefile Modified: trunk/translations/Strings.txt URL: http://svn.gna.org/viewcvs/freeciv/trunk/translations/Strings.txt?rev=25017r1=25016r2=25017view=diff == --- trunk/translations/Strings.txt (original) +++ trunk/translations/Strings.txt Mon Jun 2 20:26:32 2014 @@ -14,3 +14,4 @@ _(?vertag:S2_5) _(?vertag:S2_6) _(?vertag:crosser) +_(?vertag:win32-S2_6) Modified: trunk/win32/installer/Makefile URL: http://svn.gna.org/viewcvs/freeciv/trunk/win32/installer/Makefile?rev=25017r1=25016r2=25017view=diff == --- trunk/win32/installer/Makefile (original) +++ trunk/win32/installer/Makefile Mon Jun 2 20:26:32 2014 @@ -43,7 +43,7 @@ # create build directory mkdir -p build-$(GUI) # configure - cd build-$(GUI); ../../../configure --enable-client=$(GUI) --with-followtag=win32 --enable-fcdb=sqlite3 --enable-fcmp=$(FCMP) + cd build-$(GUI); ../../../configure --enable-client=$(GUI) --with-followtag=win32-S2_6 --enable-fcdb=sqlite3 --enable-fcmp=$(FCMP) # make make -C build-$(GUI) ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25018 - in /trunk/client: gui-sdl/repodlgs.c gui-sdl2/repodlgs.c
Author: jtn Date: Mon Jun 2 23:07:07 2014 New Revision: 25018 URL: http://svn.gna.org/viewcvs/freeciv?rev=25018view=rev Log: Fix compilation of SDL clients, broken by patch #4727. Reported by Marko Lindqvist (cazfi@gna). See gna bug #22129. Modified: trunk/client/gui-sdl/repodlgs.c trunk/client/gui-sdl2/repodlgs.c Modified: trunk/client/gui-sdl/repodlgs.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl/repodlgs.c?rev=25018r1=25017r2=25018view=diff == --- trunk/client/gui-sdl/repodlgs.c (original) +++ trunk/client/gui-sdl/repodlgs.c Mon Jun 2 23:07:07 2014 @@ -2633,11 +2633,11 @@ get_theme_color(COLOR_THEME_SCIENCEDLG_FRAME)); if (cost adj_size(286)) { - cost = (adj_size(286) + cost = adj_size(286) * ((float) research_get(client_player())-bulbs_researched / cost); } else { - cost = ((float) cost + cost = (float) cost * ((float) research_get(client_player())-bulbs_researched / cost); } Modified: trunk/client/gui-sdl2/repodlgs.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/repodlgs.c?rev=25018r1=25017r2=25018view=diff == --- trunk/client/gui-sdl2/repodlgs.c(original) +++ trunk/client/gui-sdl2/repodlgs.cMon Jun 2 23:07:07 2014 @@ -2667,11 +2667,11 @@ #endif if (cost adj_size(286)) { - cost = (adj_size(286) + cost = adj_size(286) * ((float) research_get(client_player())-bulbs_researched / cost); } else { - cost = ((float) cost + cost = (float) cost * ((float) research_get(client_player())-bulbs_researched / cost); } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25019 - in /trunk/client/gui-qt: plrdlg.cpp repodlgs.cpp
Author: jtn Date: Mon Jun 2 23:21:22 2014 New Revision: 25019 URL: http://svn.gna.org/viewcvs/freeciv?rev=25019view=rev Log: Fix compilation of QT client after patch #4727. Reported by Marko Lindqvist (cazfi@gna). See gna bug #22129. Modified: trunk/client/gui-qt/plrdlg.cpp trunk/client/gui-qt/repodlgs.cpp Modified: trunk/client/gui-qt/plrdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/plrdlg.cpp?rev=25019r1=25018r2=25019view=diff == --- trunk/client/gui-qt/plrdlg.cpp (original) +++ trunk/client/gui-qt/plrdlg.cpp Mon Jun 2 23:21:22 2014 @@ -327,7 +327,7 @@ QModelIndexList indexes = sl.indexes(); struct city *pcity; const struct player_diplstate *state; - struct player_research *research; + struct research *research; char tbuf[256]; QString res; QString sp = ; @@ -356,7 +356,7 @@ return; } pcity = player_capital(pplayer); - research = player_research_get(pplayer); + research = research_get(pplayer); switch (research-researching) { case A_UNKNOWN: Modified: trunk/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/repodlgs.cpp?rev=25019r1=25018r2=25019view=diff == --- trunk/client/gui-qt/repodlgs.cpp(original) +++ trunk/client/gui-qt/repodlgs.cppMon Jun 2 23:21:22 2014 @@ -218,7 +218,7 @@ void science_report::update_report() { - struct player_research *research = player_research_get(client_player()); + struct research *research = research_get(client_player()); const char *text; int total; int done = research-bulbs_researched; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25022 - in /trunk/data: civ1/ civ2/ classic/ experimental/ multiplayer/
Author: jtn Date: Mon Jun 2 23:27:09 2014 New Revision: 25022 URL: http://svn.gna.org/viewcvs/freeciv?rev=25022view=rev Log: Tweak Barracks effect exclusions so that in the rare case older buildings coexist with newer ones, the older ones are treated as redundant in the UI. See gna bug #22080. Modified: trunk/data/civ1/effects.ruleset trunk/data/civ2/effects.ruleset trunk/data/classic/effects.ruleset trunk/data/experimental/effects.ruleset trunk/data/multiplayer/effects.ruleset Modified: trunk/data/civ1/effects.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/effects.ruleset?rev=25022r1=25021r2=25022view=diff == --- trunk/data/civ1/effects.ruleset (original) +++ trunk/data/civ1/effects.ruleset Mon Jun 2 23:27:09 2014 @@ -552,8 +552,10 @@ type= Veteran_Build value = 1 reqs = -{ type, name, range - Building, Barracks, City +{ type, name, range, present + Building, Barracks, City, TRUE + Building, Barracks II, City, FALSE + Building, Barracks III, City, FALSE } [effect_barracks_ii] @@ -562,17 +564,15 @@ reqs = { type, name, range, present Building, Barracks II, City, TRUE - Building, Barracks, City, FALSE + Building, Barracks III, City, FALSE } [effect_barracks_iii] type= Veteran_Build value = 1 reqs = -{ type, name, range, present - Building, Barracks III, City, TRUE - Building, Barracks, City, FALSE - Building, Barracks II, City, FALSE +{ type, name, range + Building, Barracks III, City } [effect_cathedral] Modified: trunk/data/civ2/effects.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/effects.ruleset?rev=25022r1=25021r2=25022view=diff == --- trunk/data/civ2/effects.ruleset (original) +++ trunk/data/civ2/effects.ruleset Mon Jun 2 23:27:09 2014 @@ -911,15 +911,19 @@ UnitClass, Land, Local, TRUE UnitFlag, NonMil, Local, FALSE UnitFlag, NoVeteran, Local, FALSE + Building, Barracks II, City, FALSE + Building, Barracks III, City, FALSE } [effect_barracks_1] type= HP_Regen value = 100 reqs = -{ type, name, range - Building, Barracks, City - UnitClass, Land, Local +{ type, name, range, present + Building, Barracks, City, TRUE + UnitClass, Land, Local, TRUE + Building, Barracks II, City, FALSE + Building, Barracks III, City, FALSE } [effect_barracks_ii] @@ -931,16 +935,17 @@ UnitClass, Land, Local, TRUE UnitFlag, NonMil, Local, FALSE UnitFlag, NoVeteran, Local, FALSE - Building, Barracks, City, FALSE + Building, Barracks III, City, FALSE } [effect_barracks_ii_1] type= HP_Regen value = 100 reqs = -{ type, name, range - Building, Barracks II, City - UnitClass, Land, Local +{ type, name, range, present + Building, Barracks II, City, TRUE + UnitClass, Land, Local, TRUE + Building, Barracks III, City, FALSE } [effect_barracks_iii] @@ -952,8 +957,6 @@ UnitClass, Land, Local, TRUE UnitFlag, NonMil, Local, FALSE UnitFlag, NoVeteran, Local, FALSE - Building, Barracks, City, FALSE - Building, Barracks II, City, FALSE } [effect_barracks_iii_1] Modified: trunk/data/classic/effects.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/effects.ruleset?rev=25022r1=25021r2=25022view=diff == --- trunk/data/classic/effects.ruleset (original) +++ trunk/data/classic/effects.ruleset Mon Jun 2 23:27:09 2014 @@ -793,15 +793,19 @@ UnitClass, Land, Local, TRUE UnitFlag, NonMil, Local, FALSE UnitFlag, NoVeteran, Local, FALSE + Building, Barracks II, City, FALSE + Building, Barracks III, City, FALSE } [effect_barracks_1] type= HP_Regen value = 100 reqs = -{ type, name, range - Building, Barracks, City - UnitClass, Land, Local +{ type, name, range, present + Building, Barracks, City, TRUE + UnitClass, Land, Local, TRUE + Building, Barracks II, City, FALSE + Building, Barracks III, City, FALSE } [effect_barracks_ii] @@ -813,16 +817,17 @@ UnitClass, Land, Local, TRUE UnitFlag, NonMil, Local, FALSE UnitFlag, NoVeteran, Local, FALSE - Building, Barracks, City, FALSE + Building, Barracks III, City, FALSE } [effect_barracks_ii_1] type= HP_Regen value = 100 reqs = -{ type, name, range - Building, Barracks II, City - UnitClass, Land, Local +{ type, name, range, present + Building, Barracks II, City, TRUE + UnitClass, Land, Local, TRUE + Building, Barracks III, City, FALSE } [effect_barracks_iii] @@ -834,8
[Freeciv-commits] r25023 - /trunk/server/cityturn.c
Author: jtn Date: Mon Jun 2 23:27:12 2014 New Revision: 25023 URL: http://svn.gna.org/viewcvs/freeciv?rev=25023view=rev Log: Reorder disaster effects so that city destroyed by population loss is not subsequently referenced. See gna bug #22083. Modified: trunk/server/cityturn.c Modified: trunk/server/cityturn.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/cityturn.c?rev=25023r1=25022r2=25023view=diff == --- trunk/server/cityturn.c (original) +++ trunk/server/cityturn.c Mon Jun 2 23:27:12 2014 @@ -3051,7 +3051,6 @@ struct player *pplayer = city_owner(pcity); struct tile *ptile = city_tile(pcity); bool had_effect = FALSE; - struct city *city_or_null = pcity; log_debug(%s at %s, disaster_rule_name(pdis), city_name(pcity)); @@ -3061,25 +3060,18 @@ _(%s was hit by %s.), city_name(pcity), disaster_rule_name(pdis)); - if (disaster_has_effect(pdis, DE_DESTROY_BUILDING)) { -int total = 0; -struct impr_type *imprs[B_LAST]; - -city_built_iterate(pcity, pimprove) { - if (is_improvement(pimprove)) { -imprs[total++] = pimprove; - } -} city_built_iterate_end; - -if (total 0) { - int num = fc_rand(total); - - building_lost(pcity, imprs[num]); - + if (disaster_has_effect(pdis, DE_POLLUTION)) { +if (place_pollution(pcity, EC_POLLUTION)) { notify_player(pplayer, ptile, E_DISASTER, ftc_server, -_(%s destroyed.), -improvement_name_translation(imprs[num])); - +_(Tile polluted)); + had_effect = TRUE; +} + } + + if (disaster_has_effect(pdis, DE_FALLOUT)) { +if (place_pollution(pcity, EC_FALLOUT)) { + notify_player(pplayer, ptile, E_DISASTER, ftc_server, +_(Fallout contaminated tile.)); had_effect = TRUE; } } @@ -3090,7 +3082,7 @@ if (!city_reduce_size(pcity, 1, NULL)) { notify_player(pplayer, ptile, E_DISASTER, ftc_server, _(City got destroyed completely.)); - city_or_null = NULL; + pcity = NULL; } else { notify_player(pplayer, ptile, E_DISASTER, ftc_server, _(Some population lost.)); @@ -3099,7 +3091,30 @@ had_effect = TRUE; } - if (disaster_has_effect(pdis, DE_EMPTY_FOODSTOCK)) { + if (pcity disaster_has_effect(pdis, DE_DESTROY_BUILDING)) { +int total = 0; +struct impr_type *imprs[B_LAST]; + +city_built_iterate(pcity, pimprove) { + if (is_improvement(pimprove)) { +imprs[total++] = pimprove; + } +} city_built_iterate_end; + +if (total 0) { + int num = fc_rand(total); + + building_lost(pcity, imprs[num]); + + notify_player(pplayer, ptile, E_DISASTER, ftc_server, +_(%s destroyed.), +improvement_name_translation(imprs[num])); + + had_effect = TRUE; +} + } + + if (pcity disaster_has_effect(pdis, DE_EMPTY_FOODSTOCK)) { if (pcity-food_stock 0) { pcity-food_stock = 0; @@ -3110,7 +3125,7 @@ } } - if (disaster_has_effect(pdis, DE_EMPTY_PRODSTOCK)) { + if (pcity disaster_has_effect(pdis, DE_EMPTY_PRODSTOCK)) { if (pcity-shield_stock 0) { pcity-shield_stock = 0; @@ -3119,22 +3134,6 @@ had_effect = TRUE; -} - } - - if (disaster_has_effect(pdis, DE_POLLUTION)) { -if (place_pollution(pcity, EC_POLLUTION)) { - notify_player(pplayer, ptile, E_DISASTER, ftc_server, -_(Tile polluted)); - had_effect = TRUE; -} - } - - if (disaster_has_effect(pdis, DE_FALLOUT)) { -if (place_pollution(pcity, EC_FALLOUT)) { - notify_player(pplayer, ptile, E_DISASTER, ftc_server, -_(Fallout contaminated tile.)); - had_effect = TRUE; } } @@ -3145,7 +3144,7 @@ script_server_signal_emit(disaster, 2, API_TYPE_DISASTER, pdis, -API_TYPE_CITY, city_or_null); +API_TYPE_CITY, pcity); } /** ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25027 - /branches/S2_5/server/cityturn.c
Author: jtn Date: Mon Jun 2 23:28:48 2014 New Revision: 25027 URL: http://svn.gna.org/viewcvs/freeciv?rev=25027view=rev Log: Reorder disaster effects code for consistency with trunk, and so that if assertion fails, NULL pointer isn't dereferenced. See gna bug #22083. Modified: branches/S2_5/server/cityturn.c Modified: branches/S2_5/server/cityturn.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/cityturn.c?rev=25027r1=25026r2=25027view=diff == --- branches/S2_5/server/cityturn.c (original) +++ branches/S2_5/server/cityturn.c Mon Jun 2 23:28:48 2014 @@ -2924,7 +2924,6 @@ struct player *pplayer = city_owner(pcity); struct tile *ptile = city_tile(pcity); bool had_effect = FALSE; - struct city *city_or_null = pcity; log_debug(%s at %s, disaster_rule_name(pdis), city_name(pcity)); @@ -2934,65 +2933,6 @@ _(%s was hit by %s.), city_name(pcity), disaster_rule_name(pdis)); - if (disaster_has_effect(pdis, DE_DESTROY_BUILDING)) { -int total = 0; -struct impr_type *imprs[B_LAST]; - -city_built_iterate(pcity, pimprove) { - if (is_improvement(pimprove)) { -imprs[total++] = pimprove; - } -} city_built_iterate_end; - -if (total 0) { - int num = fc_rand(total); - - building_lost(pcity, imprs[num]); - - notify_player(pplayer, ptile, E_DISASTER, ftc_server, -_(%s destroyed.), -improvement_name_translation(imprs[num])); - - had_effect = TRUE; -} - } - - if (disaster_has_effect(pdis, DE_REDUCE_POP) - pcity-size 1) { -if (!city_reduce_size(pcity, 1, NULL)) { - fc_assert(FALSE); - city_or_null = NULL; -} else { - notify_player(pplayer, ptile, E_DISASTER, ftc_server, -_(Some population lost.)); -} - -had_effect = TRUE; - } - - if (disaster_has_effect(pdis, DE_EMPTY_FOODSTOCK)) { -if (pcity-food_stock 0) { - pcity-food_stock = 0; - - notify_player(pplayer, ptile, E_DISASTER, ftc_server, -_(Foodbox emptied.)); - - had_effect = TRUE; -} - } - - if (disaster_has_effect(pdis, DE_EMPTY_PRODSTOCK)) { -if (pcity-shield_stock 0) { - pcity-shield_stock = 0; - - notify_player(pplayer, ptile, E_DISASTER, ftc_server, -_(Production box emptied.)); - - had_effect = TRUE; - -} - } - if (disaster_has_effect(pdis, DE_POLLUTION)) { if (place_pollution(pcity, S_POLLUTION)) { notify_player(pplayer, ptile, E_DISASTER, ftc_server, @@ -3009,6 +2949,65 @@ } } + if (disaster_has_effect(pdis, DE_REDUCE_POP) + pcity-size 1) { +if (!city_reduce_size(pcity, 1, NULL)) { + fc_assert(FALSE); + pcity = NULL; +} else { + notify_player(pplayer, ptile, E_DISASTER, ftc_server, +_(Some population lost.)); +} + +had_effect = TRUE; + } + + if (pcity disaster_has_effect(pdis, DE_DESTROY_BUILDING)) { +int total = 0; +struct impr_type *imprs[B_LAST]; + +city_built_iterate(pcity, pimprove) { + if (is_improvement(pimprove)) { +imprs[total++] = pimprove; + } +} city_built_iterate_end; + +if (total 0) { + int num = fc_rand(total); + + building_lost(pcity, imprs[num]); + + notify_player(pplayer, ptile, E_DISASTER, ftc_server, +_(%s destroyed.), +improvement_name_translation(imprs[num])); + + had_effect = TRUE; +} + } + + if (pcity disaster_has_effect(pdis, DE_EMPTY_FOODSTOCK)) { +if (pcity-food_stock 0) { + pcity-food_stock = 0; + + notify_player(pplayer, ptile, E_DISASTER, ftc_server, +_(Foodbox emptied.)); + + had_effect = TRUE; +} + } + + if (pcity disaster_has_effect(pdis, DE_EMPTY_PRODSTOCK)) { +if (pcity-shield_stock 0) { + pcity-shield_stock = 0; + + notify_player(pplayer, ptile, E_DISASTER, ftc_server, +_(Production box emptied.)); + + had_effect = TRUE; + +} + } + if (!had_effect) { notify_player(pplayer, ptile, E_DISASTER, ftc_server, _(We survived the disaster without serious damages.)); @@ -3016,7 +3015,7 @@ script_server_signal_emit(disaster, 2, API_TYPE_DISASTER, pdis, -API_TYPE_CITY, city_or_null); +API_TYPE_CITY, pcity); } /** ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25024 - /branches/S2_5/data/civ2/effects.ruleset
Author: jtn Date: Mon Jun 2 23:28:38 2014 New Revision: 25024 URL: http://svn.gna.org/viewcvs/freeciv?rev=25024view=rev Log: Reduce maximum traderoutes in civ2 ruleset from 4 to 3. See gna bug #22085. Modified: branches/S2_5/data/civ2/effects.ruleset Modified: branches/S2_5/data/civ2/effects.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/civ2/effects.ruleset?rev=25024r1=25023r2=25024view=diff == --- branches/S2_5/data/civ2/effects.ruleset (original) +++ branches/S2_5/data/civ2/effects.ruleset Mon Jun 2 23:28:38 2014 @@ -329,7 +329,7 @@ [effect_trade_routes] type= Max_Trade_Routes -value = 4 +value = 3 [effect_republic] type= Make_Content_Mil ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25026 - in /branches/S2_5/data: civ1/ civ2/ classic/ experimental/ multiplayer/
Author: jtn Date: Mon Jun 2 23:28:45 2014 New Revision: 25026 URL: http://svn.gna.org/viewcvs/freeciv?rev=25026view=rev Log: Tweak Barracks effect exclusions so that in the rare case older buildings coexist with newer ones, the older ones are treated as redundant in the UI. See gna bug #22080. Modified: branches/S2_5/data/civ1/effects.ruleset branches/S2_5/data/civ2/effects.ruleset branches/S2_5/data/classic/effects.ruleset branches/S2_5/data/experimental/effects.ruleset branches/S2_5/data/multiplayer/effects.ruleset Modified: branches/S2_5/data/civ1/effects.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/civ1/effects.ruleset?rev=25026r1=25025r2=25026view=diff == --- branches/S2_5/data/civ1/effects.ruleset (original) +++ branches/S2_5/data/civ1/effects.ruleset Mon Jun 2 23:28:45 2014 @@ -571,6 +571,11 @@ { type, name, range Building, Barracks, City } +nreqs = +{ type, name, range + Building, Barracks II, City + Building, Barracks III, City +} [effect_barracks_ii] type= Veteran_Build @@ -581,7 +586,7 @@ } nreqs = { type, name, range - Building, Barracks, City + Building, Barracks III, City } [effect_barracks_iii] @@ -590,11 +595,6 @@ reqs = { type, name, range Building, Barracks III, City -} -nreqs = -{ type, name, range - Building, Barracks, City - Building, Barracks II, City } [effect_cathedral] Modified: branches/S2_5/data/civ2/effects.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/civ2/effects.ruleset?rev=25026r1=25025r2=25026view=diff == --- branches/S2_5/data/civ2/effects.ruleset (original) +++ branches/S2_5/data/civ2/effects.ruleset Mon Jun 2 23:28:45 2014 @@ -939,6 +939,8 @@ { type, name, range UnitFlag, NonMil, Local UnitFlag, NoVeteran, Local + Building, Barracks II, City + Building, Barracks III, City } [effect_barracks_1] @@ -949,6 +951,11 @@ Building, Barracks, City UnitClass, Land, Local } +nreqs = +{ type, name, range + Building, Barracks II, City + Building, Barracks III, City +} [effect_barracks_ii] type= Veteran_Build @@ -962,7 +969,7 @@ { type, name, range UnitFlag, NonMil, Local UnitFlag, NoVeteran, Local - Building, Barracks, City + Building, Barracks III, City } [effect_barracks_ii_1] @@ -973,6 +980,10 @@ Building, Barracks II, City UnitClass, Land, Local } +nreqs = +{ type, name, range + Building, Barracks III, City +} [effect_barracks_iii] type= Veteran_Build @@ -986,8 +997,6 @@ { type, name, range UnitFlag, NonMil, Local UnitFlag, NoVeteran, Local - Building, Barracks, City - Building, Barracks II, City } [effect_barracks_iii_1] Modified: branches/S2_5/data/classic/effects.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/classic/effects.ruleset?rev=25026r1=25025r2=25026view=diff == --- branches/S2_5/data/classic/effects.ruleset (original) +++ branches/S2_5/data/classic/effects.ruleset Mon Jun 2 23:28:45 2014 @@ -821,6 +821,8 @@ { type, name, range UnitFlag, NonMil, Local UnitFlag, NoVeteran, Local + Building, Barracks II, City + Building, Barracks III, City } [effect_barracks_1] @@ -831,6 +833,11 @@ Building, Barracks, City UnitClass, Land, Local } +nreqs = +{ type, name, range + Building, Barracks II, City + Building, Barracks III, City +} [effect_barracks_ii] type= Veteran_Build @@ -844,7 +851,7 @@ { type, name, range UnitFlag, NonMil, Local UnitFlag, NoVeteran, Local - Building, Barracks, City + Building, Barracks III, City } [effect_barracks_ii_1] @@ -855,6 +862,10 @@ Building, Barracks II, City UnitClass, Land, Local } +nreqs = +{ type, name, range + Building, Barracks III, City +} [effect_barracks_iii] type= Veteran_Build @@ -868,8 +879,6 @@ { type, name, range UnitFlag, NonMil, Local UnitFlag, NoVeteran, Local - Building, Barracks, City - Building, Barracks II, City } [effect_barracks_iii_1] Modified: branches/S2_5/data/experimental/effects.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/experimental/effects.ruleset?rev=25026r1=25025r2=25026view=diff == --- branches/S2_5/data/experimental/effects.ruleset (original) +++ branches/S2_5/data/experimental/effects.ruleset Mon Jun 2 23:28:45 2014 @@ -898,6 +898,8 @@ { type, name,
[Freeciv-commits] r25028 - in /trunk: configure.ac m4/readline.m4 server/Makefile.am
Author: cazfi Date: Mon Jun 2 23:59:11 2014 New Revision: 25028 URL: http://svn.gna.org/viewcvs/freeciv?rev=25028view=rev Log: Link readline to libfreeciv-srv instead of server binary to fix build with linker flag --as-needed Reworked patch from gentoo See bug #22076 Modified: trunk/configure.ac trunk/m4/readline.m4 trunk/server/Makefile.am Modified: trunk/configure.ac URL: http://svn.gna.org/viewcvs/freeciv/trunk/configure.ac?rev=25028r1=25027r2=25028view=diff == --- trunk/configure.ac (original) +++ trunk/configure.ac Mon Jun 2 23:59:11 2014 @@ -1149,7 +1149,8 @@ dnl Readline library and header files. FC_HAS_READLINE() -AC_SUBST(SERVER_LIBS) +AC_SUBST([SERVER_LIBS]) +AC_SUBST([SRV_LIB_LIBS]) fi AC_CHECK_LIB(nls,main) Modified: trunk/m4/readline.m4 URL: http://svn.gna.org/viewcvs/freeciv/trunk/m4/readline.m4?rev=25028r1=25027r2=25028view=diff == --- trunk/m4/readline.m4(original) +++ trunk/m4/readline.m4Mon Jun 2 23:59:11 2014 @@ -112,7 +112,7 @@ FC_CHECK_READLINE_RUNTIME($HAVE_TERMCAP, have_readline_lib=1, have_readline_lib=0) if test $have_readline_lib = 1; then - SERVER_LIBS=-lreadline $SERVER_LIBS $HAVE_TERMCAP + SRV_LIB_LIBS=-lreadline $SRV_LIB_LIBS $HAVE_TERMCAP AC_DEFINE_UNQUOTED([HAVE_LIBREADLINE], [1], [Readline support]) else if test $WITH_READLINE = yes; then Modified: trunk/server/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/Makefile.am?rev=25028r1=25027r2=25028view=diff == --- trunk/server/Makefile.am(original) +++ trunk/server/Makefile.amMon Jun 2 23:59:11 2014 @@ -148,7 +148,7 @@ $(top_builddir)/server/scripting/libscripting_server.la libfreeciv_srv_la_LIBADD = \ - $(srvlibs) \ + $(srvlibs) $(SRV_LIB_LIBS) \ $(LUA_LIBS) $(TOLUA_LIBS) $(LUASQL_LIBS) exe_ldflags = $(GGZDMOD_LDFLAGS) ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25029 - in /branches/S2_5: configure.ac m4/readline.m4 server/Makefile.am
Author: cazfi Date: Mon Jun 2 23:59:17 2014 New Revision: 25029 URL: http://svn.gna.org/viewcvs/freeciv?rev=25029view=rev Log: Link readline to libfreeciv-srv instead of server binary to fix build with linker flag --as-needed Reworked patch from gentoo See bug #22076 Modified: branches/S2_5/configure.ac branches/S2_5/m4/readline.m4 branches/S2_5/server/Makefile.am Modified: branches/S2_5/configure.ac URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/configure.ac?rev=25029r1=25028r2=25029view=diff == --- branches/S2_5/configure.ac (original) +++ branches/S2_5/configure.ac Mon Jun 2 23:59:17 2014 @@ -1112,7 +1112,8 @@ dnl Readline library and header files. FC_HAS_READLINE() -AC_SUBST(SERVER_LIBS) +AC_SUBST([SERVER_LIBS]) +AC_SUBST([SRV_LIB_LIBS]) fi AC_CHECK_LIB(nls,main) Modified: branches/S2_5/m4/readline.m4 URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/m4/readline.m4?rev=25029r1=25028r2=25029view=diff == --- branches/S2_5/m4/readline.m4(original) +++ branches/S2_5/m4/readline.m4Mon Jun 2 23:59:17 2014 @@ -112,7 +112,7 @@ FC_CHECK_READLINE_RUNTIME($HAVE_TERMCAP, have_readline_lib=1, have_readline_lib=0) if test $have_readline_lib = 1; then - SERVER_LIBS=-lreadline $SERVER_LIBS $HAVE_TERMCAP + SRV_LIB_LIBS=-lreadline $SRV_LIB_LIBS $HAVE_TERMCAP AC_DEFINE_UNQUOTED([HAVE_LIBREADLINE], [1], [Readline support]) else if test $WITH_READLINE = yes; then Modified: branches/S2_5/server/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/Makefile.am?rev=25029r1=25028r2=25029view=diff == --- branches/S2_5/server/Makefile.am(original) +++ branches/S2_5/server/Makefile.amMon Jun 2 23:59:17 2014 @@ -142,7 +142,7 @@ $(top_builddir)/server/scripting/libscripting_server.la libfreeciv_srv_la_LIBADD = \ - $(srvlibs) \ + $(srvlibs) $(SRV_LIB_LIBS) \ $(LUA_LIBS) $(TOLUA_LIBS) $(LUASQL_LIBS) exe_ldflags = $(GGZDMOD_LDFLAGS) ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25030 - in /branches/S2_4: configure.ac m4/readline.m4 server/Makefile.am
Author: cazfi Date: Mon Jun 2 23:59:22 2014 New Revision: 25030 URL: http://svn.gna.org/viewcvs/freeciv?rev=25030view=rev Log: Link readline to libfreeciv-srv instead of server binary to fix build with linker flag --as-needed Reworked patch from gentoo See bug #22076 Modified: branches/S2_4/configure.ac branches/S2_4/m4/readline.m4 branches/S2_4/server/Makefile.am Modified: branches/S2_4/configure.ac URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/configure.ac?rev=25030r1=25029r2=25030view=diff == --- branches/S2_4/configure.ac (original) +++ branches/S2_4/configure.ac Mon Jun 2 23:59:22 2014 @@ -953,7 +953,8 @@ dnl Readline library and header files. FC_HAS_READLINE() -AC_SUBST(SERVER_LIBS) +AC_SUBST([SERVER_LIBS]) +AC_SUBST([SRV_LIB_LIBS]) fi AC_CHECK_LIB(nls,main) Modified: branches/S2_4/m4/readline.m4 URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/m4/readline.m4?rev=25030r1=25029r2=25030view=diff == --- branches/S2_4/m4/readline.m4(original) +++ branches/S2_4/m4/readline.m4Mon Jun 2 23:59:22 2014 @@ -124,7 +124,7 @@ FC_CHECK_READLINE_RUNTIME($HAVE_TERMCAP, have_new_readline_lib=1, have_new_readline_lib=0) if test $have_new_readline_lib = 1; then - SERVER_LIBS=-lreadline $SERVER_LIBS $HAVE_TERMCAP + SRV_LIB_LIBS=-lreadline $SRV_LIB_LIBS $HAVE_TERMCAP AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, 1, [Readline support]) AC_DEFINE_UNQUOTED(HAVE_NEWLIBREADLINE, 1, [Modern readline]) else @@ -141,7 +141,7 @@ FC_CHECK_READLINE_RUNTIME($HAVE_TERMCAP, have_readline_lib=1, have_readline_lib=0) if test $have_readline_lib = 1; then - SERVER_LIBS=-lreadline $SERVER_LIBS $HAVE_TERMCAP + SRV_LIB_LIBS=-lreadline $SRV_LIB_LIBS $HAVE_TERMCAP AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, 1, [Readline support]) else if test $WITH_READLINE = yes; then Modified: branches/S2_4/server/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/server/Makefile.am?rev=25030r1=25029r2=25030view=diff == --- branches/S2_4/server/Makefile.am(original) +++ branches/S2_4/server/Makefile.amMon Jun 2 23:59:22 2014 @@ -133,7 +133,7 @@ $(top_builddir)/server/scripting/libscripting_server.la libfreeciv_srv_la_LIBADD = \ - $(srvlibs) \ + $(srvlibs) $(SRV_LIB_LIBS) \ $(LUA_LIBS) $(TOLUA_LIBS) $(LUASQL_LIBS) freeciv_server_LDFLAGS = $(GGZDMOD_LDFLAGS) ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25031 - in /trunk: Makefile.am m4/imlib.m4
Author: cazfi Date: Tue Jun 3 00:28:11 2014 New Revision: 25031 URL: http://svn.gna.org/viewcvs/freeciv?rev=25031view=rev Log: Removed unused imlib.m4 See patch #4752 Removed: trunk/m4/imlib.m4 Modified: trunk/Makefile.am Modified: trunk/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/Makefile.am?rev=25031r1=25030r2=25031view=diff == --- trunk/Makefile.am (original) +++ trunk/Makefile.am Tue Jun 3 00:28:11 2014 @@ -71,7 +71,6 @@ m4/gtk2-client.m4 \ m4/gtk3-client.m4 \ m4/iconv.m4 \ - m4/imlib.m4 \ m4/lcmessage.m4 \ m4/lib-ld.m4\ m4/lib-link.m4 \ Removed: trunk/m4/imlib.m4 URL: http://svn.gna.org/viewcvs/freeciv/trunk/m4/imlib.m4?rev=25030view=auto == --- trunk/m4/imlib.m4 (original) +++ trunk/m4/imlib.m4 (removed) @@ -1,307 +0,0 @@ -# Configure paths for IMLIB -# Frank Belew 98-8-31 -# stolen from Manish Singh -# Shamelessly stolen from Owen Taylor - -dnl AM_PATH_IMLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl Test for IMLIB, and define IMLIB_CFLAGS and IMLIB_LIBS -dnl -AC_DEFUN([AM_PATH_IMLIB], -[dnl -dnl Get the cflags and libraries from the imlib-config script -dnl -AC_ARG_WITH([imlib-prefix], - AS_HELP_STRING([--with-imlib-prefix=PFX], [Prefix where IMLIB is installed (optional)]), -[imlib_prefix=$withval], [imlib_prefix=]) - -AC_ARG_WITH([imlib-exec-prefix], - AS_HELP_STRING([--with-imlib-exec-prefix=PFX], [Exec prefix where IMLIB is installed (optional)]), -[imlib_exec_prefix=$withval], [imlib_exec_prefix=]) - -AC_ARG_ENABLE([imlibtest], - AS_HELP_STRING([--disable-imlibtest], [Do not try to compile and run a test IMLIB program]), -[], [enable_imlibtest=yes]) - - if test x$imlib_exec_prefix != x ; then - imlib_args=$imlib_args --exec-prefix=$imlib_exec_prefix - if test x${IMLIB_CONFIG+set} != xset ; then -IMLIB_CONFIG=$imlib_exec_prefix/bin/imlib-config - fi - fi - if test x$imlib_prefix != x ; then - imlib_args=$imlib_args --prefix=$imlib_prefix - if test x${IMLIB_CONFIG+set} != xset ; then -IMLIB_CONFIG=$imlib_prefix/bin/imlib-config - fi - fi - - AC_PATH_PROG(IMLIB_CONFIG, imlib-config, no) - min_imlib_version=ifelse([$1], ,1.8.2,$1) - AC_MSG_CHECKING(for IMLIB - version = $min_imlib_version) - no_imlib= - if test $IMLIB_CONFIG = no ; then -no_imlib=yes - else -IMLIB_CFLAGS=`$IMLIB_CONFIG $imlibconf_args --cflags` -IMLIB_LIBS=`$IMLIB_CONFIG $imlibconf_args --libs` - -imlib_major_version=`$IMLIB_CONFIG $imlib_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` -imlib_minor_version=`$IMLIB_CONFIG $imlib_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` -imlib_micro_version=`$IMLIB_CONFIG $imlib_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` -if test x$enable_imlibtest = xyes ; then - ac_save_CFLAGS=$CFLAGS - ac_save_LIBS=$LIBS - CFLAGS=$CFLAGS $IMLIB_CFLAGS - LIBS=$LIBS $IMLIB_LIBS -dnl -dnl Now check if the installed IMLIB is sufficiently new. (Also sanity -dnl checks the results of imlib-config to some extent -dnl - rm -f conf.imlibtest - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include stdio.h -#include stdlib.h -#include string.h -#include Imlib.h - -char* -my_strdup (char *str) -{ - char *new_str; - - if (str) -{ - new_str = malloc ((strlen (str) + 1) * sizeof(char)); - strcpy (new_str, str); -} - else -new_str = NULL; - - return new_str; -} - -int main () -{ - int major, minor, micro; - char *tmp_version; - - system (touch conf.imlibtest); - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = my_strdup($min_imlib_version); - if (sscanf(tmp_version, %d.%d.%d, major, minor, micro) != 3) { - printf(%s, bad version string\n, $min_imlib_version); - exit(1); - } - -if (($imlib_major_version major) || -(($imlib_major_version == major) ($imlib_minor_version minor)) || - (($imlib_major_version == major) ($imlib_minor_version == minor) - ($imlib_micro_version = micro))) -{ - return 0; -} - else -{ - printf(\n*** 'imlib-config --version' returned %d.%d, but the minimum version\n, $imlib_major_version, $imlib_minor_version); - printf(*** of IMLIB required is %d.%d. If imlib-config is correct, then it is\n, major, minor); - printf(*** best to upgrade to the required version.\n); - printf(*** If imlib-config was wrong, set the environment variable IMLIB_CONFIG\n); - printf(*** to point to the correct copy of imlib-config, and remove
[Freeciv-commits] r25032 - in /trunk: ai/default/aicity.c common/effects.c common/effects.h
Author: jtn Date: Tue Jun 3 00:33:25 2014 New Revision: 25032 URL: http://svn.gna.org/viewcvs/freeciv?rev=25032view=rev Log: Logic that checks whether an effect is prevented (in AI and UI) now checks present=FALSE requirements as well as nreqs. Reported by Emmet Hikory (persia@gna). See gna bug #21992. Modified: trunk/ai/default/aicity.c trunk/common/effects.c trunk/common/effects.h Modified: trunk/ai/default/aicity.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.c?rev=25032r1=25031r2=25032view=diff == --- trunk/ai/default/aicity.c (original) +++ trunk/ai/default/aicity.c Tue Jun 3 00:33:25 2014 @@ -1920,11 +1920,11 @@ bool present = TRUE; bool impossible_to_get = FALSE; -if (is_effect_disabled(pplayer, NULL, pcity, pimprove, - NULL, NULL, NULL, NULL, - peffect, RPT_CERTAIN)) { - /* We believe that effect if disabled only if there is no change that it - * is not. This should lead AI using wider spectrum of improvements. +if (is_effect_prevented(pplayer, NULL, pcity, pimprove, +NULL, NULL, NULL, NULL, +peffect, RPT_CERTAIN)) { + /* We believe that effect is disabled only if there is no chance that it + * is not. This should lead to AI using wider spectrum of improvements. * * TODO: Select between RPT_POSSIBLE and RPT_CERTAIN dynamically * depending how much AI can take risks. */ Modified: trunk/common/effects.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/effects.c?rev=25032r1=25031r2=25032view=diff == --- trunk/common/effects.c (original) +++ trunk/common/effects.c Tue Jun 3 00:33:25 2014 @@ -445,25 +445,39 @@ /** Return TRUE iff any of the disabling requirements for this effect are - active (an effect is active if all of its enabling requirements and - none of its disabling ones are active). -**/ -bool is_effect_disabled(const struct player *target_player, - const struct player *other_player, - const struct city *target_city, - const struct impr_type *target_building, - const struct tile *target_tile, - const struct unit_type *target_unittype, - const struct output_type *target_output, - const struct specialist *target_specialist, - const struct effect *peffect, -const enum req_problem_type prob_type) -{ + active, which would prevent it from taking effect. + (Assumes that any requirement specified in the ruleset with a negative + sense is an impediment.) +**/ +bool is_effect_prevented(const struct player *target_player, + const struct player *other_player, + const struct city *target_city, + const struct impr_type *target_building, + const struct tile *target_tile, + const struct unit_type *target_unittype, + const struct output_type *target_output, + const struct specialist *target_specialist, + const struct effect *peffect, + const enum req_problem_type prob_type) +{ + requirement_list_iterate(peffect-reqs, preq) { +/* Only check present=FALSE requirements; these will return _FALSE_ + * from is_req_active() if met, and need reversed prob_type */ +if (!preq-present + !is_req_active(target_player, other_player, target_city, + target_building, target_tile, target_unittype, + target_output, target_specialist, + preq, REVERSED_RPT(prob_type))) { + return TRUE; +} + } requirement_list_iterate_end; requirement_list_iterate(peffect-nreqs, preq) { -if (is_req_active(target_player, other_player, target_city, - target_building, target_tile, target_unittype, - target_output, target_specialist, - preq, prob_type)) { +/* Only check present=TRUE nreqs */ +if (preq-present + is_req_active(target_player, other_player, target_city, + target_building, target_tile, target_unittype, + target_output, target_specialist, + preq, prob_type)) { return TRUE; } } requirement_list_iterate_end; @@ -471,36 +485,9 @@ }
[Freeciv-commits] r25035 - /branches/S2_5/utility/netfile.c
Author: cazfi Date: Tue Jun 3 01:59:07 2014 New Revision: 25035 URL: http://svn.gna.org/viewcvs/freeciv?rev=25035view=rev Log: Fixed dummy callback for netfile download if curl passes it element size other than one byte. See bug #22106 Modified: branches/S2_5/utility/netfile.c Modified: branches/S2_5/utility/netfile.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/netfile.c?rev=25035r1=25034r2=25035view=diff == --- branches/S2_5/utility/netfile.c (original) +++ branches/S2_5/utility/netfile.c Tue Jun 3 01:59:07 2014 @@ -209,7 +209,7 @@ ***/ static size_t dummy_write(void *buffer, size_t size, size_t nmemb, void *userp) { - return nmemb; + return size * nmemb; } /** ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25034 - /trunk/utility/netfile.c
Author: cazfi Date: Tue Jun 3 01:59:02 2014 New Revision: 25034 URL: http://svn.gna.org/viewcvs/freeciv?rev=25034view=rev Log: Fixed dummy callback for netfile download if curl passes it element size other than one byte. See bug #22106 Modified: trunk/utility/netfile.c Modified: trunk/utility/netfile.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/netfile.c?rev=25034r1=25033r2=25034view=diff == --- trunk/utility/netfile.c (original) +++ trunk/utility/netfile.c Tue Jun 3 01:59:02 2014 @@ -209,7 +209,7 @@ ***/ static size_t dummy_write(void *buffer, size_t size, size_t nmemb, void *userp) { - return nmemb; + return size * nmemb; } /** ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25037 - in /trunk: common/ tools/ruledit/ translations/freeciv/ translations/nations/ translations/ruledit/
Author: cazfi Date: Tue Jun 3 02:28:56 2014 New Revision: 25037 URL: http://svn.gna.org/viewcvs/freeciv?rev=25037view=rev Log: Ruledit disallows removal of advances that are requirement for something else in the ruleset. Effects are not yet checked. See patch #4743 Added: trunk/tools/ruledit/validity.c trunk/tools/ruledit/validity.h Modified: trunk/common/disaster.h trunk/common/name_translation.h trunk/tools/ruledit/Makefile.am trunk/tools/ruledit/ruledit_qt.cpp trunk/tools/ruledit/ruledit_qt.h trunk/tools/ruledit/tab_tech.cpp trunk/translations/freeciv/POTFILES.skip trunk/translations/nations/POTFILES.skip trunk/translations/ruledit/POTFILES.in Modified: trunk/common/disaster.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/disaster.h?rev=25037r1=25036r2=25037view=diff == --- trunk/common/disaster.h (original) +++ trunk/common/disaster.h Tue Jun 3 02:28:56 2014 @@ -16,6 +16,10 @@ #ifdef __cplusplus extern C { #endif /* __cplusplus */ + +/* common */ +#include name_translation.h +#include requirements.h /* Used in the network protocol. */ #define SPECENUM_NAME disaster_effect_id Modified: trunk/common/name_translation.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/name_translation.h?rev=25037r1=25036r2=25037view=diff == --- trunk/common/name_translation.h (original) +++ trunk/common/name_translation.h Tue Jun 3 02:28:56 2014 @@ -25,6 +25,9 @@ /* utility */ #include fcintl.h #include support.h + +/* common */ +#include fc_types.h /* MAX_LEN_NAME */ /* Don't allow other modules to access directly to the fields. */ #define vernacular _private_vernacular_ Modified: trunk/tools/ruledit/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/Makefile.am?rev=25037r1=25036r2=25037view=diff == --- trunk/tools/ruledit/Makefile.am (original) +++ trunk/tools/ruledit/Makefile.am Tue Jun 3 02:28:56 2014 @@ -28,7 +28,9 @@ ruledit_qt.cpp \ ruledit_qt.h\ rulesave.c \ - rulesave.h + rulesave.h \ + validity.c \ + validity.h nodist_freeciv_ruledit_SOURCES = $(MOC_FILES) Modified: trunk/tools/ruledit/ruledit_qt.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/ruledit_qt.cpp?rev=25037r1=25036r2=25037view=diff == --- trunk/tools/ruledit/ruledit_qt.cpp (original) +++ trunk/tools/ruledit/ruledit_qt.cpp Tue Jun 3 02:28:56 2014 @@ -82,6 +82,17 @@ gui-close(); delete gui; +} + +/** + Display requirer list. +**/ +void ruledit_qt_display_requirers(const char *msg) +{ + char buffer[2048]; + + fc_snprintf(buffer, sizeof(buffer), R__(Needed by %s), msg); + gui-display_msg(buffer); } /** Modified: trunk/tools/ruledit/ruledit_qt.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/ruledit_qt.h?rev=25037r1=25036r2=25037view=diff == --- trunk/tools/ruledit/ruledit_qt.h(original) +++ trunk/tools/ruledit/ruledit_qt.hTue Jun 3 02:28:56 2014 @@ -54,5 +54,6 @@ bool ruledit_qt_setup(int argc, char **argv); int ruledit_qt_run(); void ruledit_qt_close(); +void ruledit_qt_display_requirers(const char *msg); #endif // FC__RULEDIT_QT_H Modified: trunk/tools/ruledit/tab_tech.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/tab_tech.cpp?rev=25037r1=25036r2=25037view=diff == --- trunk/tools/ruledit/tab_tech.cpp(original) +++ trunk/tools/ruledit/tab_tech.cppTue Jun 3 02:28:56 2014 @@ -33,6 +33,7 @@ // ruledit #include ruledit_qt.h +#include validity.h #include tab_tech.h @@ -310,6 +311,10 @@ **/ void tab_tech::delete_now() { + if (is_tech_needed(selected, ruledit_qt_display_requirers)) { +return; + } + selected-require[AR_ONE] = A_NEVER; refresh(); Added: trunk/tools/ruledit/validity.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/validity.c?rev=25037view=auto == --- trunk/tools/ruledit/validity.c (added) +++ trunk/tools/ruledit/validity.c Tue Jun 3 02:28:56 2014 @@ -0,0 +1,146 @@ +/** + Freeciv