<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40693 >

As reported on freeciv-i18n, the attached patches fix the
"And, became more experienced!" event message grammar by
making the function notify_unit_experience() not attempt
to link up to previous event message. So for example the
user will now see:

  "Your diplomat succeeded in bribing the musketeer."
  "Your diplomat became more experienced!"

and will have to figure out that the veterancy was due to
the just prior event.


-----------------------------------------------------------------------
子供のように扱うな!
 server/diplomats.c |    6 +++---
 server/unithand.c  |    4 ++--
 server/unittools.c |   27 ++++++++++++---------------
 server/unittools.h |    2 +-
 4 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/server/diplomats.c b/server/diplomats.c
index 845fe62..888e3a8 100644
--- a/server/diplomats.c
+++ b/server/diplomats.c
@@ -456,7 +456,7 @@ void diplomat_bribe(struct player *pplayer, struct unit *pdiplomat,
 		unit_name_translation(pdiplomat),
 		unit_name_translation(pvictim));
   if (maybe_make_veteran(pdiplomat)) {
-    notify_unit_experience(pdiplomat, TRUE);
+    notify_unit_experience(pdiplomat);
   }
   notify_player(uplayer, pvictim->tile, E_ENEMY_DIPLOMAT_BRIBE,
 		/* TRANS: <unit> ... <Poles> */
@@ -1138,7 +1138,7 @@ static bool diplomat_infiltrate_tile(struct player *pplayer,
 
 	/* Defending unit became more experienced? */
 	if (maybe_make_veteran(punit)) {
-	  notify_unit_experience(punit, FALSE);
+	  notify_unit_experience(punit);
 	}
 	wipe_unit(pdiplomat);
 	return FALSE;
@@ -1187,7 +1187,7 @@ static void diplomat_escape(struct player *pplayer, struct unit *pdiplomat,
 		  unit_name_translation(pdiplomat),
 		  city_name(spyhome));
     if (maybe_make_veteran(pdiplomat)) {
-      notify_unit_experience(pdiplomat, TRUE);
+      notify_unit_experience(pdiplomat);
     }
 
     /* being teleported costs all movement */
diff --git a/server/unithand.c b/server/unithand.c
index 7ffa30a..d5e8c8d 100644
--- a/server/unithand.c
+++ b/server/unithand.c
@@ -784,7 +784,7 @@ static bool unit_bombard(struct unit *punit, struct tile *ptile)
   }
 
   if (maybe_make_veteran(punit)) {
-    notify_unit_experience(punit, FALSE);
+    notify_unit_experience(punit);
   }
 
   send_unit_info(NULL, punit);
@@ -903,7 +903,7 @@ static void handle_unit_attack_request(struct unit *punit, struct unit *pdefende
 		  nation_adjective_for_player(unit_owner(plooser)),
 		  unit_name_translation(plooser));
     if (vet) {
-      notify_unit_experience(pwinner, TRUE);
+      notify_unit_experience(pwinner);
     }
     notify_player(unit_owner(plooser), def_tile, E_UNIT_LOST_ATT,
 		  /* TRANS: "... Cannon ... the Polish Destroyer." */
diff --git a/server/unittools.c b/server/unittools.c
index 455a9bb..83de20e 100644
--- a/server/unittools.c
+++ b/server/unittools.c
@@ -605,21 +605,18 @@ static bool maybe_settler_become_veteran(struct unit *punit)
 }
 
 /**************************************************************************
-  common notification for all experience levels.
-  When used immediately after another unit message, set also to TRUE.
+  Common notification for all experience levels.
 **************************************************************************/
-void notify_unit_experience(struct unit *punit, bool also)
+void notify_unit_experience(struct unit *punit)
 {
-  if (also) {
-    notify_player(unit_owner(punit), punit->tile, E_UNIT_BECAME_VET,
-  		  /* TRANS: And, <the unit> became ... */
-  		  _("And, became more experienced!"));
-  } else {
-    notify_player(unit_owner(punit), punit->tile, E_UNIT_BECAME_VET,
-  		  /* TRANS: Your <unit> became ... */
-  		  _("Your %s became more experienced!"),
-  		  unit_name_translation(punit));
+  if (!punit) {
+    return;
   }
+
+  notify_player(unit_owner(punit), punit->tile, E_UNIT_BECAME_VET,
+                /* TRANS: Your <unit> became ... */
+                _("Your %s became more experienced!"),
+                unit_name_translation(punit));
 }
 
 /**************************************************************************
@@ -645,7 +642,7 @@ static void update_unit_activity(struct unit *punit)
     /* settler may become veteran when doing something useful */
     if (activity != ACTIVITY_FORTIFYING && activity != ACTIVITY_SENTRY
        && maybe_settler_become_veteran(punit)) {
-      notify_unit_experience(punit, FALSE);
+      notify_unit_experience(punit);
     }
   }
 
@@ -1547,7 +1544,7 @@ void kill_unit(struct unit *pkiller, struct unit *punit, bool vet)
 		  nation_adjective_for_player(pvictim),
 		  unit_name_translation(punit));
     if (vet) {
-      notify_unit_experience(pkiller, TRUE);
+      notify_unit_experience(pkiller);
     }
     notify_player(pvictim, punit->tile, E_UNIT_LOST,
 		  /* TRANS: "Cannon ... the Polish Destroyer." */
@@ -1594,7 +1591,7 @@ void kill_unit(struct unit *pkiller, struct unit *punit, bool vet)
 		  unit_name_translation(punit),
 		  unitcount - 1);
     if (vet) {
-      notify_unit_experience(pkiller, TRUE);
+      notify_unit_experience(pkiller);
     }
 
     /* inform the owners: this only tells about owned units that were killed.
diff --git a/server/unittools.h b/server/unittools.h
index 29e80cd..23d6efd 100644
--- a/server/unittools.h
+++ b/server/unittools.h
@@ -23,7 +23,7 @@
 struct unit_type *find_a_unit_type(enum unit_role_id role,
 				   enum unit_role_id role_tech);
 bool maybe_make_veteran(struct unit *punit);
-void notify_unit_experience(struct unit *punit, bool also);
+void notify_unit_experience(struct unit *punit);
 void unit_versus_unit(struct unit *attacker, struct unit *defender,
 		      bool bombard);
 
 server/diplomats.c |    6 +++---
 server/unithand.c  |    4 ++--
 server/unittools.c |   27 ++++++++++++---------------
 server/unittools.h |    2 +-
 4 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/server/diplomats.c b/server/diplomats.c
index 17fa127..47ed601 100644
--- a/server/diplomats.c
+++ b/server/diplomats.c
@@ -458,7 +458,7 @@ void diplomat_bribe(struct player *pplayer, struct unit *pdiplomat,
 		unit_name_translation(pdiplomat),
 		unit_name_translation(pvictim));
   if (maybe_make_veteran(pdiplomat)) {
-    notify_unit_experience(pdiplomat, TRUE);
+    notify_unit_experience(pdiplomat);
   }
   notify_player(uplayer, pvictim->tile, E_ENEMY_DIPLOMAT_BRIBE,
 		/* TRANS: <unit> ... <Poles> */
@@ -1142,7 +1142,7 @@ static bool diplomat_infiltrate_tile(struct player *pplayer,
 
 	/* Defending unit became more experienced? */
 	if (maybe_make_veteran(punit)) {
-	  notify_unit_experience(punit, FALSE);
+	  notify_unit_experience(punit);
 	}
 	wipe_unit(pdiplomat);
 	return FALSE;
@@ -1191,7 +1191,7 @@ static void diplomat_escape(struct player *pplayer, struct unit *pdiplomat,
 		  unit_name_translation(pdiplomat),
 		  city_name(spyhome));
     if (maybe_make_veteran(pdiplomat)) {
-      notify_unit_experience(pdiplomat, TRUE);
+      notify_unit_experience(pdiplomat);
     }
 
     /* being teleported costs all movement */
diff --git a/server/unithand.c b/server/unithand.c
index 47ef3a4..2773d28 100644
--- a/server/unithand.c
+++ b/server/unithand.c
@@ -902,7 +902,7 @@ static bool unit_bombard(struct unit *punit, struct tile *ptile)
   }
 
   if (maybe_make_veteran(punit)) {
-    notify_unit_experience(punit, FALSE);
+    notify_unit_experience(punit);
   }
 
   send_unit_info(NULL, punit);
@@ -1021,7 +1021,7 @@ static void unit_attack_handling(struct unit *punit, struct unit *pdefender)
 		  nation_adjective_for_player(unit_owner(plooser)),
 		  unit_name_translation(plooser));
     if (vet) {
-      notify_unit_experience(pwinner, TRUE);
+      notify_unit_experience(pwinner);
     }
     notify_player(unit_owner(plooser), def_tile, E_UNIT_LOST_ATT,
 		  /* TRANS: "... Cannon ... the Polish Destroyer." */
diff --git a/server/unittools.c b/server/unittools.c
index 8576975..a938130 100644
--- a/server/unittools.c
+++ b/server/unittools.c
@@ -623,21 +623,18 @@ static bool maybe_settler_become_veteran(struct unit *punit)
 }
 
 /**************************************************************************
-  common notification for all experience levels.
-  When used immediately after another unit message, set also to TRUE.
+  Common notification for all experience levels.
 **************************************************************************/
-void notify_unit_experience(struct unit *punit, bool also)
+void notify_unit_experience(struct unit *punit)
 {
-  if (also) {
-    notify_player(unit_owner(punit), punit->tile, E_UNIT_BECAME_VET,
-  		  /* TRANS: And, <the unit> became ... */
-  		  _("And, became more experienced!"));
-  } else {
-    notify_player(unit_owner(punit), punit->tile, E_UNIT_BECAME_VET,
-  		  /* TRANS: Your <unit> became ... */
-  		  _("Your %s became more experienced!"),
-  		  unit_name_translation(punit));
+  if (!punit) {
+    return;
   }
+
+  notify_player(unit_owner(punit), unit_tile(punit), E_UNIT_BECAME_VET,
+                /* TRANS: Your <unit> became ... */
+                _("Your %s became more experienced!"),
+                unit_name_translation(punit));
 }
 
 /**************************************************************************
@@ -706,7 +703,7 @@ static void update_unit_activity(struct unit *punit)
 
     /* settler may become veteran when doing something useful */
     if (maybe_settler_become_veteran(punit)) {
-      notify_unit_experience(punit, FALSE);
+      notify_unit_experience(punit);
     }
     break;
   };
@@ -1693,7 +1690,7 @@ void kill_unit(struct unit *pkiller, struct unit *punit, bool vet)
 		  nation_adjective_for_player(pvictim),
 		  unit_name_translation(punit));
     if (vet) {
-      notify_unit_experience(pkiller, TRUE);
+      notify_unit_experience(pkiller);
     }
     notify_player(pvictim, punit->tile, E_UNIT_LOST_DEF,
 		  /* TRANS: "Cannon ... the Polish Destroyer." */
@@ -1740,7 +1737,7 @@ void kill_unit(struct unit *pkiller, struct unit *punit, bool vet)
 		  unit_name_translation(punit),
 		  unitcount - 1);
     if (vet) {
-      notify_unit_experience(pkiller, TRUE);
+      notify_unit_experience(pkiller);
     }
 
     /* inform the owners: this only tells about owned units that were killed.
diff --git a/server/unittools.h b/server/unittools.h
index 6b6faf6..744bb69 100644
--- a/server/unittools.h
+++ b/server/unittools.h
@@ -23,7 +23,7 @@
 struct unit_type *find_a_unit_type(enum unit_role_id role,
 				   enum unit_role_id role_tech);
 bool maybe_make_veteran(struct unit *punit);
-void notify_unit_experience(struct unit *punit, bool also);
+void notify_unit_experience(struct unit *punit);
 void unit_versus_unit(struct unit *attacker, struct unit *defender,
 		      bool bombard);
 
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to