[Freeciv-commits] r30157 - /trunk/configure.ac

2015-10-22 Thread sveinung84
Author: sveinung
Date: Thu Oct 22 11:07:01 2015
New Revision: 30157

URL: http://svn.gna.org/viewcvs/freeciv?rev=30157&view=rev
Log:
i18n: the Freeciv source files are UTF-8

The --from-code option was introduced in gettext version 0.12. Use it to
make gettext aware that the Freeciv input source files are encoded using
UTF-8. This makes it safe, as far as gettext is concerned, to use non ASCII
UTF-8 characters in translation comments and msgids.

Note that nothing is being changed for the C compiler. There is still a risk
that non ASCII characters in string literals are reencoded during the
compilation. A C string literal msgid should therefore avoid using non ASCII
UTF-8 characters.

See patch #6451

Modified:
trunk/configure.ac

Modified: trunk/configure.ac
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/configure.ac?rev=30157&r1=30156&r2=30157&view=diff
==
--- trunk/configure.ac  (original)
+++ trunk/configure.ac  Thu Oct 22 11:07:01 2015
@@ -534,6 +534,7 @@
 AM_XGETTEXT_OPTION([--language=C])
 AM_XGETTEXT_OPTION([--escape])
 AM_XGETTEXT_OPTION([--add-comments="TRANS:"])
+AM_XGETTEXT_OPTION([--from-code=UTF-8])
 
 PKG_PROG_PKG_CONFIG
 if test "x$PKG_CONFIG" = "x" ; then


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


[Freeciv-commits] r30160 - in /trunk: data/scenarios/Makefile.am data/scenarios/europe_1901.sav translations/freeciv/POTFILES.in

2015-10-22 Thread sveinung84
Author: sveinung
Date: Thu Oct 22 11:07:30 2015
New Revision: 30160

URL: http://svn.gna.org/viewcvs/freeciv?rev=30160&view=rev
Log:
Include the scenario Europe 1901

The Europe 1901 scenario is Europe just prior the the outbreak of World War
I. It tries to be historically accurate.

Scenario by Jamie Troini a.k.a. Nimrod and Ferdinand Steinkrüger a.k.a XYZ.
It takes place on a modified version of the already bundled map
"Europe (classic/giant)".

It has been left as it was except the following minor modifications:
 - mark the name and the description as translatable
 - use the full name of the original authors in the scenario description
 - remove the number (year?) at the end of the description
 - make all players unassigned

See patch #6434

Added:
trunk/data/scenarios/europe_1901.sav
Modified:
trunk/data/scenarios/Makefile.am
trunk/translations/freeciv/POTFILES.in

[This mail would be too long, it was shortened to contain the URLs only.]

Modified: trunk/data/scenarios/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/scenarios/Makefile.am?rev=30160&r1=30159&r2=30160&view=diff

Added: trunk/data/scenarios/europe_1901.sav
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/scenarios/europe_1901.sav?rev=30160&view=auto

Modified: trunk/translations/freeciv/POTFILES.in
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/translations/freeciv/POTFILES.in?rev=30160&r1=30159&r2=30160&view=diff


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


[Freeciv-commits] r30158 - in /trunk/common: actions.c actions.h

2015-10-22 Thread sveinung84
Author: sveinung
Date: Thu Oct 22 11:07:11 2015
New Revision: 30158

URL: http://svn.gna.org/viewcvs/freeciv?rev=30158&view=rev
Log:
Centralize action blocks action

Move the code checking if an enabler controlled action is blocked by the
legality of another enabler controlled action to a central location.

See patch #6453

Modified:
trunk/common/actions.c
trunk/common/actions.h

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=30158&r1=30157&r2=30158&view=diff
==
--- trunk/common/actions.c  (original)
+++ trunk/common/actions.c  Thu Oct 22 11:07:11 2015
@@ -769,6 +769,78 @@
 }
 
 /**
+  Returns the action that blocks the specified action or NULL if the
+  specified action isn't blocked.
+
+  An action that can block another blocks when it is forced and possible.
+**/
+struct action *action_is_blocked_by(const int action_id,
+const struct unit *actor_unit,
+const struct tile *target_tile,
+const struct city *target_city,
+const struct unit *target_unit)
+{
+  /* TODO: Generalize. Give the ruleset more control. Maybe add a
+   * blocked_by action vector field to generalized actions when actions
+   * becomes generalized? */
+
+  switch (action_id) {
+  case ACTION_MARKETPLACE:
+if (trade_route_blocks(actor_unit, target_city)) {
+  /* Establish Trade Route is possible.
+   * The ruleset forbids Enter Marketplace when it is. */
+  return action_by_number(ACTION_TRADE_ROUTE);
+}
+
+/* Not blocked. */
+return NULL;
+break;
+  case ACTION_BOMBARD:
+if (capture_units_blocks(actor_unit, target_tile)) {
+  /* Capture unit is possible.
+   * The ruleset forbids bombard when it is. */
+  return action_by_number(ACTION_CAPTURE_UNITS);
+}
+
+/* Not blocked. */
+return NULL;
+break;
+  case ACTION_NUKE:
+if (capture_units_blocks(actor_unit, target_tile)) {
+  /* Capture unit is possible.
+   * The ruleset forbids Explode Nuclear when it is. */
+  return action_by_number(ACTION_CAPTURE_UNITS);
+}
+
+if (bombard_blocks(actor_unit, target_tile)) {
+  /* Bombard units is possible.
+   * The ruleset forbids Explode Nuclear when it is. */
+  return action_by_number(ACTION_BOMBARD);
+}
+
+/* Not blocked. */
+return NULL;
+break;
+  case ACTION_RECYCLE_UNIT:
+if (help_wonder_blocks(actor_unit, target_city)) {
+  /* Help Wonder is possible.
+   * Freeciv forbids Recycle Unit when it is.
+   * The current Freeciv code can't handle permitting Recycle Unit when
+   * Help Wonder is legal. See explanation in help_wonder_blocks(). */
+  return action_by_number(ACTION_HELP_WONDER);
+}
+
+/* Not blocked. */
+return NULL;
+break;
+  default:
+/* Not able to be blocked. */
+return NULL;
+break;
+  }
+}
+
+/**
   Returns TRUE if the specified unit type can perform the wanted action
   given that an action enabler later will enable it.
 
@@ -890,6 +962,13 @@
 }
   }
 
+  if (action_is_blocked_by(wanted_action, actor_unit,
+   target_tile, target_city, target_unit)) {
+/* Allows an action to block an other action. If a blocking action is
+ * legal the actions it blocks becomes illegal. */
+return TRI_NO;
+  }
+
   if (wanted_action == ACTION_ESTABLISH_EMBASSY
   || wanted_action == ACTION_SPY_INVESTIGATE_CITY
   || wanted_action == ACTION_SPY_STEAL_GOLD
@@ -985,13 +1064,6 @@
   return TRI_NO;
 }
 
-/* Allow a ruleset to forbid units from entering the marketplace if a
- * trade route can be established in stead. */
-if (wanted_action == ACTION_MARKETPLACE
-&& trade_route_blocks(actor_unit, target_city)) {
-  return TRI_NO;
-}
-
 /* There are more restrictions on establishing a trade route than on
  * entering the market place. */
 if (wanted_action == ACTION_TRADE_ROUTE &&
@@ -1023,13 +1095,6 @@
  * forbidding the player from recycling a unit because the production
  * has enough, like Help Wonder does, would be a rule change. */
 
-if (help_wonder_blocks(actor_unit, target_city)) {
-  /* Help Wonder is possible. The current Freeciv code can't handle
-   * permitting Recycle Unit when Help Wonder is legal.
-   * See explanation in help_wonder_blocks(). */
-  return TRI_NO;
-}
-
 /* Reason: Keep the rules exactly as they were for now. */
 /* Info leak: The actor player knows where his unit is. */
 if (unit_tile(actor_unit) != target_tile) {
@@ -1

[Freeciv-commits] r30161 - /trunk/client/helpdata.c

2015-10-22 Thread sveinung84
Author: sveinung
Date: Thu Oct 22 11:07:43 2015
New Revision: 30161

URL: http://svn.gna.org/viewcvs/freeciv?rev=30161&view=rev
Log:
Update help generation for Recycle Unit

It became possible to disband a unit in a city without getting 50% of its
production cost when Recycle Unit was split from Disband Unit.

See bug #23953

Modified:
trunk/client/helpdata.c

Modified: trunk/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/helpdata.c?rev=30161&r1=30160&r2=30161&view=diff
==
--- trunk/client/helpdata.c (original)
+++ trunk/client/helpdata.c Thu Oct 22 11:07:43 2015
@@ -3920,11 +3920,6 @@
   }
   if (utype_has_flag(utype, UTYF_UNDISBANDABLE)) {
 CATLSTR(buf, bufsz, _("* May not be disbanded.\n"));
-  } else {
-CATLSTR(buf, bufsz,
-   /* xgettext:no-c-format */
-   _("* May be disbanded in a city to recover 50% of the"
- " production cost.\n"));
   }
   if (utype_has_flag(utype, UTYF_SETTLERS)) {
 struct universal for_utype = { .kind = VUT_UTYPE, .value = { .utype = 
utype }};


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


[Freeciv-commits] r30159 - /trunk/server/unithand.c

2015-10-22 Thread sveinung84
Author: sveinung
Date: Thu Oct 22 11:07:20 2015
New Revision: 30159

URL: http://svn.gna.org/viewcvs/freeciv?rev=30159&view=rev
Log:
Explain if action blocks action

See patch #6454

Modified:
trunk/server/unithand.c

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=30159&r1=30158&r2=30159&view=diff
==
--- trunk/server/unithand.c (original)
+++ trunk/server/unithand.c Thu Oct 22 11:07:20 2015
@@ -100,6 +100,8 @@
   ANEK_TGT_IS_UNCLAIMED,
   /* Explanation: the action is disabled in this scenario. */
   ANEK_SCENARIO_DISABLED,
+  /* Explanation: the action is blocked by another action. */
+  ANEK_ACTION_BLOCKS,
   /* Explanation not detected. */
   ANEK_UNKNOWN,
 };
@@ -115,6 +117,9 @@
 
 /* The player to advice declaring war on. */
 struct player *no_war_with;
+
+/* The action that blocks the action. */
+struct action *blocker;
   };
 };
 
@@ -728,6 +733,7 @@
const struct unit *target_unit)
 {
   struct player *must_war_player;
+  struct action *blocker;
   struct player *tgt_player = NULL;
   struct ane_expl *expl = fc_malloc(sizeof(struct ane_expl));
   bool can_exist = can_unit_exist_at_tile(punit, unit_tile(punit));
@@ -846,6 +852,12 @@
 /* Please add a check for any new action forbidding scenario setting
  * above this comment. */
 expl->kind = ANEK_SCENARIO_DISABLED;
+  } else if (action_id_is_valid(action_id)
+ && (blocker = action_is_blocked_by(action_id, punit,
+target_tile, target_city,
+target_unit))) {
+expl->kind = ANEK_ACTION_BLOCKS;
+expl->blocker = blocker;
   } else {
 expl->kind = ANEK_UNKNOWN;
   }
@@ -930,6 +942,11 @@
 notify_player(pplayer, unit_tile(punit), E_BAD_COMMAND, ftc_server,
   _("Can't perform any action this scenario permits."));
 break;
+  case ANEK_ACTION_BLOCKS:
+/* If an action blocked another action the blocking action must be
+ * possible. */
+fc_assert(expl->kind != ANEK_ACTION_BLOCKS);
+/* Fall through to unknown cause. */
   case ANEK_UNKNOWN:
 notify_player(pplayer, unit_tile(punit), E_BAD_COMMAND, ftc_server,
   _("No action possible."));
@@ -1236,6 +1253,15 @@
   /* TRANS: Can't do Build City in this scenario. */
   _("Can't do %s in this scenario."),
   gen_action_translated_name(stopped_action));
+break;
+  case ANEK_ACTION_BLOCKS:
+notify_player(pplayer, unit_tile(actor),
+  event, ftc_server,
+  /* TRANS: Freight ... Recycle Unit ... Help Wonder ... */
+  _("Your %s can't do %s when %s is legal."),
+  unit_name_translation(actor),
+  gen_action_translated_name(stopped_action),
+  gen_action_translated_name(expl->blocker->id));
 break;
   case ANEK_UNKNOWN:
 notify_player(pplayer, unit_tile(actor),


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


[Freeciv-commits] r30162 - in /trunk/client/gui-sdl2: mapctrl.c menu.c

2015-10-22 Thread sveinung84
Author: sveinung
Date: Thu Oct 22 11:07:53 2015
New Revision: 30162

URL: http://svn.gna.org/viewcvs/freeciv?rev=30162&view=rev
Log:
SDL 2 client: Use ruleset defined action ui names

for Establish Trade Route, Help Build Wonder, Join City and Found City.

See patch #6455

Modified:
trunk/client/gui-sdl2/mapctrl.c
trunk/client/gui-sdl2/menu.c

Modified: trunk/client/gui-sdl2/mapctrl.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/mapctrl.c?rev=30162&r1=30161&r2=30162&view=diff
==
--- trunk/client/gui-sdl2/mapctrl.c (original)
+++ trunk/client/gui-sdl2/mapctrl.c Thu Oct 22 11:07:53 2015
@@ -2786,7 +2786,8 @@
   pNewCity_Dlg = fc_calloc(1, sizeof(struct SMALL_DLG));
 
   /* create window */
-  pstr = create_utf8_from_char(_("Build City"), adj_font(12));
+  pstr = create_utf8_from_char(action_get_ui_name(ACTION_FOUND_CITY),
+   adj_font(12));
   pstr->style |= TTF_STYLE_BOLD;
   pWindow = create_window_skeleton(NULL, pstr, 0);
   pWindow->action = move_new_city_dlg_callback;

Modified: trunk/client/gui-sdl2/menu.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/menu.c?rev=30162&r1=30161&r2=30162&view=diff
==
--- trunk/client/gui-sdl2/menu.c(original)
+++ trunk/client/gui-sdl2/menu.cThu Oct 22 11:07:53 2015
@@ -828,7 +828,8 @@
   /* - */
 
   /* Establish Trade route */
-  fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)", _("Establish Trade Route"), "R");
+  fc_snprintf(cBuf, sizeof(cBuf), "%s (%s)",
+  action_get_ui_name(ACTION_TRADE_ROUTE), "R");
   pBuf = create_themeicon(current_theme->OTrade_Icon, Main.gui,
   WF_HIDDEN | WF_RESTORE_BACKGROUND
   | WF_WIDGET_HAS_INFO_LABEL);
@@ -869,7 +870,8 @@
   /* - */
 
   /* Help Build Wonder */
-  fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)", _("Help Build Wonder"), "B");
+  fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)",
+  action_get_ui_name(ACTION_HELP_WONDER), "B");
   pBuf = create_themeicon(current_theme->OWonder_Icon, Main.gui,
   WF_HIDDEN | WF_RESTORE_BACKGROUND
   | WF_WIDGET_HAS_INFO_LABEL);
@@ -881,8 +883,10 @@
   /* - */
 
   /* Add to City / Build New City */
-  fc_snprintf(cBuf, sizeof(cBuf), "%s (%s)", _("Add to City"), "B");
-  fc_snprintf(cBuf, sizeof(cBuf), "%s (%s)", _("Build City"), "B");
+  fc_snprintf(cBuf, sizeof(cBuf), "%s (%s)",
+  action_get_ui_name(ACTION_JOIN_CITY), "B");
+  fc_snprintf(cBuf, sizeof(cBuf), "%s (%s)",
+  action_get_ui_name(ACTION_FOUND_CITY), "B");
 
   pBuf = create_themeicon(current_theme->OBuildCity_Icon, Main.gui,
   WF_HIDDEN | WF_RESTORE_BACKGROUND
@@ -1072,9 +1076,11 @@
 
   if (unit_can_add_or_build_city(pUnit)) {
if (pCity) {
- fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)", _("Add to City"), "B");
-   } else {
- fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)", _("Build City"), "B");
+  fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)",
+  action_get_ui_name(ACTION_JOIN_CITY), "B");
+} else {
+  fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)",
+  action_get_ui_name(ACTION_FOUND_CITY), "B");
}
 copy_chars_to_utf8_str(pOrder_Build_AddTo_City_Button->info_label,
cBuf);
@@ -1122,14 +1128,16 @@
 
 if (can_establish_trade_route(pHomecity, pCity)) {
   fc_snprintf(cBuf, sizeof(cBuf),
-  _("Establish Trade Route With %s ( %d one time bonus + 
%d trade ) (R)"),
+  _("%s With %s ( %d one time bonus + %d trade ) (R)"),
+  action_get_ui_name(ACTION_TRADE_ROUTE),
   city_name(pHomecity),
   revenue,
   trade_between_cities(pHomecity, pCity));
 } else {
   revenue = (revenue + 2) / 3;
   fc_snprintf(cBuf, sizeof(cBuf),
-  _("Trade With %s ( %d one time bonus ) (R)"),
+  _("%s Of %s ( %d one time bonus ) (R)"),
+  action_get_ui_name(ACTION_MARKETPLACE),
   city_name(pHomecity),
   revenue);
 }


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


[Freeciv-commits] r30163 - /branches/S2_6/configure.ac

2015-10-22 Thread sveinung84
Author: sveinung
Date: Thu Oct 22 11:08:49 2015
New Revision: 30163

URL: http://svn.gna.org/viewcvs/freeciv?rev=30163&view=rev
Log:
i18n: the Freeciv source files are UTF-8

The --from-code option was introduced in gettext version 0.12. Use it to
make gettext aware that the Freeciv input source files are encoded using
UTF-8. This makes it safe, as far as gettext is concerned, to use non ASCII
UTF-8 characters in translation comments and msgids.

Note that nothing is being changed for the C compiler. There is still a risk
that non ASCII characters in string literals are reencoded during the
compilation. A C string literal msgid should therefore avoid using non ASCII
UTF-8 characters.

See patch #6451

Modified:
branches/S2_6/configure.ac

Modified: branches/S2_6/configure.ac
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/configure.ac?rev=30163&r1=30162&r2=30163&view=diff
==
--- branches/S2_6/configure.ac  (original)
+++ branches/S2_6/configure.ac  Thu Oct 22 11:08:49 2015
@@ -519,6 +519,7 @@
 AM_XGETTEXT_OPTION([--language=C])
 AM_XGETTEXT_OPTION([--escape])
 AM_XGETTEXT_OPTION([--add-comments="TRANS:"])
+AM_XGETTEXT_OPTION([--from-code=UTF-8])
 
 PKG_PROG_PKG_CONFIG
 if test "x$PKG_CONFIG" = "x" ; then


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


[Freeciv-commits] r30164 - in /branches/S2_6/client: gui-sdl/menu.c gui-sdl2/menu.c

2015-10-22 Thread sveinung84
Author: sveinung
Date: Thu Oct 22 11:08:57 2015
New Revision: 30164

URL: http://svn.gna.org/viewcvs/freeciv?rev=30164&view=rev
Log:
SDL clients: Use ruleset defined action ui names

for Establish Trade Route and Help Build Wonder.

See patch #6455

Modified:
branches/S2_6/client/gui-sdl/menu.c
branches/S2_6/client/gui-sdl2/menu.c

Modified: branches/S2_6/client/gui-sdl/menu.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl/menu.c?rev=30164&r1=30163&r2=30164&view=diff
==
--- branches/S2_6/client/gui-sdl/menu.c (original)
+++ branches/S2_6/client/gui-sdl/menu.c Thu Oct 22 11:08:57 2015
@@ -841,7 +841,8 @@
   /* - */
 
   /* Form Trade route */
-  fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)", _("Establish Trade Route"), "R");
+  fc_snprintf(cBuf, sizeof(cBuf), "%s (%s)",
+  action_get_ui_name(ACTION_TRADE_ROUTE), "R");
   pBuf = create_themeicon(current_theme->OTrade_Icon, Main.gui,
   WF_HIDDEN | WF_RESTORE_BACKGROUND
   | WF_WIDGET_HAS_INFO_LABEL);
@@ -886,7 +887,8 @@
   /* - */
 
   /* Help Build Wonder */
-  fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)", _("Help Build Wonder"), "B");
+  fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)",
+  action_get_ui_name(ACTION_HELP_WONDER), "B");
   pBuf = create_themeicon(current_theme->OWonder_Icon, Main.gui,
   WF_HIDDEN | WF_RESTORE_BACKGROUND
   | WF_WIDGET_HAS_INFO_LABEL);
@@ -1146,14 +1148,16 @@

 if (can_establish_trade_route(pHomecity, pCity)) {
   fc_snprintf(cBuf, sizeof(cBuf),
-  _("Establish Trade Route With %s ( %d one time bonus + 
%d trade ) (R)"),
+  _("%s With %s ( %d one time bonus + %d trade ) (R)"),
+  action_get_ui_name(ACTION_TRADE_ROUTE),
   city_name(pHomecity),
   revenue,
   trade_between_cities(pHomecity, pCity));
 } else {
   revenue = (revenue + 2) / 3;
   fc_snprintf(cBuf, sizeof(cBuf),
-  _("Trade With %s ( %d one time bonus ) (R)"),
+  _("%s Of %s ( %d one time bonus ) (R)"),
+  action_get_ui_name(ACTION_MARKETPLACE),
   city_name(pHomecity),
   revenue);
 }

Modified: branches/S2_6/client/gui-sdl2/menu.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl2/menu.c?rev=30164&r1=30163&r2=30164&view=diff
==
--- branches/S2_6/client/gui-sdl2/menu.c(original)
+++ branches/S2_6/client/gui-sdl2/menu.cThu Oct 22 11:08:57 2015
@@ -827,7 +827,8 @@
   /* - */
 
   /* Establish Trade route */
-  fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)", _("Establish Trade Route"), "R");
+  fc_snprintf(cBuf, sizeof(cBuf), "%s (%s)",
+  action_get_ui_name(ACTION_TRADE_ROUTE), "R");
   pBuf = create_themeicon(current_theme->OTrade_Icon, Main.gui,
   WF_HIDDEN | WF_RESTORE_BACKGROUND
   | WF_WIDGET_HAS_INFO_LABEL);
@@ -868,7 +869,8 @@
   /* - */
 
   /* Help Build Wonder */
-  fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)", _("Help Build Wonder"), "B");
+  fc_snprintf(cBuf, sizeof(cBuf),"%s (%s)",
+  action_get_ui_name(ACTION_HELP_WONDER), "B");
   pBuf = create_themeicon(current_theme->OWonder_Icon, Main.gui,
   WF_HIDDEN | WF_RESTORE_BACKGROUND
   | WF_WIDGET_HAS_INFO_LABEL);
@@ -1121,14 +1123,16 @@
 
 if (can_establish_trade_route(pHomecity, pCity)) {
   fc_snprintf(cBuf, sizeof(cBuf),
-  _("Establish Trade Route With %s ( %d one time bonus + 
%d trade ) (R)"),
+  _("%s With %s ( %d one time bonus + %d trade ) (R)"),
+  action_get_ui_name(ACTION_TRADE_ROUTE),
   city_name(pHomecity),
   revenue,
   trade_between_cities(pHomecity, pCity));
 } else {
   revenue = (revenue + 2) / 3;
   fc_snprintf(cBuf, sizeof(cBuf),
-  _("Trade With %s ( %d one time bonus ) (R)"),
+  _("%s Of %s ( %d one time bonus ) (R)"),
+  action_get_ui_name(ACTION_MARKETPLACE),
   city_name(pHomecity),
   revenue);
 }


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


[Freeciv-commits] r30166 - in /branches/S2_6/client: gui-gtk-3.0/gui_main.c gui-gtk-3.0/menu.c options.c options.h

2015-10-22 Thread cazfi74
Author: cazfi
Date: Thu Oct 22 16:25:55 2015
New Revision: 30166

URL: http://svn.gna.org/viewcvs/freeciv?rev=30166&view=rev
Log:
Removed gtk3-client option about Better Fog of War that did nothing.

See patch #6440

Modified:
branches/S2_6/client/gui-gtk-3.0/gui_main.c
branches/S2_6/client/gui-gtk-3.0/menu.c
branches/S2_6/client/options.c
branches/S2_6/client/options.h

Modified: branches/S2_6/client/gui-gtk-3.0/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/gui_main.c?rev=30166&r1=30165&r2=30166&view=diff
==
--- branches/S2_6/client/gui-gtk-3.0/gui_main.c (original)
+++ branches/S2_6/client/gui-gtk-3.0/gui_main.c Thu Oct 22 16:25:55 2015
@@ -1567,7 +1567,6 @@
   MIGRATE_OPTION(dialogs_on_top);
   MIGRATE_OPTION(show_task_icons);
   MIGRATE_OPTION(enable_tabs);
-  MIGRATE_OPTION(better_fog);
   MIGRATE_OPTION(show_chat_message_time);
   MIGRATE_OPTION(new_messages_go_to_top);
   MIGRATE_OPTION(show_message_window_buttons);

Modified: branches/S2_6/client/gui-gtk-3.0/menu.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/menu.c?rev=30166&r1=30165&r2=30166&view=diff
==
--- branches/S2_6/client/gui-gtk-3.0/menu.c (original)
+++ branches/S2_6/client/gui-gtk-3.0/menu.c Thu Oct 22 16:25:55 2015
@@ -806,18 +806,6 @@
   if (options.draw_fog_of_war ^ gtk_toggle_action_get_active(action)) {
 key_fog_of_war_toggle();
 view_menu_update_sensitivity();
-  }
-}
-
-/
-  Action "SHOW_BETTER_FOG_OF_WAR" callback.
-*/
-static void show_better_fog_of_war_callback(GtkToggleAction *action,
-gpointer data)
-{
-  if (options.gui_gtk3_better_fog ^ gtk_toggle_action_get_active(action)) {
-options.gui_gtk3_better_fog ^= 1;
-update_map_canvas_visible();
   }
 }
 
@@ -1580,7 +1568,7 @@
   {"SHOW_FOG_OF_WAR", NULL, _("Fog of _War"),
NULL, NULL, G_CALLBACK(show_fog_of_war_callback), FALSE},
   {"SHOW_BETTER_FOG_OF_WAR", NULL, _("Better Fog of War"),
-   NULL, NULL, G_CALLBACK(show_better_fog_of_war_callback), FALSE},
+   NULL, NULL, NULL, FALSE},
 
   {"FULL_SCREEN", NULL, _("_Fullscreen"),
"Return", NULL, G_CALLBACK(full_screen_callback), FALSE}
@@ -2034,7 +2022,6 @@
   menus_set_sensitive(safe_group, "SHOW_UNIT_SHIELDS",
   options.draw_units || options.draw_focus_unit);
   menus_set_sensitive(safe_group, "SHOW_FOCUS_UNIT", !options.draw_units);
-  menus_set_sensitive(safe_group, "SHOW_BETTER_FOG_OF_WAR", 
options.draw_fog_of_war);
 }
 
 /
@@ -2658,13 +2645,11 @@
   menus_set_active(safe_group, "SHOW_UNIT_SHIELDS", options.draw_unit_shields);
   menus_set_active(safe_group, "SHOW_FOCUS_UNIT", options.draw_focus_unit);
   menus_set_active(safe_group, "SHOW_FOG_OF_WAR", options.draw_fog_of_war);
-  if (tileset_use_hard_coded_fog(tileset)) {
-menus_set_visible(safe_group, "SHOW_BETTER_FOG_OF_WAR", TRUE, TRUE);
-menus_set_active(safe_group, "SHOW_BETTER_FOG_OF_WAR",
- options.gui_gtk3_better_fog);
-  } else {
-menus_set_visible(safe_group, "SHOW_BETTER_FOG_OF_WAR", FALSE, FALSE);
-  }
+
+  /* To avoid run-time errors from gtk3, we have to have this action,
+   * really used by gtk2-client only, defined also in gtk3-client code.
+   * We just don't show it to the user. */
+  menus_set_visible(safe_group, "SHOW_BETTER_FOG_OF_WAR", FALSE, FALSE);
 
   view_menu_update_sensitivity();
 

Modified: branches/S2_6/client/options.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/options.c?rev=30166&r1=30165&r2=30166&view=diff
==
--- branches/S2_6/client/options.c  (original)
+++ branches/S2_6/client/options.c  Thu Oct 22 16:25:55 2015
@@ -219,7 +219,6 @@
   .gui_gtk3_dialogs_on_top = TRUE,
   .gui_gtk3_show_task_icons = TRUE,
   .gui_gtk3_enable_tabs = TRUE,
-  .gui_gtk3_better_fog = TRUE,
   .gui_gtk3_show_chat_message_time = FALSE,
   .gui_gtk3_new_messages_go_to_top = FALSE,
   .gui_gtk3_show_message_window_buttons = TRUE,
@@ -2487,13 +2486,6 @@
  "be shown as separate tabs rather than in popup "
  "dialogs."),
   COC_INTERFACE, GUI_GTK3, TRUE, NULL),
-  GEN_BOOL_OPTION(gui_gtk3_better_fog,
-  N_("Better fog-of-war drawing"),
-  N_("If this is enabled then a better method is used "
- "for drawing fog-of-war.  It is not any slower but "
- "will consume about twice as much memory."),
-  COC_GRAPHICS, GUI_GTK3,
-

[Freeciv-commits] r30165 - in /trunk/client: gui-gtk-3.0/gui_main.c gui-gtk-3.0/menu.c options.c options.h

2015-10-22 Thread cazfi74
Author: cazfi
Date: Thu Oct 22 16:25:47 2015
New Revision: 30165

URL: http://svn.gna.org/viewcvs/freeciv?rev=30165&view=rev
Log:
Removed gtk3-client option about Better Fog of War that did nothing.

See patch #6440

Modified:
trunk/client/gui-gtk-3.0/gui_main.c
trunk/client/gui-gtk-3.0/menu.c
trunk/client/options.c
trunk/client/options.h

Modified: trunk/client/gui-gtk-3.0/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/gui_main.c?rev=30165&r1=30164&r2=30165&view=diff
==
--- trunk/client/gui-gtk-3.0/gui_main.c (original)
+++ trunk/client/gui-gtk-3.0/gui_main.c Thu Oct 22 16:25:47 2015
@@ -1567,7 +1567,6 @@
   MIGRATE_OPTION(dialogs_on_top);
   MIGRATE_OPTION(show_task_icons);
   MIGRATE_OPTION(enable_tabs);
-  MIGRATE_OPTION(better_fog);
   MIGRATE_OPTION(show_chat_message_time);
   MIGRATE_OPTION(new_messages_go_to_top);
   MIGRATE_OPTION(show_message_window_buttons);

Modified: trunk/client/gui-gtk-3.0/menu.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/menu.c?rev=30165&r1=30164&r2=30165&view=diff
==
--- trunk/client/gui-gtk-3.0/menu.c (original)
+++ trunk/client/gui-gtk-3.0/menu.c Thu Oct 22 16:25:47 2015
@@ -806,18 +806,6 @@
   if (options.draw_fog_of_war ^ gtk_toggle_action_get_active(action)) {
 key_fog_of_war_toggle();
 view_menu_update_sensitivity();
-  }
-}
-
-/
-  Action "SHOW_BETTER_FOG_OF_WAR" callback.
-*/
-static void show_better_fog_of_war_callback(GtkToggleAction *action,
-gpointer data)
-{
-  if (options.gui_gtk3_better_fog ^ gtk_toggle_action_get_active(action)) {
-options.gui_gtk3_better_fog ^= 1;
-update_map_canvas_visible();
   }
 }
 
@@ -1588,7 +1576,7 @@
   {"SHOW_FOG_OF_WAR", NULL, _("Fog of _War"),
NULL, NULL, G_CALLBACK(show_fog_of_war_callback), FALSE},
   {"SHOW_BETTER_FOG_OF_WAR", NULL, _("Better Fog of War"),
-   NULL, NULL, G_CALLBACK(show_better_fog_of_war_callback), FALSE},
+   NULL, NULL, NULL, FALSE},
 
   {"FULL_SCREEN", NULL, _("_Fullscreen"),
"Return", NULL, G_CALLBACK(full_screen_callback), FALSE}
@@ -2044,7 +2032,6 @@
   menus_set_sensitive(safe_group, "SHOW_UNIT_SHIELDS",
   options.draw_units || options.draw_focus_unit);
   menus_set_sensitive(safe_group, "SHOW_FOCUS_UNIT", !options.draw_units);
-  menus_set_sensitive(safe_group, "SHOW_BETTER_FOG_OF_WAR", 
options.draw_fog_of_war);
 }
 
 /
@@ -2675,13 +2662,11 @@
   menus_set_active(safe_group, "SHOW_UNIT_SHIELDS", options.draw_unit_shields);
   menus_set_active(safe_group, "SHOW_FOCUS_UNIT", options.draw_focus_unit);
   menus_set_active(safe_group, "SHOW_FOG_OF_WAR", options.draw_fog_of_war);
-  if (tileset_use_hard_coded_fog(tileset)) {
-menus_set_visible(safe_group, "SHOW_BETTER_FOG_OF_WAR", TRUE, TRUE);
-menus_set_active(safe_group, "SHOW_BETTER_FOG_OF_WAR",
- options.gui_gtk3_better_fog);
-  } else {
-menus_set_visible(safe_group, "SHOW_BETTER_FOG_OF_WAR", FALSE, FALSE);
-  }
+
+  /* To avoid run-time errors from gtk3, we have to have this action,
+   * really used by gtk2-client only, defined also in gtk3-client code.
+   * We just don't show it to the user. */
+  menus_set_visible(safe_group, "SHOW_BETTER_FOG_OF_WAR", FALSE, FALSE);
 
   view_menu_update_sensitivity();
 

Modified: trunk/client/options.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/options.c?rev=30165&r1=30164&r2=30165&view=diff
==
--- trunk/client/options.c  (original)
+++ trunk/client/options.c  Thu Oct 22 16:25:47 2015
@@ -219,7 +219,6 @@
   .gui_gtk3_dialogs_on_top = TRUE,
   .gui_gtk3_show_task_icons = TRUE,
   .gui_gtk3_enable_tabs = TRUE,
-  .gui_gtk3_better_fog = TRUE,
   .gui_gtk3_show_chat_message_time = FALSE,
   .gui_gtk3_new_messages_go_to_top = FALSE,
   .gui_gtk3_show_message_window_buttons = TRUE,
@@ -2490,13 +2489,6 @@
  "be shown as separate tabs rather than in popup "
  "dialogs."),
   COC_INTERFACE, GUI_GTK3, TRUE, NULL),
-  GEN_BOOL_OPTION(gui_gtk3_better_fog,
-  N_("Better fog-of-war drawing"),
-  N_("If this is enabled then a better method is used "
- "for drawing fog-of-war.  It is not any slower but "
- "will consume about twice as much memory."),
-  COC_GRAPHICS, GUI_GTK3,
-  TRUE, view_option_changed_callback),
   GEN_BOOL_OPTION(gui_gtk3_show_chat_message_time,
   N_("Show time for 

[Freeciv-commits] r30167 - in /branches/S2_5/client: gui-gtk-3.0/gui_main.c gui-gtk-3.0/menu.c options.c options.h

2015-10-22 Thread cazfi74
Author: cazfi
Date: Thu Oct 22 16:26:04 2015
New Revision: 30167

URL: http://svn.gna.org/viewcvs/freeciv?rev=30167&view=rev
Log:
Removed gtk3-client option about Better Fog of War that did nothing.

See patch #6440

Modified:
branches/S2_5/client/gui-gtk-3.0/gui_main.c
branches/S2_5/client/gui-gtk-3.0/menu.c
branches/S2_5/client/options.c
branches/S2_5/client/options.h

Modified: branches/S2_5/client/gui-gtk-3.0/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-gtk-3.0/gui_main.c?rev=30167&r1=30166&r2=30167&view=diff
==
--- branches/S2_5/client/gui-gtk-3.0/gui_main.c (original)
+++ branches/S2_5/client/gui-gtk-3.0/gui_main.c Thu Oct 22 16:26:04 2015
@@ -1604,7 +1604,6 @@
   MIGRATE_OPTION(dialogs_on_top);
   MIGRATE_OPTION(show_task_icons);
   MIGRATE_OPTION(enable_tabs);
-  MIGRATE_OPTION(better_fog);
   MIGRATE_OPTION(show_chat_message_time);
   MIGRATE_OPTION(new_messages_go_to_top);
   MIGRATE_OPTION(show_message_window_buttons);

Modified: branches/S2_5/client/gui-gtk-3.0/menu.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-gtk-3.0/menu.c?rev=30167&r1=30166&r2=30167&view=diff
==
--- branches/S2_5/client/gui-gtk-3.0/menu.c (original)
+++ branches/S2_5/client/gui-gtk-3.0/menu.c Thu Oct 22 16:26:04 2015
@@ -771,18 +771,6 @@
   if (draw_fog_of_war ^ gtk_toggle_action_get_active(action)) {
 key_fog_of_war_toggle();
 view_menu_update_sensitivity();
-  }
-}
-
-/
-  Action "SHOW_BETTER_FOG_OF_WAR" callback.
-*/
-static void show_better_fog_of_war_callback(GtkToggleAction *action,
-gpointer data)
-{
-  if (gui_gtk3_better_fog ^ gtk_toggle_action_get_active(action)) {
-gui_gtk3_better_fog ^= 1;
-update_map_canvas_visible();
   }
 }
 
@@ -1517,7 +1505,7 @@
   {"SHOW_FOG_OF_WAR", NULL, _("Fog of _War"),
NULL, NULL, G_CALLBACK(show_fog_of_war_callback), FALSE},
   {"SHOW_BETTER_FOG_OF_WAR", NULL, _("Better Fog of War"),
-   NULL, NULL, G_CALLBACK(show_better_fog_of_war_callback), FALSE},
+   NULL, NULL, NULL, FALSE},
 
   {"FULL_SCREEN", NULL, _("_Fullscreen"),
"Return", NULL, G_CALLBACK(full_screen_callback), FALSE}
@@ -1962,7 +1950,6 @@
   menus_set_sensitive(safe_group, "SHOW_UNIT_SHIELDS",
   draw_units || draw_focus_unit);
   menus_set_sensitive(safe_group, "SHOW_FOCUS_UNIT", !draw_units);
-  menus_set_sensitive(safe_group, "SHOW_BETTER_FOG_OF_WAR", draw_fog_of_war);
 }
 
 /
@@ -2527,13 +2514,11 @@
   menus_set_active(safe_group, "SHOW_UNIT_SHIELDS", draw_unit_shields);
   menus_set_active(safe_group, "SHOW_FOCUS_UNIT", draw_focus_unit);
   menus_set_active(safe_group, "SHOW_FOG_OF_WAR", draw_fog_of_war);
-  if (tileset_use_hard_coded_fog(tileset)) {
-menus_set_visible(safe_group, "SHOW_BETTER_FOG_OF_WAR", TRUE, TRUE);
-menus_set_active(safe_group, "SHOW_BETTER_FOG_OF_WAR",
- gui_gtk3_better_fog);
-  } else {
-menus_set_visible(safe_group, "SHOW_BETTER_FOG_OF_WAR", FALSE, FALSE);
-  }
+
+  /* To avoid run-time errors from gtk3, we have to have this action,
+   * really used by gtk2-client only, defined also in gtk3-client code.
+   * We just don't show it to the user. */
+  menus_set_visible(safe_group, "SHOW_BETTER_FOG_OF_WAR", FALSE, FALSE);
 
   view_menu_update_sensitivity();
 

Modified: branches/S2_5/client/options.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/options.c?rev=30167&r1=30166&r2=30167&view=diff
==
--- branches/S2_5/client/options.c  (original)
+++ branches/S2_5/client/options.c  Thu Oct 22 16:26:04 2015
@@ -200,7 +200,6 @@
 bool gui_gtk3_dialogs_on_top = TRUE;
 bool gui_gtk3_show_task_icons = TRUE;
 bool gui_gtk3_enable_tabs = TRUE;
-bool gui_gtk3_better_fog = TRUE;
 bool gui_gtk3_show_chat_message_time = FALSE;
 bool gui_gtk3_new_messages_go_to_top = FALSE;
 bool gui_gtk3_show_message_window_buttons = TRUE;
@@ -2398,13 +2397,6 @@
  "be shown as separate tabs rather than in popup "
  "dialogs."),
   COC_INTERFACE, GUI_GTK3, TRUE, NULL),
-  GEN_BOOL_OPTION(gui_gtk3_better_fog,
-  N_("Better fog-of-war drawing"),
-  N_("If this is enabled then a better method is used "
- "for drawing fog-of-war.  It is not any slower but "
- "will consume about twice as much memory."),
-  COC_GRAPHICS, GUI_GTK3,
-  TRUE, view_option_changed_callback),
   GEN_BOOL_OPTION(gui_gtk3_show_cha

[Freeciv-commits] r30168 - /trunk/client/gui-sdl2/widget_label.c

2015-10-22 Thread cazfi74
Author: cazfi
Date: Thu Oct 22 16:37:58 2015
New Revision: 30168

URL: http://svn.gna.org/viewcvs/freeciv?rev=30168&view=rev
Log:
Fixed double surface free on sdl2-client themed label background handling.

See bug #23946

Modified:
trunk/client/gui-sdl2/widget_label.c

Modified: trunk/client/gui-sdl2/widget_label.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/widget_label.c?rev=30168&r1=30167&r2=30168&view=diff
==
--- trunk/client/gui-sdl2/widget_label.c(original)
+++ trunk/client/gui-sdl2/widget_label.cThu Oct 22 16:37:58 2015
@@ -206,7 +206,7 @@
 }
 
 /**
-  this Label is String16 with Icon.
+  This Label is UTF8 string with Icon.
 **/
 struct widget *create_iconlabel(SDL_Surface *pIcon, struct gui_layer *pDest,
 utf8_str *pstr, Uint32 flags)
@@ -232,14 +232,14 @@
 }
 
 /**
-  ThemeLabel is String16 with Background ( pIcon ).
+  ThemeLabel is UTF8 string with Background ( pIcon ).
 **/
 struct widget *create_themelabel2(SDL_Surface *pIcon, struct gui_layer *pDest,
   utf8_str *pstr, Uint16 w, Uint16 h,
   Uint32 flags)
 {
   struct widget *pLabel = NULL;
-  SDL_Surface *pBuf = NULL, *pTheme = NULL;
+  SDL_Surface *ptheme = NULL;
   SDL_Rect area;
   SDL_Color store = {0, 0, 0, 0};
   SDL_Color bg_color = *get_theme_color(COLOR_THEME_THEMELABEL2_BG);
@@ -264,27 +264,16 @@
   pLabel->size.w = MAX(pLabel->size.w, w);
   pLabel->size.h = MAX(pLabel->size.h, h);
 
-  pBuf = create_surf(pLabel->size.w, pLabel->size.h * 2, SDL_SWSURFACE);
-
-  if (flags & WF_RESTORE_BACKGROUND) {
-#if 0
-pTheme = SDL_DisplayFormatAlpha(pBuf);
-FREESURFACE(pBuf);
-#else  /* 0 */
-pTheme = pBuf;
-#endif /* 0 */
-  } else {
-pTheme = pBuf;
-  }
-
-  colorkey = SDL_MapRGBA(pTheme->format, pstr->bgcol.r,
+  ptheme = create_surf(pLabel->size.w, pLabel->size.h * 2, SDL_SWSURFACE);
+
+  colorkey = SDL_MapRGBA(ptheme->format, pstr->bgcol.r,
  pstr->bgcol.g, pstr->bgcol.b, pstr->bgcol.a);
-  SDL_FillRect(pTheme, NULL, colorkey);
+  SDL_FillRect(ptheme, NULL, colorkey);
 
   pLabel->size.x = 0;
   pLabel->size.y = 0;
   area = pLabel->size;
-  pLabel->dst = gui_layer_new(0, 0, pTheme);
+  pLabel->dst = gui_layer_new(0, 0, ptheme);
 
   /* normal */
   redraw_iconlabel(pLabel);
@@ -294,13 +283,13 @@
   area.y = pLabel->size.h;
 
   if (flags & WF_RESTORE_BACKGROUND) {
-SDL_FillRect(pTheme, &area, map_rgba(pTheme->format, bg_color));
+SDL_FillRect(ptheme, &area, map_rgba(ptheme->format, bg_color));
 store = pstr->bgcol;
-SDL_GetRGBA(getpixel(pTheme, area.x , area.y), pTheme->format,
+SDL_GetRGBA(getpixel(ptheme, area.x , area.y), ptheme->format,
 &pstr->bgcol.r, &pstr->bgcol.g,
 &pstr->bgcol.b, &pstr->bgcol.a);
   } else {
-fill_rect_alpha(pTheme, &area, &bg_color);
+fill_rect_alpha(ptheme, &area, &bg_color);
   }
 
   pLabel->size.y = pLabel->size.h;
@@ -315,7 +304,7 @@
   if (flags & WF_FREE_THEME) {
 FREESURFACE(pLabel->theme);
   }
-  pLabel->theme = pTheme;
+  pLabel->theme = ptheme;
   FC_FREE(pLabel->dst);
   pLabel->dst = pDest;
 
@@ -331,34 +320,23 @@
   SDL_Color store = {0, 0, 0, 0};
   SDL_Color bg_color = *get_theme_color(COLOR_THEME_THEMELABEL2_BG);
   Uint32 colorkey, flags = get_wflags(pIconLabel);
-  SDL_Surface *pDest, *pTheme;
-  SDL_Surface *pBuf = create_surf(pIconLabel->size.w,
-  pIconLabel->size.h * 2, SDL_SWSURFACE);
-
-  if (flags & WF_RESTORE_BACKGROUND) {
-#if 0
-pTheme = SDL_DisplayFormatAlpha(pBuf);
-#else  /* 0 */
-pTheme = pBuf;
-#endif /* 0 */
-FREESURFACE(pBuf);
-  } else {
-pTheme = pBuf;
-  }
-
-  colorkey = SDL_MapRGBA(pTheme->format,
+  SDL_Surface *pDest;
+  SDL_Surface *ptheme = create_surf(pIconLabel->size.w,
+pIconLabel->size.h * 2, SDL_SWSURFACE);
+
+  colorkey = SDL_MapRGBA(ptheme->format,
  pIconLabel->string_utf8->bgcol.r,
  pIconLabel->string_utf8->bgcol.g,
  pIconLabel->string_utf8->bgcol.b,
  pIconLabel->string_utf8->bgcol.a);
-  SDL_FillRect(pTheme, NULL, colorkey);
+  SDL_FillRect(ptheme, NULL, colorkey);
 
   start = pIconLabel->size;
   pIconLabel->size.x = 0;
   pIconLabel->size.y = 0;
   area = start;
   pDest = pIconLabel->dst->surface;
-  pIconLabel->dst->surface = pTheme;
+  pIconLabel->dst->surface = ptheme;
 
   /* normal */
   redraw_iconlabel(pIconLabel);
@@ -368,15 +346,15 @@
   area.y = pIconLabel->size.h;
 
  

[Freeciv-commits] r30169 - /branches/S2_6/client/gui-sdl2/widget_label.c

2015-10-22 Thread cazfi74
Author: cazfi
Date: Thu Oct 22 16:38:06 2015
New Revision: 30169

URL: http://svn.gna.org/viewcvs/freeciv?rev=30169&view=rev
Log:
Fixed double surface free on sdl2-client themed label background handling.

See bug #23946

Modified:
branches/S2_6/client/gui-sdl2/widget_label.c

Modified: branches/S2_6/client/gui-sdl2/widget_label.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl2/widget_label.c?rev=30169&r1=30168&r2=30169&view=diff
==
--- branches/S2_6/client/gui-sdl2/widget_label.c(original)
+++ branches/S2_6/client/gui-sdl2/widget_label.cThu Oct 22 16:38:06 2015
@@ -206,7 +206,7 @@
 }
 
 /**
-  this Label is String16 with Icon.
+  This Label is UTF8 string with Icon.
 **/
 struct widget *create_iconlabel(SDL_Surface *pIcon, struct gui_layer *pDest,
 utf8_str *pstr, Uint32 flags)
@@ -232,14 +232,14 @@
 }
 
 /**
-  ThemeLabel is String16 with Background ( pIcon ).
+  ThemeLabel is UTF8 string with Background ( pIcon ).
 **/
 struct widget *create_themelabel2(SDL_Surface *pIcon, struct gui_layer *pDest,
   utf8_str *pstr, Uint16 w, Uint16 h,
   Uint32 flags)
 {
   struct widget *pLabel = NULL;
-  SDL_Surface *pBuf = NULL, *pTheme = NULL;
+  SDL_Surface *ptheme = NULL;
   SDL_Rect area;
   SDL_Color store = {0, 0, 0, 0};
   SDL_Color bg_color = *get_theme_color(COLOR_THEME_THEMELABEL2_BG);
@@ -264,27 +264,16 @@
   pLabel->size.w = MAX(pLabel->size.w, w);
   pLabel->size.h = MAX(pLabel->size.h, h);
 
-  pBuf = create_surf(pLabel->size.w, pLabel->size.h * 2, SDL_SWSURFACE);
-
-  if (flags & WF_RESTORE_BACKGROUND) {
-#if 0
-pTheme = SDL_DisplayFormatAlpha(pBuf);
-FREESURFACE(pBuf);
-#else  /* 0 */
-pTheme = pBuf;
-#endif /* 0 */
-  } else {
-pTheme = pBuf;
-  }
-
-  colorkey = SDL_MapRGBA(pTheme->format, pstr->bgcol.r,
+  ptheme = create_surf(pLabel->size.w, pLabel->size.h * 2, SDL_SWSURFACE);
+
+  colorkey = SDL_MapRGBA(ptheme->format, pstr->bgcol.r,
  pstr->bgcol.g, pstr->bgcol.b, pstr->bgcol.a);
-  SDL_FillRect(pTheme, NULL, colorkey);
+  SDL_FillRect(ptheme, NULL, colorkey);
 
   pLabel->size.x = 0;
   pLabel->size.y = 0;
   area = pLabel->size;
-  pLabel->dst = gui_layer_new(0, 0, pTheme);
+  pLabel->dst = gui_layer_new(0, 0, ptheme);
 
   /* normal */
   redraw_iconlabel(pLabel);
@@ -294,13 +283,13 @@
   area.y = pLabel->size.h;
 
   if (flags & WF_RESTORE_BACKGROUND) {
-SDL_FillRect(pTheme, &area, map_rgba(pTheme->format, bg_color));
+SDL_FillRect(ptheme, &area, map_rgba(ptheme->format, bg_color));
 store = pstr->bgcol;
-SDL_GetRGBA(getpixel(pTheme, area.x , area.y), pTheme->format,
+SDL_GetRGBA(getpixel(ptheme, area.x , area.y), ptheme->format,
 &pstr->bgcol.r, &pstr->bgcol.g,
 &pstr->bgcol.b, &pstr->bgcol.a);
   } else {
-fill_rect_alpha(pTheme, &area, &bg_color);
+fill_rect_alpha(ptheme, &area, &bg_color);
   }
 
   pLabel->size.y = pLabel->size.h;
@@ -315,7 +304,7 @@
   if (flags & WF_FREE_THEME) {
 FREESURFACE(pLabel->theme);
   }
-  pLabel->theme = pTheme;
+  pLabel->theme = ptheme;
   FC_FREE(pLabel->dst);
   pLabel->dst = pDest;
 
@@ -331,34 +320,23 @@
   SDL_Color store = {0, 0, 0, 0};
   SDL_Color bg_color = *get_theme_color(COLOR_THEME_THEMELABEL2_BG);
   Uint32 colorkey, flags = get_wflags(pIconLabel);
-  SDL_Surface *pDest, *pTheme;
-  SDL_Surface *pBuf = create_surf(pIconLabel->size.w,
-  pIconLabel->size.h * 2, SDL_SWSURFACE);
-
-  if (flags & WF_RESTORE_BACKGROUND) {
-#if 0
-pTheme = SDL_DisplayFormatAlpha(pBuf);
-#else  /* 0 */
-pTheme = pBuf;
-#endif /* 0 */
-FREESURFACE(pBuf);
-  } else {
-pTheme = pBuf;
-  }
-
-  colorkey = SDL_MapRGBA(pTheme->format,
+  SDL_Surface *pDest;
+  SDL_Surface *ptheme = create_surf(pIconLabel->size.w,
+pIconLabel->size.h * 2, SDL_SWSURFACE);
+
+  colorkey = SDL_MapRGBA(ptheme->format,
  pIconLabel->string_utf8->bgcol.r,
  pIconLabel->string_utf8->bgcol.g,
  pIconLabel->string_utf8->bgcol.b,
  pIconLabel->string_utf8->bgcol.a);
-  SDL_FillRect(pTheme, NULL, colorkey);
+  SDL_FillRect(ptheme, NULL, colorkey);
 
   start = pIconLabel->size;
   pIconLabel->size.x = 0;
   pIconLabel->size.y = 0;
   area = start;
   pDest = pIconLabel->dst->surface;
-  pIconLabel->dst->surface = pTheme;
+  pIconLabel->dst->surface = ptheme;
 
   /* normal */
   redraw_iconlabel(pIconLabel);
@@ -368,15 +346,15

[Freeciv-commits] r30170 - /trunk/tools/ruledit/tab_unit.cpp

2015-10-22 Thread cazfi74
Author: cazfi
Date: Thu Oct 22 18:13:48 2015
New Revision: 30170

URL: http://svn.gna.org/viewcvs/freeciv?rev=30170&view=rev
Log:
Crashed ruledit crash when requesting edit dialog without any unit type being 
selected.

See bug #23952

Modified:
trunk/tools/ruledit/tab_unit.cpp

Modified: trunk/tools/ruledit/tab_unit.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/tab_unit.cpp?rev=30170&r1=30169&r2=30170&view=diff
==
--- trunk/tools/ruledit/tab_unit.cpp(original)
+++ trunk/tools/ruledit/tab_unit.cppThu Oct 22 18:13:48 2015
@@ -187,9 +187,11 @@
 **/
 void tab_unit::edit_now()
 {
-  edit_utype *edit = new edit_utype(ui, selected);
-
-  edit->show();
+  if (selected != nullptr) {
+edit_utype *edit = new edit_utype(ui, selected);
+
+edit->show();
+  }
 }
 
 /**


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


[Freeciv-commits] r30171 - in /trunk/common: movement.c movement.h

2015-10-22 Thread cazfi74
Author: cazfi
Date: Thu Oct 22 22:53:46 2015
New Revision: 30171

URL: http://svn.gna.org/viewcvs/freeciv?rev=30171&view=rev
Log:
Gave specific unit_move_to_tile_test() return value for animals unable to move
out of native terrain.

See patch #6456

Modified:
trunk/common/movement.c
trunk/common/movement.h

Modified: trunk/common/movement.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/movement.c?rev=30171&r1=30170&r2=30171&view=diff
==
--- trunk/common/movement.c (original)
+++ trunk/common/movement.c Thu Oct 22 22:53:46 2015
@@ -580,7 +580,7 @@
   /* 4) */
   if (puowner->ai_common.barbarian_type == ANIMAL_BARBARIAN
   && dst_tile->terrain->animal != punittype) {
-return MR_NO_TRANSPORTER_CAPACITY;
+return MR_ANIMAL_DISALLOWED;
   }
 
   /* 5) */

Modified: trunk/common/movement.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/movement.h?rev=30171&r1=30170&r2=30171&view=diff
==
--- trunk/common/movement.h (original)
+++ trunk/common/movement.h Thu Oct 22 22:53:46 2015
@@ -44,6 +44,7 @@
   MR_TRIREME,
   MR_CANNOT_DISEMBARK,
   MR_NON_NATIVE_MOVE,  /* Usually RMM_RELAXED road diagonally without link */
+  MR_ANIMAL_DISALLOWED
 };
 
 int utype_move_rate(const struct unit_type *utype, const struct tile *ptile,


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


[Freeciv-commits] r30172 - in /branches/S2_6/common: movement.c movement.h

2015-10-22 Thread cazfi74
Author: cazfi
Date: Thu Oct 22 22:53:52 2015
New Revision: 30172

URL: http://svn.gna.org/viewcvs/freeciv?rev=30172&view=rev
Log:
Gave specific unit_move_to_tile_test() return value for animals unable to move
out of native terrain.

See patch #6456

Modified:
branches/S2_6/common/movement.c
branches/S2_6/common/movement.h

Modified: branches/S2_6/common/movement.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/movement.c?rev=30172&r1=30171&r2=30172&view=diff
==
--- branches/S2_6/common/movement.c (original)
+++ branches/S2_6/common/movement.c Thu Oct 22 22:53:52 2015
@@ -580,7 +580,7 @@
   /* 4) */
   if (puowner->ai_common.barbarian_type == ANIMAL_BARBARIAN
   && dst_tile->terrain->animal != punittype) {
-return MR_NO_TRANSPORTER_CAPACITY;
+return MR_ANIMAL_DISALLOWED;
   }
 
   /* 5) */

Modified: branches/S2_6/common/movement.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/movement.h?rev=30172&r1=30171&r2=30172&view=diff
==
--- branches/S2_6/common/movement.h (original)
+++ branches/S2_6/common/movement.h Thu Oct 22 22:53:52 2015
@@ -44,6 +44,7 @@
   MR_TRIREME,
   MR_CANNOT_DISEMBARK,
   MR_NON_NATIVE_MOVE,  /* Usually RMM_RELAXED road diagonally without link */
+  MR_ANIMAL_DISALLOWED
 };
 
 int utype_move_rate(const struct unit_type *utype, const struct tile *ptile,


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


[Freeciv-commits] r30174 - in /branches/S2_6: ./ common/ m4/ server/ server/generator/ utility/

2015-10-22 Thread cazfi74
Author: cazfi
Date: Fri Oct 23 03:48:09 2015
New Revision: 30174

URL: http://svn.gna.org/viewcvs/freeciv?rev=30174&view=rev
Log:
Added configure option --enable-testmatic for test system integration.

See patch #6437

Added:
branches/S2_6/m4/testmatic.m4
Modified:
branches/S2_6/Makefile.am
branches/S2_6/common/dataio.c
branches/S2_6/configure.ac
branches/S2_6/server/generator/mapgen.c
branches/S2_6/server/srv_main.c
branches/S2_6/server/stdinhand.c
branches/S2_6/utility/log.h
branches/S2_6/utility/registry_ini.c

Modified: branches/S2_6/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/Makefile.am?rev=30174&r1=30173&r2=30174&view=diff
==
--- branches/S2_6/Makefile.am   (original)
+++ branches/S2_6/Makefile.am   Fri Oct 23 03:48:09 2015
@@ -77,6 +77,7 @@
m4/web-client.m4\
m4/xaw-client.m4\
m4/x.m4 \
+   m4/testmatic.m4 \
scripts/mapimg2anim \
scripts/setup_auth_server.sh\
scripts/diff_ignore

Modified: branches/S2_6/common/dataio.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/dataio.c?rev=30174&r1=30173&r2=30174&view=diff
==
--- branches/S2_6/common/dataio.c   (original)
+++ branches/S2_6/common/dataio.c   Fri Oct 23 03:48:09 2015
@@ -70,6 +70,10 @@
 
 /* Uncomment to make field range tests to asserts, fatal with -F */
 /* #define FIELD_RANGE_ASSERT */
+
+#if defined(TESTMATIC_ENABLED) && !defined(FIELD_RANGE_ASSERT)
+#define FIELD_RANGE_ASSERT
+#endif
 
 #ifdef FIELD_RANGE_ASSERT
 /* This evaluates _test_ twice. If that's a problem,

Modified: branches/S2_6/configure.ac
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/configure.ac?rev=30174&r1=30173&r2=30174&view=diff
==
--- branches/S2_6/configure.ac  (original)
+++ branches/S2_6/configure.ac  Fri Oct 23 03:48:09 2015
@@ -247,6 +247,8 @@
 fcweb=false
 
 FC_WEB_CLIENT
+
+FC_TESTMATIC
 
 dnl no:   Do not compile client.
 dnl auto: Autodetect one.

Added: branches/S2_6/m4/testmatic.m4
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/m4/testmatic.m4?rev=30174&view=auto
==
--- branches/S2_6/m4/testmatic.m4   (added)
+++ branches/S2_6/m4/testmatic.m4   Fri Oct 23 03:48:09 2015
@@ -0,0 +1,19 @@
+# Freeciv testing support
+
+#
+#
+AC_DEFUN([FC_TESTMATIC],
+[
+AC_ARG_ENABLE([testmatic],
+  AS_HELP_STRING([--enable-testmatic],
+[Produce logging useful in freeciv testing integration]),
+[case "${enableval}" in
+  yes) enable_testmatic=yes ;;
+  no)  enable_testmatic=no ;;
+  *)   AC_MSG_ERROR([bad value ${enableval} for --enable-testmatic]) ;;
+esac], [enable_testmatic=no])
+
+  if test x$enable_testmatic = xyes ; then
+AC_DEFINE([TESTMATIC_ENABLED], [1], [Testmatic integration enabled])
+  fi
+])

Modified: branches/S2_6/server/generator/mapgen.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/generator/mapgen.c?rev=30174&r1=30173&r2=30174&view=diff
==
--- branches/S2_6/server/generator/mapgen.c (original)
+++ branches/S2_6/server/generator/mapgen.c Fri Oct 23 03:48:09 2015
@@ -1381,7 +1381,12 @@
   if (map.server.seed == 0) {
 /* Create a "random" map seed. */
 map.server.seed = seed_rand & (MAX_UINT32 >> 1);
+#ifdef TESTMATIC_ENABLED
+/* Log command to reproduce the mapseed */
+log_testmatic("set mapseed %d", map.server.seed);
+#else /* TESTMATICE_ENABLED */
 log_debug("Setting map.seed:%d", map.server.seed);
+#endif /* TESTMATIC_ENABLED */
   }
 
   rstate = fc_rand_state();

Modified: branches/S2_6/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/srv_main.c?rev=30174&r1=30173&r2=30174&view=diff
==
--- branches/S2_6/server/srv_main.c (original)
+++ branches/S2_6/server/srv_main.c Fri Oct 23 03:48:09 2015
@@ -196,9 +196,14 @@
 /* We strip the high bit for now because neither game file nor
server options can handle unsigned ints yet. - Cedric */
 game.server.seed = time(NULL) & (MAX_UINT32 >> 1);
+#ifdef TESTMATIC_ENABLED
+ /* Log command to reproduce the gameseed */
+log_testmatic("set gameseed %d", game.server.seed);
+#else  /* TESTMATIC_ENABLED */
 log_debug("Setting game.seed:%d", game.server.seed);
-  }
- 
+#endif /* TESTMATIC_ENABLED */
+  }
+
   if (!fc_rand_is_init()) {
 fc_srand(game.server.seed);
   }

Modified: branches/S2_6/server/stdinhand.c
URL: 
http://svn.gna.org/viewcvs/freeci

[Freeciv-commits] r30173 - in /trunk: ./ common/ m4/ server/ server/generator/ utility/

2015-10-22 Thread cazfi74
Author: cazfi
Date: Fri Oct 23 03:47:56 2015
New Revision: 30173

URL: http://svn.gna.org/viewcvs/freeciv?rev=30173&view=rev
Log:
Added configure option --enable-testmatic for test system integration.

See patch #6437

Added:
trunk/m4/testmatic.m4
Modified:
trunk/Makefile.am
trunk/common/dataio.c
trunk/configure.ac
trunk/server/generator/mapgen.c
trunk/server/srv_main.c
trunk/server/stdinhand.c
trunk/utility/log.h
trunk/utility/registry_ini.c

Modified: trunk/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/Makefile.am?rev=30173&r1=30172&r2=30173&view=diff
==
--- trunk/Makefile.am   (original)
+++ trunk/Makefile.am   Fri Oct 23 03:47:56 2015
@@ -77,6 +77,7 @@
m4/sound.m4 \
m4/vsnprintf.m4 \
m4/web-client.m4\
+   m4/testmatic.m4 \
scripts/mapimg2anim \
scripts/setup_auth_server.sh\
scripts/diff_ignore

Modified: trunk/common/dataio.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/dataio.c?rev=30173&r1=30172&r2=30173&view=diff
==
--- trunk/common/dataio.c   (original)
+++ trunk/common/dataio.c   Fri Oct 23 03:47:56 2015
@@ -70,6 +70,10 @@
 
 /* Uncomment to make field range tests to asserts, fatal with -F */
 /* #define FIELD_RANGE_ASSERT */
+
+#if defined(TESTMATIC_ENABLED) && !defined(FIELD_RANGE_ASSERT)
+#define FIELD_RANGE_ASSERT
+#endif
 
 #ifdef FIELD_RANGE_ASSERT
 /* This evaluates _test_ twice. If that's a problem,

Modified: trunk/configure.ac
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/configure.ac?rev=30173&r1=30172&r2=30173&view=diff
==
--- trunk/configure.ac  (original)
+++ trunk/configure.ac  Fri Oct 23 03:47:56 2015
@@ -281,6 +281,8 @@
 esac], [fcweb=false])
 
 FC_WEB_CLIENT
+
+FC_TESTMATIC
 
 dnl no:   Do not compile client.
 dnl auto: Autodetect one.

Added: trunk/m4/testmatic.m4
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/m4/testmatic.m4?rev=30173&view=auto
==
--- trunk/m4/testmatic.m4   (added)
+++ trunk/m4/testmatic.m4   Fri Oct 23 03:47:56 2015
@@ -0,0 +1,19 @@
+# Freeciv testing support
+
+#
+#
+AC_DEFUN([FC_TESTMATIC],
+[
+AC_ARG_ENABLE([testmatic],
+  AS_HELP_STRING([--enable-testmatic],
+[Produce logging useful in freeciv testing integration]),
+[case "${enableval}" in
+  yes) enable_testmatic=yes ;;
+  no)  enable_testmatic=no ;;
+  *)   AC_MSG_ERROR([bad value ${enableval} for --enable-testmatic]) ;;
+esac], [enable_testmatic=no])
+
+  if test x$enable_testmatic = xyes ; then
+AC_DEFINE([TESTMATIC_ENABLED], [1], [Testmatic integration enabled])
+  fi
+])

Modified: trunk/server/generator/mapgen.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/generator/mapgen.c?rev=30173&r1=30172&r2=30173&view=diff
==
--- trunk/server/generator/mapgen.c (original)
+++ trunk/server/generator/mapgen.c Fri Oct 23 03:47:56 2015
@@ -1381,7 +1381,12 @@
   if (map.server.seed == 0) {
 /* Create a "random" map seed. */
 map.server.seed = seed_rand & (MAX_UINT32 >> 1);
+#ifdef TESTMATIC_ENABLED
+/* Log command to reproduce the mapseed */
+log_testmatic("set mapseed %d", map.server.seed);
+#else /* TESTMATICE_ENABLED */
 log_debug("Setting map.seed:%d", map.server.seed);
+#endif /* TESTMATIC_ENABLED */
   }
 
   rstate = fc_rand_state();

Modified: trunk/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/srv_main.c?rev=30173&r1=30172&r2=30173&view=diff
==
--- trunk/server/srv_main.c (original)
+++ trunk/server/srv_main.c Fri Oct 23 03:47:56 2015
@@ -196,9 +196,14 @@
 /* We strip the high bit for now because neither game file nor
server options can handle unsigned ints yet. - Cedric */
 game.server.seed = time(NULL) & (MAX_UINT32 >> 1);
+#ifdef TESTMATIC_ENABLED
+ /* Log command to reproduce the gameseed */
+log_testmatic("set gameseed %d", game.server.seed);
+#else  /* TESTMATIC_ENABLED */
 log_debug("Setting game.seed:%d", game.server.seed);
-  }
- 
+#endif /* TESTMATIC_ENABLED */
+  }
+
   if (!fc_rand_is_init()) {
 fc_srand(game.server.seed);
   }

Modified: trunk/server/stdinhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/stdinhand.c?rev=30173&r1=30172&r2=30173&view=diff
==
--- trunk/server/stdinhand.c(original)
+++ trunk/server/stdinhand.cFri Oct 23 03:47:56 2015
@@ -1169,7 +1169,7