[Freeciv-Dev] associate a player with events (PR#6523)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
This patch associates a player with each event (the player may be unset
for some events). Support is included for gui-gtk only.
For instance, if you make contact with a new civ you'll get a message
like "You have made contact with the Sioux." Under this patch, the
messagewin now has a "Player Info" button that will, for this message,
popup the intel dialog for the Sioux.
I wasn't sure whether the intel dialog or a meeting dialog should be
popped up. The intel dialog has much broader use (most messages simply
don't require a meeting), but the meeting dialog is more likely to
actually be useful. A good solution is that the inteldlg should have a
"meet player" button.
The basic goal is that you shouldn't have to open up the players dialog,
match up the name/nation of the player, then meet with (or get intel) on
them. All of the intermediate steps can be cut out so it's just a
single button-press.
The patch is rather large, but 90% of it is just repetitively adding a
(struct player *) argument to notify_player_ex (or notify_conn_ex,
vnotify_conn_ex, etc.).
jason
Index: ai/advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.8
diff -u -r1.8 advdiplomacy.c
--- ai/advdiplomacy.c 2003/09/28 17:52:54 1.8
+++ ai/advdiplomacy.c 2003/10/23 18:29:38
@@ -85,14 +85,15 @@
because we may want to highligh/present these messages differently
in the future.
***********************************************************************/
-static void notify(struct player *pplayer, const char *text, ...)
+static void notify(struct player *pplayer, struct player *ptarget,
+ const char *text, ...)
{
if (diplomacy_verbose) {
va_list ap;
struct conn_list *dest = (struct conn_list*)&pplayer->connections;
va_start(ap, text);
- vnotify_conn_ex(dest, -1, -1, E_DIPLOMACY, text, ap);
+ vnotify_conn_ex(dest, -1, -1, ptarget, E_DIPLOMACY, text, ap);
va_end(ap);
}
}
@@ -216,7 +217,8 @@
* leader. */
if (pplayer != ai->diplomacy.alliance_leader
&& pplayers_at_war(aplayer, ai->diplomacy.alliance_leader)) {
- notify(aplayer, _("*%s (AI)* %s leads our alliance. You must contact "
+ notify(aplayer, ai->diplomacy.alliance_leader,
+ _("*%s (AI)* %s leads our alliance. You must contact "
"and make peace with him first."), pplayer->name,
ai->diplomacy.alliance_leader->name);
worth = -BIG_NUMBER;
@@ -227,7 +229,8 @@
* ceasefire. */
if (adip->is_allied_with_enemy
&& pclause->type != CLAUSE_CEASEFIRE) {
- notify(aplayer, _("*%s (AI)* First break alliance with %s, %s"),
+ notify(aplayer, adip->is_allied_with_enemy,
+ _("*%s (AI)* First break alliance with %s, %s"),
pplayer->name, adip->is_allied_with_enemy->name,
aplayer->name);
worth = -BIG_NUMBER;
@@ -238,7 +241,8 @@
* we don't care, though. */
if (ai->diplomacy.acceptable_reputation > aplayer->reputation
&& ai->diplomacy.strategy != WIN_SPACE) {
- notify(aplayer, _("*%s (AI)* Begone scroundel, we all know that"
+ notify(aplayer, pplayer,
+ _("*%s (AI)* Begone scroundel, we all know that"
" you cannot be trusted!"), pplayer->name);
worth = -BIG_NUMBER;
break;
@@ -250,7 +254,8 @@
if ((pclause->type == CLAUSE_PEACE && ds > DS_PEACE)
|| (pclause->type == CLAUSE_CEASEFIRE && ds > DS_CEASEFIRE)) {
- notify(aplayer, _("*%s (AI)* I will not let you go that easy, %s."),
+ notify(aplayer, pplayer,
+ _("*%s (AI)* I will not let you go that easy, %s."),
pplayer->name, aplayer->name);
worth = -BIG_NUMBER;
break;
@@ -267,7 +272,8 @@
* let him live. */
if (pplayer_get_diplstate(aplayer, ai->diplomacy.alliance_leader)->type
== DS_CEASEFIRE && pclause->type == CLAUSE_CEASEFIRE) {
- notify(aplayer, _("*%s (AI)* %s recommended that I give you a
ceasefire."
+ notify(aplayer, ai->diplomacy.alliance_leader,
+ _("*%s (AI)* %s recommended that I give you a ceasefire."
" This is your lucky day."), pplayer->name,
ai->diplomacy.alliance_leader->name);
if (ai->diplomacy.target == aplayer) {
@@ -290,7 +296,8 @@
/* Steps of the ladder */
if (pclause->type == CLAUSE_PEACE) {
if (!pplayers_non_attack(pplayer, aplayer)) {
- notify(aplayer, _("*%s (AI)* Let us first cease hostilies, %s"),
+ notify(aplayer, pplayer,
+ _("*%s (AI)* Let us first cease hostilies, %s"),
pplayer->name, aplayer->name);
worth = -BIG_NUMBER;
} else {
@@ -298,7 +305,7 @@
}
} else if (pclause->type == CLAUSE_ALLIANCE) {
if (!pplayers_in_peace(pplayer, aplayer)) {
- notify(aplayer, _("*%s (AI)* Let us first make peace, %s"),
+ notify(aplayer, pplayer, _("*%s (AI)* Let us first make peace, %s"),
pplayer->name, aplayer->name);
worth = -BIG_NUMBER;
} else {
@@ -350,7 +357,8 @@
if (!offer || offer->owner != giver) {
/* City destroyed or taken during negotiations */
- notify(aplayer, _("*%s (AI)* You don't have the offered city!"),
+ notify(aplayer, pplayer,
+ _("*%s (AI)* You don't have the offered city!"),
pplayer->name);
worth = 0;
} else if (give) {
@@ -457,19 +465,21 @@
switch (pclause->type) {
case CLAUSE_ALLIANCE:
if (adip->is_allied_with_ally) {
- notify(aplayer, _("*%s (AI)* Welcome into our alliance %s!"),
+ notify(aplayer, pplayer,
+ _("*%s (AI)* Welcome into our alliance %s!"),
pplayer->name, aplayer->name);
} else {
- notify(aplayer, _("*%s (AI)* Yes, may we forever stand united, %s"),
+ notify(aplayer, pplayer,
+ _("*%s (AI)* Yes, may we forever stand united, %s"),
pplayer->name, aplayer->name);
}
break;
case CLAUSE_PEACE:
- notify(aplayer, _("*%s (AI)* Yes, peace in our time!"),
+ notify(aplayer, pplayer, _("*%s (AI)* Yes, peace in our time!"),
pplayer->name);
break;
case CLAUSE_CEASEFIRE:
- notify(aplayer, _("*%s (AI)* Agreed. No more hostilities, %s"),
+ notify(aplayer, pplayer, _("*%s (AI)* Agreed. No more hostilities, %s"),
pplayer->name, aplayer->name);
break;
default:
@@ -857,7 +867,8 @@
&& pplayer->diplstates[aplayer->player_no].has_reason_to_cancel >= 2) {
PLAYER_LOG(LOG_DIPL2, pplayer, ai, "Declaring war on %s in revenge",
target->name);
- notify(target, _("*%s (AI)* I will NOT accept such behaviour! This "
+ notify(target, pplayer,
+ _("*%s (AI)* I will NOT accept such behaviour! This "
"means WAR!"), pplayer->name);
ai_go_to_war(pplayer, ai, aplayer);
}
@@ -884,7 +895,8 @@
packet.id = aplayer->player_no;
packet.value1 = CLAUSE_ALLIANCE;
- notify(aplayer, _("*%s (AI)* Your attempt to conquer space for "
+ notify(aplayer, pplayer,
+ _("*%s (AI)* Your attempt to conquer space for "
"yourself alone betray your true intentions, and I "
"will have no more of our alliance!"), pplayer->name);
handle_player_cancel_pact(pplayer, &packet);
@@ -894,9 +906,11 @@
adip->love = -(BIG_NUMBER); /* Never forgive this */
} else if (ship->state == SSHIP_STARTED && !adip->warned_about_space) {
adip->warned_about_space = 10 + myrand(6);
- notify(aplayer, _("*%s (AI)* Your attempt to unilaterally "
+ notify(aplayer, pplayer,
+ _("*%s (AI)* Your attempt to unilaterally "
"dominate outer space is highly offensive."), pplayer->name);
- notify(aplayer, _("*%s (AI)* If you do not stop constructing your "
+ notify(aplayer, pplayer,
+ _("*%s (AI)* If you do not stop constructing your "
"spaceship, I may be forced to take action!"), pplayer->name);
}
if (aplayer->spaceship.state == SSHIP_LAUNCHED
@@ -920,16 +934,19 @@
}
if (pplayer->diplstates[target->player_no].has_reason_to_cancel > 0) {
/* We have good reason */
- notify(target, _("*%s (AI)* Your despicable actions will not go "
+ notify(target, pplayer,
+ _("*%s (AI)* Your despicable actions will not go "
"unpunished!"), pplayer->name);
} if (ai->diplomacy.player_intel[target->player_no].love < 0) {
/* We have a reason of sorts from way back. */
- notify(target, _("*%s (AI)* Finally I get around to you! Did "
+ notify(target, pplayer,
+ _("*%s (AI)* Finally I get around to you! Did "
"you really think you could get away with your crimes?"),
pplayer->name);
} else {
/* We have no legimitate reason... So what? */
- notify(target, _("*%s (AI)* Peace in ... some other time"),
+ notify(target, pplayer,
+ _("*%s (AI)* Peace in ... some other time"),
pplayer->name);
}
ai_go_to_war(pplayer, ai, target);
@@ -944,7 +961,8 @@
&& adip->at_war_with_ally
&& !adip->is_allied_with_ally
&& !pplayers_at_war(pplayer, aplayer)) {
- notify(aplayer, _("*%s (AI)* Your aggression against my allies was your "
+ notify(aplayer, pplayer,
+ _("*%s (AI)* Your aggression against my allies was your "
"your last mistake!"), pplayer->name);
ai_go_to_war(pplayer, ai, aplayer);
}
@@ -1027,17 +1045,20 @@
}
switch (adip->ally_patience--) {
case 0:
- notify(aplayer, _("*%s (AI)* Greetings our most trustworthy "
+ notify(aplayer, target,
+ _("*%s (AI)* Greetings our most trustworthy "
"ally, we call upon you to destroy our enemy, %s"),
pplayer->name, target->name);
break;
case -1:
- notify(aplayer, _("*%s (AI)* Greetings ally, I see you have not yet "
+ notify(aplayer, target,
+ _("*%s (AI)* Greetings ally, I see you have not yet "
"made war with our enemy, %s. Why do I need to remind "
"you of your promises?"), pplayer->name, target->name);
break;
case -2:
- notify(aplayer, _("*%s (AI)* Dishonoured one, we made a pact of "
+ notify(aplayer, pplayer,
+ _("*%s (AI)* Dishonoured one, we made a pact of "
"alliance, and yet you remain at peace with our mortal "
"enemy, %s! This is unacceptable, our alliance is no "
"more!"), pplayer->name, target->name);
@@ -1067,7 +1088,8 @@
}
ai_diplomacy_suggest(pplayer, aplayer, CLAUSE_ALLIANCE, 0);
adip->asked_about_alliance = !aplayer->ai.control ? 13 : 0;
- notify(aplayer, _("*%s (AI)* Greetings friend, may we suggest "
+ notify(aplayer, target,
+ _("*%s (AI)* Greetings friend, may we suggest "
"a joint campaign against %s?"), pplayer->name, target->name);
break;
@@ -1082,7 +1104,8 @@
}
ai_diplomacy_suggest(pplayer, aplayer, CLAUSE_PEACE, 0);
adip->asked_about_peace = !aplayer->ai.control ? 12 : 0;
- notify(aplayer, _("*%s (AI)* Greetings neighbour, may we suggest "
+ notify(aplayer, target,
+ _("*%s (AI)* Greetings neighbour, may we suggest "
"a joint campaign against %s?"), pplayer->name, target->name);
break;
@@ -1096,7 +1119,8 @@
}
ai_diplomacy_suggest(pplayer, aplayer, CLAUSE_CEASEFIRE, 0);
adip->asked_about_ceasefire = !aplayer->ai.control ? 9 : 0;
- notify(aplayer, _("*%s (AI)* %s is threatening us both, may we "
+ notify(aplayer, target,
+ _("*%s (AI)* %s is threatening us both, may we "
"suggest a cessation of hostilities?"), pplayer->name,
target->name);
break;
Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.146
diff -u -r1.146 aicity.c
--- ai/aicity.c 2003/10/08 16:56:07 1.146
+++ ai/aicity.c 2003/10/23 18:29:38
@@ -240,7 +240,8 @@
if (!pcity->is_building_unit && is_wonder(pcity->currently_building) &&
(is_unit_choice_type(bestchoice.type) ||
bestchoice.choice != pcity->currently_building))
- notify_player_ex(NULL, pcity->x, pcity->y, E_WONDER_STOPPED,
+ notify_player_ex(NULL, pcity->x, pcity->y, city_owner(pcity),
+ E_WONDER_STOPPED,
_("Game: The %s have stopped building The %s in %s."),
get_nation_name_plural(pplayer->nation),
get_impr_name_ex(pcity, pcity->currently_building),
@@ -249,7 +250,8 @@
if (bestchoice.type == CT_BUILDING && (pcity->is_building_unit ||
pcity->currently_building != bestchoice.choice) &&
is_wonder(bestchoice.choice)) {
- notify_player_ex(NULL, pcity->x, pcity->y, E_WONDER_STARTED,
+ notify_player_ex(NULL, pcity->x, pcity->y, city_owner(pcity),
+ E_WONDER_STARTED,
_("Game: The %s have started building The %s in %s."),
get_nation_name_plural(city_owner(pcity)->nation),
get_impr_name_ex(pcity, bestchoice.choice),
@@ -610,7 +612,7 @@
&& i != B_CITY /* selling city walls is really, really dumb -- Syela */
&& (wonder_replacement(pcity, i) ||
building_unwanted(city_owner(pcity), i))) {
do_sell_building(pplayer, pcity, i);
- notify_player_ex(pplayer, pcity->x, pcity->y, E_IMP_SOLD,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_IMP_SOLD,
_("Game: %s is selling %s (not needed) for %d."),
pcity->name, get_improvement_name(i),
improvement_value(i)/2);
Index: client/messagewin_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/messagewin_common.c,v
retrieving revision 1.12
diff -u -r1.12 messagewin_common.c
--- client/messagewin_common.c 2003/04/04 15:47:46 1.12
+++ client/messagewin_common.c 2003/10/23 18:29:38
@@ -22,6 +22,7 @@
#include "mem.h"
#include "citydlg_g.h"
+#include "inteldlg_g.h"
#include "mapview_g.h"
#include "messagewin_g.h"
#include "options.h"
@@ -136,6 +137,11 @@
messages[messages_total].x = packet->x;
messages[messages_total].y = packet->y;
+ if (packet->player >= 0 && packet->player < game.nplayers) {
+ messages[messages_total].pplayer = get_player(packet->player);
+ } else {
+ messages[messages_total].pplayer = NULL;
+ }
messages[messages_total].event = packet->event;
messages[messages_total].descr = s;
messages[messages_total].location_ok = (packet->x != -1 && packet->y != -1);
@@ -210,6 +216,18 @@
* highlighted at all - this is left up to the GUI. */
popup_city_dialog(pcity, FALSE);
}
+ }
+}
+
+/****************************************************************************
+ Called from messagewin.c if the user clicks on the "player info" button.
+****************************************************************************/
+void meswin_player_info(int message_index)
+{
+ assert(message_index >= 0 && message_index < messages_total);
+
+ if (messages[message_index].pplayer) {
+ popup_intel_dialog(messages[message_index].pplayer);
}
}
Index: client/messagewin_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/messagewin_common.h,v
retrieving revision 1.4
diff -u -r1.4 messagewin_common.h
--- client/messagewin_common.h 2002/11/15 22:15:01 1.4
+++ client/messagewin_common.h 2003/10/23 18:29:38
@@ -21,6 +21,7 @@
struct message {
char *descr;
int x, y;
+ struct player *pplayer;
enum event_type event;
bool location_ok, city_ok, visited;
};
@@ -37,6 +38,7 @@
int get_num_messages(void);
void set_message_visited_state(int message_index, bool state);
void meswin_popup_city(int message_index);
+void meswin_player_info(int message_index);
void meswin_goto(int message_index);
void meswin_double_click(int message_index);
Index: client/gui-gtk/messagewin.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/messagewin.c,v
retrieving revision 1.39
diff -u -r1.39 messagewin.c
--- client/gui-gtk/messagewin.c 2003/04/04 15:47:47 1.39
+++ client/gui-gtk/messagewin.c 2003/10/23 18:29:38
@@ -46,6 +46,7 @@
static GtkWidget *meswin_close_command;
static GtkWidget *meswin_goto_command;
static GtkWidget *meswin_popcity_command;
+static GtkWidget *meswin_playerinfo_command;
static GtkStyle *meswin_visited_style;
static GtkStyle *meswin_not_visited_style;
@@ -57,6 +58,7 @@
static void meswin_list_ucallback(GtkWidget * w, gint row, gint column);
static void meswin_goto_callback(GtkWidget * w, gpointer data);
static void meswin_popcity_callback(GtkWidget * w, gpointer data);
+static void meswin_playerinfo_callback(GtkWidget *w, gpointer data);
#define N_MSG_VIEW 24 /* max before scrolling happens */
@@ -170,6 +172,13 @@
meswin_popcity_command, TRUE, TRUE, 0 );
GTK_WIDGET_SET_FLAGS( meswin_popcity_command, GTK_CAN_DEFAULT );
+ meswin_playerinfo_command = gtk_accelbutton_new(_("Player _Information"),
+ accel);
+ gtk_widget_set_sensitive(meswin_playerinfo_command, FALSE);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(meswin_dialog_shell)->action_area),
+ meswin_playerinfo_command, TRUE, TRUE, 0);
+ GTK_WIDGET_SET_FLAGS(meswin_playerinfo_command, GTK_CAN_DEFAULT);
+
gtk_signal_connect(GTK_OBJECT(meswin_list), "select_row",
GTK_SIGNAL_FUNC(meswin_list_callback), NULL);
gtk_signal_connect(GTK_OBJECT(meswin_list), "unselect_row",
@@ -181,6 +190,8 @@
GTK_SIGNAL_FUNC(meswin_goto_callback), NULL);
gtk_signal_connect(GTK_OBJECT(meswin_popcity_command), "clicked",
GTK_SIGNAL_FUNC(meswin_popcity_callback), NULL);
+ gtk_signal_connect(GTK_OBJECT(meswin_playerinfo_command), "clicked",
+ GTK_SIGNAL_FUNC(meswin_playerinfo_callback), NULL);
if (gtk_rc_get_style(meswin_list))
meswin_visited_style = gtk_style_copy(gtk_rc_get_style(meswin_list));
@@ -252,6 +263,7 @@
gtk_widget_set_sensitive(meswin_goto_command, FALSE);
gtk_widget_set_sensitive(meswin_popcity_command, FALSE);
+ gtk_widget_set_sensitive(meswin_playerinfo_command, FALSE);
}
/**************************************************************************
@@ -270,6 +282,8 @@
gtk_widget_set_sensitive(meswin_goto_command, message->location_ok);
gtk_widget_set_sensitive(meswin_popcity_command, message->city_ok);
+ gtk_widget_set_sensitive(meswin_playerinfo_command,
+ (message->pplayer != NULL));
}
/**************************************************************************
@@ -279,6 +293,7 @@
{
gtk_widget_set_sensitive(meswin_goto_command, FALSE);
gtk_widget_set_sensitive(meswin_popcity_command, FALSE);
+ gtk_widget_set_sensitive(meswin_playerinfo_command, FALSE);
}
/**************************************************************************
@@ -320,5 +335,22 @@
row = GPOINTER_TO_INT(selection->data);
meswin_popup_city(row);
+ meswin_visited_item(row);
+}
+
+/****************************************************************************
+ Called when the "player info" button is clicked for an entry.
+****************************************************************************/
+static void meswin_playerinfo_callback(GtkWidget *w, gpointer data)
+{
+ GList *selection = selection = GTK_CLIST(meswin_list)->selection;
+ gint row;
+
+ if (!selection) {
+ return;
+ }
+
+ row = GPOINTER_TO_INT(selection->data);
+ meswin_player_info(row);
meswin_visited_item(row);
}
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.146
diff -u -r1.146 capstr.c
--- common/capstr.c 2003/10/02 17:54:57 1.146
+++ common/capstr.c 2003/10/23 18:29:38
@@ -81,7 +81,7 @@
"+diplomacy2 +citizens_style +root_tech auth " \
"+nat_ulimit +retake +goto_pack borders dip " \
"+packet_short_unit +unit_occupied endgame_rep " \
- "+terr_flags"
+ "+terr_flags +event_player"
/* "+1.14.0" is protocol for 1.14.0 release.
*
@@ -158,6 +158,8 @@
*
* "terr_flags" means terrain flags (with the TER_NO_BARBS flag) have been
* added.
+ *
+ * "event_player" means events may have an associated player.
*/
void init_our_capability(void)
Index: common/packets.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.c,v
retrieving revision 1.260
diff -u -r1.260 packets.c
--- common/packets.c 2003/10/07 18:55:08 1.260
+++ common/packets.c 2003/10/23 18:29:38
@@ -1798,6 +1798,7 @@
dio_put_uint8(&dout, packet->y);
}
dio_put_uint32(&dout, packet->event);
+ dio_put_uint32(&dout, packet->player);
dio_put_string(&dout, packet->message);
@@ -1833,6 +1834,8 @@
}
dio_get_uint32(&din, &packet->event);
+ dio_get_uint32(&din, &packet->player);
+
dio_get_string(&din, packet->message, sizeof(packet->message));
RECEIVE_PACKET_END(packet);
Index: common/packets.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.h,v
retrieving revision 1.156
diff -u -r1.156 packets.h
--- common/packets.h 2003/10/07 18:55:09 1.156
+++ common/packets.h 2003/10/23 18:29:38
@@ -483,7 +483,7 @@
*********************************************************/
struct packet_generic_message {
char message[MAX_LEN_MSG];
- int x,y,event;
+ int x, y, event, player;
};
Index: server/autoattack.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/autoattack.c,v
retrieving revision 1.48
diff -u -r1.48 autoattack.c
--- server/autoattack.c 2003/09/17 02:57:21 1.48
+++ server/autoattack.c 2003/10/23 18:29:38
@@ -160,7 +160,8 @@
if((unit_type(enemy)->defense_strength) >
unit_type(punit)->attack_strength*1.5) {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, unit_owner(enemy),
+ E_NOEVENT,
_("Game: Auto-Attack: %s's %s found a too "
"tough enemy (%s)"),
pcity->name, unit_name(punit->type),
@@ -189,7 +190,7 @@
freelog(LOG_DEBUG, "launching attack");
- notify_player_ex(pplayer, enemy->x, enemy->y, E_NOEVENT,
+ notify_player_ex(pplayer, enemy->x, enemy->y, unit_owner(enemy), E_NOEVENT,
_("Game: Auto-Attack: %s's %s attacking %s's %s"),
pcity->name, unit_name(punit->type),
unit_owner(enemy)->name, unit_name(enemy->type));
Index: server/barbarian.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/barbarian.c,v
retrieving revision 1.70
diff -u -r1.70 barbarian.c
--- server/barbarian.c 2003/10/08 16:56:07 1.70
+++ server/barbarian.c 2003/10/23 18:29:38
@@ -418,11 +418,11 @@
/* There should probably be a different message about Sea Raiders */
if (is_land_barbarian(barbarians)) {
- notify_player_ex(victim, xu, yu, E_UPRISING,
+ notify_player_ex(victim, xu, yu, NULL, E_UPRISING,
_("Native unrest near %s led by %s."), pc->name,
barbarians->name);
} else if (map_is_known_and_seen(xu, yu, victim)) {
- notify_player_ex(victim, xu, yu, E_UPRISING,
+ notify_player_ex(victim, xu, yu, NULL, E_UPRISING,
_("Sea raiders seen near %s!"), pc->name);
}
}
Index: server/cityhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityhand.c,v
retrieving revision 1.124
diff -u -r1.124 cityhand.c
--- server/cityhand.c 2003/10/13 01:33:31 1.124
+++ server/cityhand.c 2003/10/23 18:29:38
@@ -140,7 +140,7 @@
city_refresh(pcity);
sync_cities();
} else {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_NOEVENT,
_("Game: You don't have a worker here."));
}
sanity_check_city(pcity);
@@ -194,7 +194,7 @@
void really_handle_city_sell(struct player *pplayer, struct city *pcity, int
id)
{
if (pcity->did_sell) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_NOEVENT,
_("Game: You have already sold something here this turn."));
return;
}
@@ -203,7 +203,7 @@
return;
pcity->did_sell=TRUE;
- notify_player_ex(pplayer, pcity->x, pcity->y, E_IMP_SOLD,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_IMP_SOLD,
_("Game: You sell %s in %s for %d gold."),
get_improvement_name(id), pcity->name,
improvement_value(id));
@@ -240,26 +240,26 @@
assert(pcity && player_owns_city(pplayer, pcity));
if (pcity->turn_founded == game.turn) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_NOEVENT,
_("Game: Cannot buy in city created this turn."));
return;
}
if (pcity->did_buy) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_NOEVENT,
_("Game: You have already bought this turn."));
return;
}
if (!pcity->is_building_unit && pcity->currently_building==B_CAPITAL) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_NOEVENT,
_("Game: You don't buy %s!"),
improvement_types[B_CAPITAL].name);
return;
}
if (pcity->is_building_unit && pcity->anarchy != 0) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_NOEVENT,
_("Game: Can't buy units when city is in disorder."));
return;
}
@@ -295,7 +295,7 @@
city_refresh(pcity);
conn_list_do_buffer(&pplayer->connections);
- notify_player_ex(pplayer, pcity->x, pcity->y,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL,
pcity->is_building_unit?E_UNIT_BUY:E_IMP_BUY,
_("Game: %s bought in %s for %d gold."),
name, pcity->name, cost);
@@ -370,7 +370,7 @@
if (!preq->is_build_id_unit_id && !can_build_improvement(pcity,
preq->build_id))
return;
if (pcity->did_buy && pcity->shield_stock > 0) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_NOEVENT,
_("Game: You have bought this turn, can't change."));
return;
}
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.237
diff -u -r1.237 citytools.c
--- server/citytools.c 2003/10/13 01:33:31 1.237
+++ server/citytools.c 2003/10/23 18:29:38
@@ -220,7 +220,7 @@
if (game.allowed_city_names == 1 &&
city_list_find_name(&pplayer->cities, city_name)) {
if (notify_player) {
- notify_player_ex(pplayer, x, y, E_NOEVENT,
+ notify_player_ex(pplayer, x, y, NULL, E_NOEVENT,
_("Game: You already have a city called %s"),
city_name);
}
@@ -243,7 +243,7 @@
if (pother != NULL) {
if (notify_player) {
- notify_player_ex(pplayer, x, y, E_NOEVENT,
+ notify_player_ex(pplayer, x, y, pother, E_NOEVENT,
_("Game: Can't use %s as a city name. "
"It is reserved for %s."),
city_name, get_nation_name_plural(pother->nation));
@@ -256,7 +256,7 @@
if ((game.allowed_city_names == 2 ||
game.allowed_city_names == 3) && game_find_city_by_name(city_name)) {
if (notify_player) {
- notify_player_ex(pplayer, x, y, E_NOEVENT,
+ notify_player_ex(pplayer, x, y, NULL, E_NOEVENT,
_("Game: A city called %s already exists."),
city_name);
}
@@ -671,7 +671,7 @@
unit_owner(vunit)->name, unit_name(vunit->type),
vunit->x, vunit->y, pcity->name);
if (verbose) {
- notify_player_ex(unit_owner(vunit), vunit->x, vunit->y,
+ notify_player_ex(unit_owner(vunit), vunit->x, vunit->y, pplayer,
E_UNIT_LOST,
_("Game: %s lost along with control of %s."),
unit_name(vunit->type), pcity->name);
@@ -849,7 +849,7 @@
&& city_list_find_name(&ptaker->cities, pcity->name)) {
sz_strlcpy(pcity->name,
city_name_suggestion(ptaker, pcity->x, pcity->y));
- notify_player_ex(ptaker, pcity->x, pcity->y, E_NOEVENT,
+ notify_player_ex(ptaker, pcity->x, pcity->y, NULL, E_NOEVENT,
_("You already had a city called %s."
" The city was renamed to %s."), old_city_name,
pcity->name);
@@ -1048,7 +1048,7 @@
send_city_info(NULL, pcity);
sync_cities(); /* Will also send pcity. */
- notify_player_ex(pplayer, x, y, E_CITY_BUILD,
+ notify_player_ex(pplayer, x, y, NULL, E_CITY_BUILD,
_("Game: You have founded %s"), pcity->name);
maybe_make_contact(x, y, city_owner(pcity));
@@ -1133,7 +1133,7 @@
if (could_unit_move_to_tile(punit, x1, y1) == 1) {
moved = handle_unit_move_request(punit, x1, y1, FALSE, TRUE);
if (moved) {
- notify_player_ex(unit_owner(punit), -1, -1, E_NOEVENT,
+ notify_player_ex(unit_owner(punit), -1, -1, NULL, E_NOEVENT,
_("Game: Moved %s out of disbanded city %s "
"to avoid being landlocked."),
unit_type(punit)->name, pcity->name);
@@ -1144,7 +1144,7 @@
} adjc_iterate_end;
OUT:
if (!moved) {
- notify_player_ex(unit_owner(punit), -1, -1, E_NOEVENT,
+ notify_player_ex(unit_owner(punit), -1, -1, NULL, E_NOEVENT,
_("Game: When %s was disbanded your %s could not "
"get out, and it was therefore stranded."),
pcity->name, unit_type(punit)->name);
@@ -1249,9 +1249,9 @@
* the city will be destroyed.
*/
if (pcity->size <= 1) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer, E_NOEVENT,
_("Game: You destroy %s completely."), pcity->name);
- notify_player_ex(cplayer, pcity->x, pcity->y, E_CITY_LOST,
+ notify_player_ex(cplayer, pcity->x, pcity->y, pplayer, E_CITY_LOST,
_("Game: %s has been destroyed by %s."),
pcity->name, pplayer->name);
gamelog(GAMELOG_LOSEC, _("%s (%s) (%i,%i) destroyed by %s"), pcity->name,
@@ -1272,11 +1272,11 @@
cplayer->economic.gold -= coins;
send_player_info(cplayer, cplayer);
if (pcity->original != pplayer->player_no) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer, E_NOEVENT,
_("Game: You conquer %s, your lootings accumulate"
" to %d gold!"),
pcity->name, coins);
- notify_player_ex(cplayer, pcity->x, pcity->y, E_CITY_LOST,
+ notify_player_ex(cplayer, pcity->x, pcity->y, pplayer, E_CITY_LOST,
_("Game: %s conquered %s and looted %d gold"
" from the city."),
pplayer->name, pcity->name, coins);
@@ -1284,12 +1284,12 @@
get_nation_name(city_owner(pcity)->nation), pcity->x, pcity->y,
get_nation_name_plural(pplayer->nation));
} else {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer, E_NOEVENT,
_("Game: You have liberated %s!"
" Lootings accumulate to %d gold."),
pcity->name, coins);
- notify_player_ex(cplayer, pcity->x, pcity->y, E_CITY_LOST,
+ notify_player_ex(cplayer, pcity->x, pcity->y, pplayer, E_CITY_LOST,
_("Game: %s liberated %s and looted %d gold"
" from the city."),
pplayer->name, pcity->name, coins);
@@ -1837,7 +1837,7 @@
because the worklist advances, then the wonder was completed --
don't announce that the player has *stopped* building that wonder.
*/
- notify_player_ex(NULL, pcity->x, pcity->y, E_WONDER_STOPPED,
+ notify_player_ex(NULL, pcity->x, pcity->y, pplayer, E_WONDER_STOPPED,
_("Game: The %s have stopped building The %s in %s."),
get_nation_name_plural(pplayer->nation),
get_impr_name_ex(pcity, pcity->currently_building),
@@ -1868,18 +1868,18 @@
/* Tell the player what's up. */
if (event != 0)
- notify_player_ex(pplayer, pcity->x, pcity->y, event,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, event,
_("Game: %s is building %s%s."),
pcity->name, name, source);
else
- notify_player_ex(pplayer, pcity->x, pcity->y, E_UNIT_BUILD,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_UNIT_BUILD,
_("Game: %s is building %s."),
pcity->name, name);
/* If the city is building a wonder, tell the rest of the world
about it. */
if (!pcity->is_building_unit && is_wonder(pcity->currently_building)) {
- notify_player_ex(NULL, pcity->x, pcity->y, E_WONDER_STARTED,
+ notify_player_ex(NULL, pcity->x, pcity->y, pplayer, E_WONDER_STARTED,
_("Game: The %s have started building The %s in %s."),
get_nation_name_plural(pplayer->nation),
get_impr_name_ex(pcity, pcity->currently_building),
@@ -2131,7 +2131,7 @@
if (is_ocean(improvement_types[impr].terr_gate[i])
&& !city_has_terr_spec_gate(pcity, impr)) {
do_sell_building(pplayer, pcity, impr);
- notify_player_ex(pplayer, x1, y1, E_IMP_SOLD,
+ notify_player_ex(pplayer, x1, y1, NULL, E_IMP_SOLD,
_("Game: You sell %s in %s (now landlocked)"
" for %d gold."),
get_improvement_name(impr), pcity->name,
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.230
diff -u -r1.230 cityturn.c
--- server/cityturn.c 2003/10/13 07:10:15 1.230
+++ server/cityturn.c 2003/10/23 18:29:39
@@ -117,7 +117,7 @@
built_impr_iterate(pcity, i) {
if (!is_wonder(i) && improvement_obsolete(pplayer, i)) {
do_sell_building(pplayer, pcity, i);
- notify_player_ex(pplayer, pcity->x, pcity->y, E_IMP_SOLD,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_IMP_SOLD,
_("Game: %s is selling %s (obsolete) for %d."),
pcity->name, get_improvement_name(i),
improvement_value(i));
@@ -262,7 +262,7 @@
&& (city_turns_to_build(pcity, pcity->currently_building, FALSE, TRUE)
<= 1)
&& can_player_build_improvement(city_owner(pcity),
pcity->currently_building)) {
- notify_conn_ex(dest, pcity->x, pcity->y,
+ notify_conn_ex(dest, pcity->x, pcity->y, city_owner(pcity),
E_WONDER_WILL_BE_BUILT,
_("Game: Notice: Wonder %s in %s will be finished"
" next turn."),
@@ -294,7 +294,7 @@
preserves food. -AJS */
if ((turns_growth < 5) && (turns_granary < 5) &&
(turns_growth < turns_granary)) {
- notify_conn_ex(dest, pcity->x, pcity->y,
+ notify_conn_ex(dest, pcity->x, pcity->y, NULL,
E_CITY_GRAN_THROTTLE,
_("Game: Suggest throttling growth in %s to use %s "
"(being built) more effectively."), pcity->name,
@@ -308,14 +308,14 @@
|| pcity->size < game.sewer_size);
if ((turns_growth <= 0) && !city_celebrating(pcity) && can_grow) {
- notify_conn_ex(dest, pcity->x, pcity->y,
+ notify_conn_ex(dest, pcity->x, pcity->y, NULL,
E_CITY_MAY_SOON_GROW,
_("Game: %s may soon grow to size %i."),
pcity->name, pcity->size + 1);
}
} else {
if (pcity->food_stock + pcity->food_surplus <= 0 && pcity->food_surplus <
0) {
- notify_conn_ex(dest, pcity->x, pcity->y,
+ notify_conn_ex(dest, pcity->x, pcity->y, NULL,
E_CITY_FAMINE_FEARED,
_("Game: Warning: Famine feared in %s."),
pcity->name);
@@ -349,7 +349,7 @@
/* This test include the cost of the units because pay_for_units is called
* in update_city_activity */
if (gold - (gold - pplayer->economic.gold) * 3 < 0) {
- notify_player_ex(pplayer, -1, -1, E_LOW_ON_FUNDS,
+ notify_player_ex(pplayer, -1, -1, NULL, E_LOW_ON_FUNDS,
_("Game: WARNING, we're LOW on FUNDS sire."));
}
/* uncomment to unbalance the game, like in civ1 (CLG)
@@ -429,12 +429,12 @@
if (!city_got_building(pcity, B_AQUEDUCT)
&& pcity->size>=game.aqueduct_size) {/* need aqueduct */
if (!pcity->is_building_unit && pcity->currently_building == B_AQUEDUCT) {
- notify_player_ex(powner, pcity->x, pcity->y, E_CITY_AQ_BUILDING,
+ notify_player_ex(powner, pcity->x, pcity->y, NULL, E_CITY_AQ_BUILDING,
_("Game: %s needs %s (being built) "
"to grow any further."), pcity->name,
improvement_types[B_AQUEDUCT].name);
} else {
- notify_player_ex(powner, pcity->x, pcity->y, E_CITY_AQUEDUCT,
+ notify_player_ex(powner, pcity->x, pcity->y, NULL, E_CITY_AQUEDUCT,
_("Game: %s needs %s to grow any further."),
pcity->name, improvement_types[B_AQUEDUCT].name);
}
@@ -448,12 +448,12 @@
if (!city_got_building(pcity, B_SEWER)
&& pcity->size>=game.sewer_size) {/* need sewer */
if (!pcity->is_building_unit && pcity->currently_building == B_SEWER) {
- notify_player_ex(powner, pcity->x, pcity->y, E_CITY_AQ_BUILDING,
+ notify_player_ex(powner, pcity->x, pcity->y, NULL, E_CITY_AQ_BUILDING,
_("Game: %s needs %s (being built) "
"to grow any further."), pcity->name,
improvement_types[B_SEWER].name);
} else {
- notify_player_ex(powner, pcity->x, pcity->y, E_CITY_AQUEDUCT,
+ notify_player_ex(powner, pcity->x, pcity->y, NULL, E_CITY_AQUEDUCT,
_("Game: %s needs %s to grow any further."),
pcity->name, improvement_types[B_SEWER].name);
}
@@ -502,7 +502,7 @@
city_refresh(pcity);
- notify_player_ex(powner, pcity->x, pcity->y, E_CITY_GROWTH,
+ notify_player_ex(powner, pcity->x, pcity->y, NULL, E_CITY_GROWTH,
_("Game: %s grows to size %d."), pcity->name, pcity->size);
sanity_check_city(pcity);
@@ -533,7 +533,8 @@
&& !unit_flag(punit, F_UNDISBANDABLE)) {
char *utname = unit_type(punit)->name;
wipe_unit(punit);
- notify_player_ex(city_owner(pcity), pcity->x, pcity->y, E_UNIT_LOST,
+ notify_player_ex(city_owner(pcity), pcity->x, pcity->y, NULL,
+ E_UNIT_LOST,
_("Game: Famine feared in %s, %s lost!"),
pcity->name, utname);
gamelog(GAMELOG_UNITFS, _("%s lose %s (famine)"),
@@ -546,7 +547,8 @@
}
}
unit_list_iterate_end;
- notify_player_ex(city_owner(pcity), pcity->x, pcity->y, E_CITY_FAMINE,
+ notify_player_ex(city_owner(pcity), pcity->x, pcity->y, NULL,
+ E_CITY_FAMINE,
_("Game: Famine causes population loss in %s."),
pcity->name);
if (city_got_effect(pcity, B_GRANARY))
@@ -632,7 +634,7 @@
/* If the city can never build this unit or its descendants, drop it. */
if (!can_eventually_build_unit(pcity, new_target)) {
/* Nope, never in a million years. */
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_CANTBUILD,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_CITY_CANTBUILD,
_("Game: %s can't build %s from the worklist. "
"Purging..."),
pcity->name,
@@ -651,7 +653,7 @@
/* Maybe we can just upgrade the target to what the city /can/ build. */
if (new_target == target) {
/* Nope, we're stuck. Dump this item from the worklist. */
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_CANTBUILD,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_CITY_CANTBUILD,
_("Game: %s can't build %s from the worklist; "
"tech not yet available. Postponing..."),
pcity->name,
@@ -659,7 +661,7 @@
continue;
} else {
/* Yep, we can go after new_target instead. Joy! */
- notify_player_ex(pplayer, pcity->x, pcity->y, E_WORKLIST,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_WORKLIST,
_("Game: Production of %s is upgraded to %s in %s."),
get_unit_type(target)->name,
get_unit_type(new_target)->name,
@@ -672,7 +674,7 @@
/* If the city can never build this improvement, drop it. */
if (!can_eventually_build_improvement(pcity, new_target)) {
/* Nope, never in a million years. */
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_CANTBUILD,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_CITY_CANTBUILD,
_("Game: %s can't build %s from the worklist. "
"Purging..."),
pcity->name,
@@ -692,13 +694,15 @@
if (new_target == target) {
/* Nope, no use. *sigh* */
if (!player_knows_improvement_tech(pplayer, target)) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_CANTBUILD,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL,
+ E_CITY_CANTBUILD,
_("Game: %s can't build %s from the worklist; "
"tech not yet available. Postponing..."),
pcity->name,
get_impr_name_ex(pcity, target));
} else if (improvement_types[target].bldg_req != B_LAST) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_CANTBUILD,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL,
+ E_CITY_CANTBUILD,
_("Game: %s can't build %s from the worklist; "
"need to have %s first. Postponing..."),
pcity->name,
@@ -707,7 +711,8 @@
} else {
/* This shouldn't happen...
FIXME: make can_build_improvement() return a reason enum. */
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_CANTBUILD,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL,
+ E_CITY_CANTBUILD,
_("Game: %s can't build %s from the worklist; "
"Reason unknown! Postponing..."),
pcity->name,
@@ -716,7 +721,7 @@
continue;
} else {
/* Hey, we can upgrade the improvement! */
- notify_player_ex(pplayer, pcity->x, pcity->y, E_WORKLIST,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_WORKLIST,
_("Game: Production of %s is upgraded to %s in %s."),
get_impr_name_ex(pcity, target),
get_impr_name_ex(pcity, new_target),
@@ -741,7 +746,7 @@
if (worklist_is_empty(&pcity->worklist)) {
/* There *was* something in the worklist, but it's empty now. Bug the
player about it. */
- notify_player_ex(pplayer, pcity->x, pcity->y, E_WORKLIST,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_WORKLIST,
_("Game: %s's worklist is now empty."),
pcity->name);
}
@@ -827,7 +832,7 @@
if (can_build_unit_direct(pcity, id2)) {
pcity->currently_building = id2;
- notify_player_ex(pplayer, pcity->x, pcity->y, E_UNIT_UPGRADED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_UNIT_UPGRADED,
_("Game: Production of %s is upgraded to %s in %s."),
get_unit_type(id)->name,
get_unit_type(id2)->name ,
@@ -851,7 +856,7 @@
&& !unit_flag(punit, F_UNDISBANDABLE)) {
struct packet_unit_request packet;
- notify_player_ex(pplayer, pcity->x, pcity->y, E_UNIT_LOST,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_UNIT_LOST,
_("Game: %s can't upkeep %s, unit disbanded."),
pcity->name, unit_type(punit)->name);
packet.unit_id = punit->id;
@@ -871,7 +876,7 @@
if (upkeep > 0 && pcity->shield_surplus < 0) {
assert(unit_flag(punit, F_UNDISBANDABLE));
- notify_player_ex(pplayer, pcity->x, pcity->y, E_UNIT_LOST,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_UNIT_LOST,
_("Game: Citizens in %s perish for their failure to "
"upkeep %s!"), pcity->name, unit_type(punit)->name);
if (!city_reduce_size(pcity, 1)) {
@@ -908,7 +913,7 @@
}
upgrade_building_prod(pcity);
if (!can_build_improvement(pcity, pcity->currently_building)) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_CANTBUILD,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_CITY_CANTBUILD,
_("Game: %s is building %s, which "
"is no longer available."),
pcity->name, get_impr_name_ex(pcity,
@@ -944,7 +949,7 @@
/* to eliminate micromanagement */
if (is_wonder(pcity->currently_building)) {
game.global_wonders[pcity->currently_building] = pcity->id;
- notify_player_ex(NULL, pcity->x, pcity->y, E_WONDER_BUILD,
+ notify_player_ex(NULL, pcity->x, pcity->y, pplayer, E_WONDER_BUILD,
_("Game: The %s have finished building %s in %s."),
get_nation_name_plural(pplayer->nation),
get_impr_name_ex(pcity, pcity->currently_building),
@@ -960,7 +965,7 @@
get_impr_name_ex(pcity, pcity->currently_building),
pcity->name);
- notify_player_ex(pplayer, pcity->x, pcity->y, E_IMP_BUILD,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_IMP_BUILD,
_("Game: %s has finished building %s."), pcity->name,
improvement_types[pcity->currently_building].name);
@@ -990,7 +995,7 @@
improvement_types[B_DARWIN].name);
}
if (space_part && pplayer->spaceship.state == SSHIP_NONE) {
- notify_player_ex(NULL, pcity->x, pcity->y, E_SPACESHIP,
+ notify_player_ex(NULL, pcity->x, pcity->y, pplayer, E_SPACESHIP,
_("Game: The %s have started "
"building a spaceship!"),
get_nation_name_plural(pplayer->nation));
@@ -1029,7 +1034,7 @@
they build!! - Per */
if (!can_build_unit_direct(pcity, pcity->currently_building)
&& !is_barbarian(pplayer)) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_CANTBUILD,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_CITY_CANTBUILD,
_("Game: %s is building %s, which is no longer available."),
pcity->name, unit_name(pcity->currently_building));
freelog(LOG_VERBOSE, _("%s's %s tried build %s, which is not available"),
@@ -1045,7 +1050,7 @@
}
if (pcity->size <= pop_cost) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_CANTBUILD,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_CITY_CANTBUILD,
_("Game: %s can't build %s yet."),
pcity->name, unit_name(pcity->currently_building));
return TRUE;
@@ -1072,7 +1077,7 @@
pcity->before_change_shields -= unit_value(pcity->currently_building);
pcity->shield_stock -= unit_value(pcity->currently_building);
- notify_player_ex(pplayer, pcity->x, pcity->y, E_UNIT_BUILD,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_UNIT_BUILD,
_("Game: %s is finished building %s."),
pcity->name,
unit_types[pcity->currently_building].name);
@@ -1120,7 +1125,7 @@
if (!is_wonder(i)
&& pplayer->government != game.government_when_anarchy) {
if (pplayer->economic.gold - improvement_upkeep(pcity, i) < 0) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_IMP_AUCTIONED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_IMP_AUCTIONED,
_("Game: Can't afford to maintain %s in %s, "
"building sold!"),
improvement_types[i].name, pcity->name);
@@ -1156,7 +1161,7 @@
&& !map_has_special(mx, my, S_POLLUTION)) {
map_set_special(mx, my, S_POLLUTION);
send_tile_info(NULL, mx, my);
- notify_player_ex(city_owner(pcity), pcity->x, pcity->y,
+ notify_player_ex(city_owner(pcity), pcity->x, pcity->y, NULL,
E_POLLUTION, _("Game: Pollution near %s."),
pcity->name);
return;
@@ -1302,7 +1307,7 @@
if (city_celebrating(pcity)) {
pcity->rapture++;
if (pcity->rapture == 1)
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_LOVE,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_CITY_LOVE,
_("Game: We Love The %s Day celebrated in %s."),
get_ruler_title(pplayer->government, pplayer->is_male,
pplayer->nation),
@@ -1310,7 +1315,7 @@
}
else {
if (pcity->rapture != 0)
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_NORMAL,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_CITY_NORMAL,
_("Game: We Love The %s Day canceled in %s."),
get_ruler_title(pplayer->government, pplayer->is_male,
pplayer->nation),
@@ -1343,16 +1348,16 @@
if(city_unhappy(pcity)) {
pcity->anarchy++;
if (pcity->anarchy == 1)
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_DISORDER,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_CITY_DISORDER,
_("Game: Civil disorder in %s."), pcity->name);
else
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_DISORDER,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_CITY_DISORDER,
_("Game: CIVIL DISORDER CONTINUES in %s."),
pcity->name);
}
else {
if (pcity->anarchy != 0)
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_NORMAL,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_CITY_NORMAL,
_("Game: Order restored in %s."), pcity->name);
pcity->anarchy=0;
}
@@ -1360,7 +1365,7 @@
send_city_info(NULL, pcity);
if (pcity->anarchy>2 && government_has_flag(g, G_REVOLUTION_WHEN_UNHAPPY))
{
- notify_player_ex(pplayer, pcity->x, pcity->y, E_ANARCHY,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_ANARCHY,
_("Game: The people have overthrown your %s, "
"your country is in turmoil."),
get_government_name(g->index));
@@ -1384,7 +1389,7 @@
if (!rcity) {
/* What should we do when we try to disband our only city? */
- notify_player_ex(pplayer, x, y, E_CITY_CANTBUILD,
+ notify_player_ex(pplayer, x, y, NULL, E_CITY_CANTBUILD,
_("Game: %s can't build %s yet, "
"and we can't disband our only city."),
pcity->name, unit_name(pcity->currently_building));
@@ -1401,7 +1406,7 @@
* transferred this is not a problem. */
transfer_city_units(pplayer, pplayer, &pcity->units_supported, rcity, pcity,
-1, TRUE);
- notify_player_ex(pplayer, x, y, E_UNIT_BUILD,
+ notify_player_ex(pplayer, x, y, NULL, E_UNIT_BUILD,
_("Game: %s is disbanded into %s."),
pcity->name, unit_types[pcity->currently_building].name);
gamelog(GAMELOG_UNIT, _("%s (%i, %i) disbanded into %s by the %s"),
Index: server/diplhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/diplhand.c,v
retrieving revision 1.73
diff -u -r1.73 diplhand.c
--- server/diplhand.c 2003/08/08 22:11:42 1.73
+++ server/diplhand.c 2003/10/23 18:29:39
@@ -351,7 +351,7 @@
get_nation_name_plural(pgiver->nation));
break;
}
- notify_player_ex(pdest, -1, -1, E_TECH_GAIN,
+ notify_player_ex(pdest, -1, -1, pgiver, E_TECH_GAIN,
_("Game: You are taught the knowledge of %s."),
get_tech_name(pdest, pclause->value));
@@ -396,11 +396,12 @@
break;
}
- notify_player_ex(pdest, pcity->x, pcity->y, E_CITY_TRANSFER,
+ notify_player_ex(pdest, pcity->x, pcity->y, pgiver,
+ E_CITY_TRANSFER,
_("Game: You receive city of %s from %s."),
pcity->name, pgiver->name);
- notify_player_ex(pgiver, pcity->x, pcity->y, E_CITY_LOST,
+ notify_player_ex(pgiver, pcity->x, pcity->y, pdest, E_CITY_LOST,
_("Game: You give city of %s to %s."),
pcity->name, pdest->name);
@@ -412,10 +413,10 @@
pgiver->diplstates[pdest->player_no].turns_left=16;
pdest->diplstates[pgiver->player_no].type=DS_CEASEFIRE;
pdest->diplstates[pgiver->player_no].turns_left=16;
- notify_player_ex(pgiver, -1, -1, E_TREATY_CEASEFIRE,
+ notify_player_ex(pgiver, -1, -1, pdest, E_TREATY_CEASEFIRE,
_("Game: You agree on a cease-fire with %s."),
pdest->name);
- notify_player_ex(pdest, -1, -1, E_TREATY_CEASEFIRE,
+ notify_player_ex(pdest, -1, -1, pgiver, E_TREATY_CEASEFIRE,
_("Game: You agree on a cease-fire with %s."),
pgiver->name);
check_city_workers(plr0);
@@ -424,10 +425,10 @@
case CLAUSE_PEACE:
pgiver->diplstates[pdest->player_no].type=DS_PEACE;
pdest->diplstates[pgiver->player_no].type=DS_PEACE;
- notify_player_ex(pgiver, -1, -1, E_TREATY_PEACE,
+ notify_player_ex(pgiver, -1, -1, pdest, E_TREATY_PEACE,
_("Game: You agree on a peace treaty with %s."),
pdest->name);
- notify_player_ex(pdest, -1, -1, E_TREATY_PEACE,
+ notify_player_ex(pdest, -1, -1, pgiver, E_TREATY_PEACE,
_("Game: You agree on a peace treaty with %s."),
pgiver->name);
check_city_workers(plr0);
@@ -436,10 +437,10 @@
case CLAUSE_ALLIANCE:
pgiver->diplstates[pdest->player_no].type=DS_ALLIANCE;
pdest->diplstates[pgiver->player_no].type=DS_ALLIANCE;
- notify_player_ex(pgiver, -1, -1, E_TREATY_ALLIANCE,
+ notify_player_ex(pgiver, -1, -1, pdest, E_TREATY_ALLIANCE,
_("Game: You agree on an alliance with %s."),
pdest->name);
- notify_player_ex(pdest, -1, -1, E_TREATY_ALLIANCE,
+ notify_player_ex(pdest, -1, -1, pgiver, E_TREATY_ALLIANCE,
_("Game: You agree on an alliance with %s."),
pgiver->name);
check_city_workers(plr0);
@@ -447,10 +448,10 @@
break;
case CLAUSE_VISION:
give_shared_vision(pgiver, pdest);
- notify_player_ex(pgiver, -1, -1, E_TREATY_SHARED_VISION,
+ notify_player_ex(pgiver, -1, -1, pdest, E_TREATY_SHARED_VISION,
_("Game: You give shared vision to %s."),
pdest->name);
- notify_player_ex(pdest, -1, -1, E_TREATY_SHARED_VISION,
+ notify_player_ex(pdest, -1, -1, pgiver, E_TREATY_SHARED_VISION,
_("Game: %s gives you shared vision."),
pgiver->name);
break;
Index: server/diplomats.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/diplomats.c,v
retrieving revision 1.43
diff -u -r1.43 diplomats.c
--- server/diplomats.c 2003/10/08 16:56:07 1.43
+++ server/diplomats.c 2003/10/23 18:29:39
@@ -85,7 +85,8 @@
/* If city is too small, can't poison. */
if (pcity->size < 2) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer,
+ pcity->x, pcity->y, cplayer, E_MY_DIPLOMAT_FAILED,
_("Game: Your %s could not poison the water"
" supply in %s."),
unit_name(pdiplomat->type), pcity->name);
@@ -99,10 +100,12 @@
city_reduce_size(pcity, 1);
/* Notify everybody involved. */
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_POISON,
+ notify_player_ex(pplayer,
+ pcity->x, pcity->y, cplayer, E_MY_DIPLOMAT_POISON,
_("Game: Your %s poisoned the water supply of %s."),
unit_name(pdiplomat->type), pcity->name);
- notify_player_ex(cplayer, pcity->x, pcity->y, E_ENEMY_DIPLOMAT_POISON,
+ notify_player_ex(cplayer,
+ pcity->x, pcity->y, pplayer, E_ENEMY_DIPLOMAT_POISON,
_("Game: %s is suspected of poisoning the water supply"
" of %s."), pplayer->name, pcity->name);
@@ -249,13 +252,15 @@
/* Check for "foul" ambassador. */
if (pdiplomat->foul) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer,
+ pcity->x, pcity->y, cplayer, E_MY_DIPLOMAT_FAILED,
_("Game: Your %s was executed in %s on suspicion"
" of spying. The %s welcome future diplomatic"
" efforts providing the Ambassador is reputable."),
unit_name(pdiplomat->type),
pcity->name, get_nation_name_plural(cplayer->nation));
- notify_player_ex(cplayer, pcity->x, pcity->y, E_ENEMY_DIPLOMAT_FAILED,
+ notify_player_ex(cplayer,
+ pcity->x, pcity->y, pplayer, E_ENEMY_DIPLOMAT_FAILED,
_("You executed a %s the %s had sent to establish"
" an embassy in %s for being untrustworthy"),
unit_name(pdiplomat->type),
@@ -266,7 +271,8 @@
/* Check for Barbarian response. */
if (is_barbarian (cplayer)) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer,
+ pcity->x, pcity->y, NULL, E_MY_DIPLOMAT_FAILED,
_("Game: Your %s was executed in %s by primitive %s."),
unit_name(pdiplomat->type),
pcity->name, get_nation_name_plural(cplayer->nation));
@@ -279,10 +285,12 @@
establish_embassy(pplayer, cplayer);
/* Notify everybody involved. */
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_EMBASSY,
+ notify_player_ex(pplayer,
+ pcity->x, pcity->y, cplayer, E_MY_DIPLOMAT_EMBASSY,
_("Game: You have established an embassy in %s."),
pcity->name);
- notify_player_ex(cplayer, pcity->x, pcity->y, E_ENEMY_DIPLOMAT_EMBASSY,
+ notify_player_ex(cplayer,
+ pcity->x, pcity->y, pplayer, E_ENEMY_DIPLOMAT_EMBASSY,
_("Game: The %s have established an embassy in %s."),
get_nation_name_plural(pplayer->nation), pcity->name);
gamelog(GAMELOG_EMBASSY, _("%s establish an embassy in %s (%s) (%i,%i)"),
@@ -340,7 +348,8 @@
/* If unit has too few hp, can't sabotage. */
if (pvictim->hp < 2) {
- notify_player_ex(pplayer, pvictim->x, pvictim->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer,
+ pvictim->x, pvictim->y, uplayer, E_MY_DIPLOMAT_FAILED,
_("Game: Your %s could not sabotage %s's %s."),
unit_name(pdiplomat->type),
unit_owner(pvictim)->name, unit_name(pvictim->type));
@@ -355,11 +364,12 @@
send_unit_info(NULL, pvictim);
/* Notify everybody involved. */
- notify_player_ex(pplayer, pvictim->x, pvictim->y, E_MY_DIPLOMAT_SABOTAGE,
+ notify_player_ex(pplayer,
+ pvictim->x, pvictim->y, uplayer, E_MY_DIPLOMAT_SABOTAGE,
_("Game: Your %s succeeded in sabotaging %s's %s."),
unit_name(pdiplomat->type),
unit_owner(pvictim)->name, unit_name(pvictim->type));
- notify_player_ex(uplayer, pvictim->x, pvictim->y,
+ notify_player_ex(uplayer, pvictim->x, pvictim->y, pplayer,
E_ENEMY_DIPLOMAT_SABOTAGE,
_("Game: Your %s was sabotaged by %s!"),
unit_name(pvictim->type), pplayer->name);
@@ -412,7 +422,7 @@
/* Check for unit from a bribable government. */
if (government_has_flag(get_gov_pplayer(unit_owner(pvictim)),
G_UNBRIBABLE)) {
- notify_player_ex(pplayer, pdiplomat->x, pdiplomat->y,
+ notify_player_ex(pplayer, pdiplomat->x, pdiplomat->y, uplayer,
E_MY_DIPLOMAT_FAILED,
_("Game: You can't bribe a unit from this nation."));
freelog (LOG_DEBUG, "bribe-unit: unit's government is unbribable");
@@ -421,7 +431,7 @@
/* If player doesn't have enough gold, can't bribe. */
if (pplayer->economic.gold < pvictim->bribe_cost) {
- notify_player_ex(pplayer, pdiplomat->x, pdiplomat->y,
+ notify_player_ex(pplayer, pdiplomat->x, pdiplomat->y, uplayer,
E_MY_DIPLOMAT_FAILED,
_("Game: You don't have enough gold to"
" bribe %s's %s."),
@@ -431,7 +441,8 @@
}
if (unit_flag(pvictim, F_UNBRIBABLE)) {
- notify_player_ex(pplayer, pdiplomat->x, pdiplomat->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, pdiplomat->x, pdiplomat->y, uplayer,
+ E_MY_DIPLOMAT_FAILED,
_("Game: You cannot bribe %s!"), unit_name(pvictim->type));
return;
}
@@ -445,11 +456,13 @@
pvictim->hp);
/* Notify everybody involved. */
- notify_player_ex(pplayer, pvictim->x, pvictim->y, E_MY_DIPLOMAT_BRIBE,
+ notify_player_ex(pplayer, pvictim->x, pvictim->y, uplayer,
+ E_MY_DIPLOMAT_BRIBE,
_("Game: Your %s succeeded in bribing %s's %s."),
unit_name(pdiplomat->type),
unit_owner(pvictim)->name, unit_name(pvictim->type));
- notify_player_ex(uplayer, pvictim->x, pvictim->y, E_ENEMY_DIPLOMAT_BRIBE,
+ notify_player_ex(uplayer, pvictim->x, pvictim->y, pplayer,
+ E_ENEMY_DIPLOMAT_BRIBE,
_("Game: Your %s was bribed by %s."),
unit_name(pvictim->type), pplayer->name);
@@ -545,11 +558,13 @@
}
}
if (count > 0) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_FAILED,
_("Game: Your %s was caught in the attempt of"
" stealing technology from %s."),
unit_name(pdiplomat->type), pcity->name);
- notify_player_ex(cplayer, pcity->x, pcity->y, E_ENEMY_DIPLOMAT_FAILED,
+ notify_player_ex(cplayer, pcity->x, pcity->y, pplayer,
+ E_ENEMY_DIPLOMAT_FAILED,
_("Game: %s's %s failed to steal technology from %s."),
pplayer->name, unit_name(pdiplomat->type), pcity->name);
wipe_unit (pdiplomat);
@@ -580,7 +595,8 @@
target = -1;
freelog (LOG_DEBUG, "steal-tech: targeted future-tech: %d", target);
} else {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_FAILED,
_("Game: No new technology found in %s."),
pcity->name);
diplomat_charge_movement (pdiplomat, pcity->x, pcity->y);
@@ -617,7 +633,8 @@
freelog (LOG_DEBUG, "steal-tech: specified target technology: %d (%s)",
target, advances[target].name);
} else {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_FAILED,
_("Game: Your %s could not find the %s technology"
" to steal in %s."),
unit_name(pdiplomat->type),
@@ -638,11 +655,13 @@
found_new_future_tech(pplayer);
/* Report it. */
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_THEFT,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_THEFT,
_("Game: Your %s stole Future Tech. %d from %s."),
unit_name(pdiplomat->type),
pplayer->future_tech, cplayer->name);
- notify_player_ex(cplayer, pcity->x, pcity->y, E_ENEMY_DIPLOMAT_THEFT,
+ notify_player_ex(cplayer, pcity->x, pcity->y, pplayer,
+ E_ENEMY_DIPLOMAT_THEFT,
_("Game: Future Tech. %d stolen by %s %s from %s."),
pplayer->future_tech, get_nation_name(pplayer->nation),
unit_name(pdiplomat->type), pcity->name);
@@ -658,11 +677,13 @@
do_conquer_cost (pplayer);
found_new_tech (pplayer, target, FALSE, TRUE);
/* Report it. */
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_THEFT,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_THEFT,
_("Game: Your %s stole %s from %s."),
unit_name(pdiplomat->type),
advances[target].name, cplayer->name);
- notify_player_ex(cplayer, pcity->x, pcity->y, E_ENEMY_DIPLOMAT_THEFT,
+ notify_player_ex(cplayer, pcity->x, pcity->y, pplayer,
+ E_ENEMY_DIPLOMAT_THEFT,
_("Game: %s's %s stole %s from %s."),
pplayer->name, unit_name(pdiplomat->type),
advances[target].name, pcity->name);
@@ -727,7 +748,8 @@
/* Check for city from a bribable government. */
if (government_has_flag (get_gov_pcity (pcity), G_UNBRIBABLE)) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_FAILED,
_("Game: You can't subvert a city from this nation."));
freelog (LOG_DEBUG, "incite: city's government is unbribable");
return;
@@ -736,7 +758,8 @@
/* Check for city being the capital. */
capital = find_palace (city_owner (pcity));
if (pcity == capital) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_FAILED,
_("Game: You can't subvert the capital of a nation."));
freelog (LOG_DEBUG, "incite: city is the capital");
return;
@@ -747,7 +770,8 @@
/* If player doesn't have enough gold, can't incite a revolt. */
if (pplayer->economic.gold < revolt_cost) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_FAILED,
_("Game: You don't have enough gold to"
" subvert %s."), pcity->name);
freelog (LOG_DEBUG, "incite: not enough gold");
@@ -762,11 +786,13 @@
/* Check if the Diplomat/Spy succeeds with his/her task. */
if (myrand (100) >= game.diplchance) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_FAILED,
_("Game: Your %s was caught in the attempt"
" of inciting a revolt!"),
unit_name(pdiplomat->type));
- notify_player_ex(cplayer, pcity->x, pcity->y, E_ENEMY_DIPLOMAT_FAILED,
+ notify_player_ex(cplayer, pcity->x, pcity->y, pplayer,
+ E_ENEMY_DIPLOMAT_FAILED,
_("Game: You caught %s %s attempting"
" to incite a revolt in %s!"),
get_nation_name(pplayer->nation),
@@ -788,10 +814,12 @@
pplayer->economic.gold -= revolt_cost;
/* Notify everybody involved. */
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_INCITE,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_INCITE,
_("Game: Revolt incited in %s, you now rule the city!"),
pcity->name);
- notify_player_ex(cplayer, pcity->x, pcity->y, E_ENEMY_DIPLOMAT_INCITE,
+ notify_player_ex(cplayer, pcity->x, pcity->y, pplayer,
+ E_ENEMY_DIPLOMAT_INCITE,
_("Game: %s has revolted, %s influence suspected."),
pcity->name, get_nation_name(pplayer->nation));
@@ -869,11 +897,13 @@
/* (Twice as difficult if target is specified.) */
if ((myrand (100) >= game.diplchance) ||
((improvement != B_LAST) && (myrand (100) >= game.diplchance))) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_FAILED,
_("Game: Your %s was caught in the attempt"
" of industrial sabotage!"),
unit_name(pdiplomat->type));
- notify_player_ex(cplayer, pcity->x, pcity->y, E_ENEMY_DIPLOMAT_SABOTAGE,
+ notify_player_ex(cplayer, pcity->x, pcity->y, pplayer,
+ E_ENEMY_DIPLOMAT_SABOTAGE,
_("Game: You caught %s %s attempting"
" sabotage in %s!"),
get_nation_name(pplayer->nation),
@@ -907,7 +937,8 @@
* If nothing to do, say so, deduct movement cost and return.
*/
if (count == 0 && pcity->shield_stock == 0) {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_FAILED,
_("Game: Your %s could not find anything to"
" sabotage in %s."), unit_name(pdiplomat->type),
pcity->name);
@@ -949,7 +980,8 @@
freelog (LOG_DEBUG, "sabotage: specified target improvement: %d (%s)",
target, get_improvement_name (target));
} else {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_FAILED,
_("Game: You cannot sabotage a wonder or a %s!"),
improvement_types[B_PALACE].name);
diplomat_charge_movement (pdiplomat, pcity->x, pcity->y);
@@ -959,7 +991,8 @@
return;
}
} else {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_FAILED,
_("Game: Your %s could not find the %s to"
" sabotage in %s."), unit_name(pdiplomat->type),
get_improvement_name(improvement), pcity->name);
@@ -984,11 +1017,13 @@
prod = unit_name (pcity->currently_building);
else
prod = get_improvement_name (pcity->currently_building);
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_SABOTAGE,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_SABOTAGE,
_("Game: Your %s succeeded in destroying"
" the production of %s in %s."),
unit_name(pdiplomat->type), prod, pcity->name);
- notify_player_ex(cplayer, pcity->x, pcity->y, E_ENEMY_DIPLOMAT_SABOTAGE,
+ notify_player_ex(cplayer, pcity->x, pcity->y, pplayer,
+ E_ENEMY_DIPLOMAT_SABOTAGE,
_("Game: The production of %s was destroyed in %s,"
" %s are suspected."), prod, pcity->name,
get_nation_name_plural(pplayer->nation));
@@ -1005,10 +1040,11 @@
if ((pcity == capital) || (improvement == B_CITY)) {
if (myrand (2) == 1) {
/* Caught! */
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_FAILED,
_("Game: Your %s was caught in the attempt"
" of sabotage!"), unit_name(pdiplomat->type));
- notify_player_ex(cplayer, pcity->x, pcity->y,
+ notify_player_ex(cplayer, pcity->x, pcity->y, pplayer,
E_ENEMY_DIPLOMAT_FAILED,
_("Game: You caught %s %s attempting"
" to sabotage the %s in %s!"),
@@ -1022,11 +1058,13 @@
}
/* Report it. */
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_SABOTAGE,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_SABOTAGE,
_("Game: Your %s destroyed the %s in %s."),
unit_name(pdiplomat->type),
get_improvement_name(target), pcity->name);
- notify_player_ex(cplayer, pcity->x, pcity->y, E_ENEMY_DIPLOMAT_SABOTAGE,
+ notify_player_ex(cplayer, pcity->x, pcity->y, pplayer,
+ E_ENEMY_DIPLOMAT_SABOTAGE,
_("Game: The %s destroyed the %s in %s."),
get_nation_name_plural(pplayer->nation),
get_improvement_name(target), pcity->name);
@@ -1118,11 +1156,13 @@
if (diplomat_success_vs_defender(punit) && !unit_flag(punit,
F_SUPERSPY)) {
/* Defending Spy/Diplomat dies. */
- notify_player_ex(cplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(cplayer, pcity->x, pcity->y, pplayer,
+ E_MY_DIPLOMAT_FAILED,
_("Game: Your %s has been eliminated defending"
" against a %s in %s."), unit_name(punit->type),
unit_name(pdiplomat->type), pcity->name);
- notify_player_ex(pplayer, pcity->x, pcity->y, E_ENEMY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_ENEMY_DIPLOMAT_FAILED,
_("Game: An enemy %s has been eliminated defending"
" %s."), unit_name(punit->type), pcity->name);
@@ -1132,12 +1172,13 @@
} else {
/* Attacking Spy/Diplomat dies. */
- notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer,
+ E_MY_DIPLOMAT_FAILED,
_("Game: Your %s was eliminated"
" by a defending %s in %s."),
unit_name(pdiplomat->type), unit_name(punit->type),
pcity->name);
- notify_player_ex(cplayer, pcity->x, pcity->y,
+ notify_player_ex(cplayer, pcity->x, pcity->y, pplayer,
E_ENEMY_DIPLOMAT_FAILED,
_("Game: Eliminated %s %s while infiltrating %s."),
get_nation_name(pplayer->nation),
@@ -1165,6 +1206,7 @@
struct city *pcity)
{
int x, y;
+ struct player *ptarget = (pcity ? city_owner(pcity) : NULL);
if (unit_flag (pdiplomat, F_SPY)) {
if (pcity) {
@@ -1192,7 +1234,8 @@
return;
}
- notify_player_ex(pplayer, x, y, E_MY_DIPLOMAT_ESCAPE,
+ notify_player_ex(pplayer, x, y, ptarget,
+ E_MY_DIPLOMAT_ESCAPE,
_("Game: Your %s has successfully completed"
" her mission and returned unharmed to %s."),
unit_name(pdiplomat->type), spyhome->name);
@@ -1212,12 +1255,14 @@
/* Attacking Spy/Diplomat dies. */
if (pcity) {
- notify_player_ex(pplayer, x, y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, x, y, ptarget,
+ E_MY_DIPLOMAT_FAILED,
_("Game: Your %s was captured after completing"
" her mission in %s."),
unit_name(pdiplomat->type), pcity->name);
} else {
- notify_player_ex(pplayer, x, y, E_MY_DIPLOMAT_FAILED,
+ notify_player_ex(pplayer, x, y, ptarget,
+ E_MY_DIPLOMAT_FAILED,
_("Game: Your %s was captured after completing"
" her mission."), unit_name(pdiplomat->type));
}
@@ -1256,32 +1301,38 @@
int punishment = 0;
switch (action) {
case DIPLOMAT_BRIBE:
- notify_player_ex(offender, x, y, E_DIPLOMATIC_INCIDENT,
+ notify_player_ex(offender, x, y, victim_player,
+ E_DIPLOMATIC_INCIDENT,
_("Game: You have caused an incident while bribing "
"%s's %s."),
victim_player->name,
unit_name(victim_unit->type));
- notify_player_ex(victim_player, x, y, E_DIPLOMATIC_INCIDENT,
+ notify_player_ex(victim_player, x, y, offender,
+ E_DIPLOMATIC_INCIDENT,
_("Game: %s has caused an incident while bribing "
"your %s."),
offender->name,
unit_name(victim_unit->type));
break;
case DIPLOMAT_STEAL:
- notify_player_ex(offender, x, y, E_DIPLOMATIC_INCIDENT,
+ notify_player_ex(offender, x, y, victim_player,
+ E_DIPLOMATIC_INCIDENT,
_("Game: You have caused an incident while stealing "
"tech from %s."),
victim_player->name);
- notify_player_ex(victim_player, x, y, E_DIPLOMATIC_INCIDENT,
+ notify_player_ex(victim_player, x, y, offender,
+ E_DIPLOMATIC_INCIDENT,
_("Game: %s has caused an incident while stealing "
"tech from you."),
offender->name);
break;
case DIPLOMAT_INCITE:
- notify_player_ex(offender, x, y, E_DIPLOMATIC_INCIDENT,
+ notify_player_ex(offender, x, y, victim_player,
+ E_DIPLOMATIC_INCIDENT,
_("Game: You have caused an incident while inciting a "
"revolt in %s."), victim_city->name);
- notify_player_ex(victim_player, x, y, E_DIPLOMATIC_INCIDENT,
+ notify_player_ex(victim_player, x, y, offender,
+ E_DIPLOMATIC_INCIDENT,
_("Game: %s have caused an incident while inciting a "
"revolt in %s."), offender->name, victim_city->name);
break;
Index: server/gamehand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamehand.c,v
retrieving revision 1.128
diff -u -r1.128 gamehand.c
--- server/gamehand.c 2003/10/01 01:39:47 1.128
+++ server/gamehand.c 2003/10/23 18:29:39
@@ -230,7 +230,8 @@
lsend_packet_new_year(&game.game_connections, &apacket);
/* Hmm, clients could add this themselves based on above packet? */
- notify_conn_ex(&game.game_connections, -1, -1, E_NEXT_YEAR, _("Year: %s"),
+ notify_conn_ex(&game.game_connections, -1, -1, NULL, E_NEXT_YEAR,
+ _("Year: %s"),
textyear(year));
}
@@ -332,7 +333,7 @@
game.timeoutint += game.timeoutintinc;
if (game.timeout > GAME_MAX_TIMEOUT) {
- notify_conn_ex(&game.game_connections, -1, -1, E_NOEVENT,
+ notify_conn_ex(&game.game_connections, -1, -1, NULL, E_NOEVENT,
_("The turn timeout has exceeded its maximum value, "
"fixing at its maximum"));
freelog(LOG_DEBUG, "game.timeout exceeded maximum value");
@@ -340,7 +341,7 @@
game.timeoutint = 0;
game.timeoutinc = 0;
} else if (game.timeout < 0) {
- notify_conn_ex(&game.game_connections, -1, -1, E_NOEVENT,
+ notify_conn_ex(&game.game_connections, -1, -1, NULL, E_NOEVENT,
_("The turn timeout is smaller than zero, "
"fixing at zero."));
freelog(LOG_DEBUG, "game.timeout less than zero");
Index: server/maphand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/maphand.c,v
retrieving revision 1.128
diff -u -r1.128 maphand.c
--- server/maphand.c 2003/10/21 21:49:55 1.128
+++ server/maphand.c 2003/10/23 18:29:39
@@ -114,7 +114,7 @@
}
}
- notify_player_ex(NULL, -1, -1, E_GLOBAL_ECO,
+ notify_player_ex(NULL, -1, -1, NULL, E_GLOBAL_ECO,
_("Game: Global warming has occurred!"));
notify_player(NULL, _("Game: Coastlines have been flooded and vast "
"ranges of grassland have become deserts."));
@@ -158,7 +158,7 @@
}
}
- notify_player_ex(NULL, -1, -1, E_GLOBAL_ECO,
+ notify_player_ex(NULL, -1, -1, NULL, E_GLOBAL_ECO,
_("Game: Nuclear winter has occurred!"));
notify_player(NULL, _("Game: Wetlands have dried up and vast "
"ranges of grassland have become tundra."));
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.295
diff -u -r1.295 plrhand.c
--- server/plrhand.c 2003/10/13 06:55:22 1.295
+++ server/plrhand.c 2003/10/23 18:29:39
@@ -136,7 +136,7 @@
if (get_invention(pplayer, i) != TECH_KNOWN
&& tech_is_available(pplayer, i)
&& game.global_advances[i]>=2) {
- notify_player_ex(pplayer, -1, -1, E_TECH_GAIN,
+ notify_player_ex(pplayer, -1, -1, NULL, E_TECH_GAIN,
_("Game: %s acquired from The Great Library!"),
advances[i].name);
gamelog(GAMELOG_TECH, _("%s discover %s (Library)"),
@@ -223,7 +223,8 @@
pplayer->name);
return;
} else {
- notify_player_ex(NULL, -1, -1, E_DESTROYED, _("Game: The %s are no more!"),
+ notify_player_ex(NULL, -1, -1, NULL, E_DESTROYED,
+ _("Game: The %s are no more!"),
get_nation_name_plural(pplayer->nation));
gamelog(GAMELOG_GENO, _("%s civilization destroyed"),
get_nation_name(pplayer->nation));
@@ -296,7 +297,7 @@
if (game.global_wonders[id] != 0 && is_wonder(id) &&
improvement_types[id].obsolete_by == tech_found &&
(pcity = find_city_by_id(game.global_wonders[id]))) {
- notify_player_ex(city_owner(pcity), -1, -1, E_WONDER_OBSOLETE,
+ notify_player_ex(city_owner(pcity), -1, -1, NULL, E_WONDER_OBSOLETE,
_("Game: Discovery of %s OBSOLETES %s in %s!"),
advances[tech_found].name, get_improvement_name(id),
pcity->name);
@@ -306,7 +307,7 @@
government_iterate(gov) {
if (tech_found == gov->required_tech) {
- notify_player_ex(plr,-1,-1, E_NEW_GOVERNMENT,
+ notify_player_ex(plr, -1, -1, NULL, E_NEW_GOVERNMENT,
_("Game: Discovery of %s makes the government form %s"
" available. You may want to start a revolution."),
advances[tech_found].name, gov->name);
@@ -347,7 +348,7 @@
int saved_bulbs = plr->research.bulbs_researched;
if (choose_goal_tech(plr)) {
- notify_player_ex(plr, -1, -1, E_TECH_LEARNED,
+ notify_player_ex(plr, -1, -1, NULL, E_TECH_LEARNED,
_("Game: Learned %s. "
"Our scientists focus on %s, goal is %s."),
advances[tech_found].name,
@@ -357,7 +358,7 @@
choose_random_tech(plr);
if (!is_future_tech(plr->research.researching)
|| !is_future_tech(tech_found)) {
- notify_player_ex(plr, -1, -1, E_TECH_LEARNED,
+ notify_player_ex(plr, -1, -1, NULL, E_TECH_LEARNED,
_("Game: Learned %s. Scientists "
"choose to research %s."),
advances[tech_found].name,
@@ -371,7 +372,7 @@
plr->future_tech++;
my_snprintf(buffer2, sizeof(buffer2), _("Researching %s."),
get_tech_name(plr, plr->research.researching));
- notify_player_ex(plr, -1, -1, E_TECH_LEARNED, "%s%s", buffer1,
+ notify_player_ex(plr, -1, -1, NULL, E_TECH_LEARNED, "%s%s", buffer1,
buffer2);
}
}
@@ -684,12 +685,12 @@
get_tech_name(pplayer, stolen_tech),
get_nation_name_plural(target->nation));
- notify_player_ex(pplayer, -1, -1, E_TECH_GAIN,
+ notify_player_ex(pplayer, -1, -1, target, E_TECH_GAIN,
_("Game: You steal %s from the %s."),
get_tech_name(pplayer, stolen_tech),
get_nation_name_plural(target->nation));
- notify_player_ex(target, -1, -1, E_ENEMY_DIPLOMAT_THEFT,
+ notify_player_ex(target, -1, -1, pplayer, E_ENEMY_DIPLOMAT_THEFT,
_("Game: The %s stole %s from you!"),
get_nation_name_plural(pplayer->nation),
get_tech_name(pplayer, stolen_tech));
@@ -819,7 +820,7 @@
pplayer->revolution=myrand(5)+1;
pplayer->government=game.government_when_anarchy;
- notify_player_ex(pplayer, -1, -1, E_REVOLT_START,
+ notify_player_ex(pplayer, -1, -1, NULL, E_REVOLT_START,
_("Game: The %s have incited a revolt!"),
get_nation_name_plural(pplayer->nation));
gamelog(GAMELOG_REVOLT, _("The %s revolt!"),
@@ -912,7 +913,7 @@
return;
}
remove_shared_vision(pplayer, pplayer2);
- notify_player_ex(pplayer2, -1, -1, E_TREATY_BROKEN,
+ notify_player_ex(pplayer2, -1, -1, pplayer, E_TREATY_BROKEN,
_("%s no longer gives us shared vision!"),
pplayer->name);
return;
@@ -950,7 +951,7 @@
if (pplayer->diplstates[pplayer2->player_no].has_reason_to_cancel > 0) {
pplayer->diplstates[pplayer2->player_no].has_reason_to_cancel = 0;
if (has_senate && !repeat) {
- notify_player_ex(pplayer, -1, -1, E_TREATY_BROKEN,
+ notify_player_ex(pplayer, -1, -1, pplayer2, E_TREATY_BROKEN,
_("The senate passes your bill because of the "
"constant provocations of the %s."),
get_nation_name_plural(pplayer2->nation));
@@ -962,12 +963,12 @@
extend the govt rulesets to mimic this -- pt */
else {
pplayer->reputation = MAX(pplayer->reputation - reppenalty, 0);
- notify_player_ex(pplayer, -1, -1, E_TREATY_BROKEN,
+ notify_player_ex(pplayer, -1, -1, NULL, E_TREATY_BROKEN,
_("Game: Your reputation is now %s."),
reputation_text(pplayer->reputation));
if (has_senate && pplayer->revolution == 0) {
if (myrand(GAME_MAX_REPUTATION) > pplayer->reputation) {
- notify_player_ex(pplayer, -1, -1, E_ANARCHY,
+ notify_player_ex(pplayer, -1, -1, NULL, E_ANARCHY,
_("Game: The senate decides to dissolve "
"rather than support your actions any longer."));
handle_player_revolution(pplayer);
@@ -1008,13 +1009,13 @@
check_city_workers(pplayer);
check_city_workers(pplayer2);
- notify_player_ex(pplayer, -1, -1, E_TREATY_BROKEN,
+ notify_player_ex(pplayer, -1, -1, pplayer2, E_TREATY_BROKEN,
_("Game: The diplomatic state between the %s "
"and the %s is now %s."),
get_nation_name_plural(pplayer->nation),
get_nation_name_plural(pplayer2->nation),
diplstate_text(new_type));
- notify_player_ex(pplayer2, -1, -1, E_TREATY_BROKEN,
+ notify_player_ex(pplayer2, -1, -1, pplayer, E_TREATY_BROKEN,
_("Game: %s cancelled the diplomatic agreement! "
"The diplomatic state between the %s and the %s "
"is now %s."), pplayer->name,
@@ -1034,7 +1035,7 @@
* war against all of B's allies. Yes, A gets the blame. */
packet.id = other->player_no;
packet.value1 = CLAUSE_LAST;
- notify_player_ex(other, -1, -1, E_TREATY_BROKEN,
+ notify_player_ex(other, -1, -1, pplayer, E_TREATY_BROKEN,
_("Game: %s has attacked one of your allies! "
"The alliance brings you into the war as well."),
pplayer->name);
@@ -1046,20 +1047,23 @@
/**************************************************************************
This is the basis for following notify_conn* and notify_player* functions.
Notify specified connections of an event of specified type (from events.h)
- and specified (x,y) coords associated with the event. Coords will only
- apply if game has started and the conn's player knows that tile (or
- pconn->player==NULL && pconn->observer). If coords are not required,
- caller should specify (x,y) = (-1,-1); otherwise make sure that the
- coordinates have been normalized. For generic event use E_NOEVENT.
- (But current clients do not use (x,y) data for E_NOEVENT events.)
+ plus specified (x,y) coords and any player associated with the event.
+ Coords will only apply if game has started and the conn's player knows that
+ tile (or pconn->player==NULL && pconn->observer). If coords are not
+ required, caller should specify (x,y) = (-1,-1); otherwise make sure that
+ the coordinates have been normalized. The target player may be NULL if
+ none is appropriate. For generic event use E_NOEVENT. (But current
+ clients do not use (x,y) data for E_NOEVENT events.)
**************************************************************************/
-void vnotify_conn_ex(struct conn_list *dest, int x, int y, int event,
+void vnotify_conn_ex(struct conn_list *dest,
+ int x, int y, struct player *ptarget, int event,
const char *format, va_list vargs)
{
struct packet_generic_message genmsg;
my_vsnprintf(genmsg.message, sizeof(genmsg.message), format, vargs);
genmsg.event = event;
+ genmsg.player = (ptarget ? ptarget->player_no : -1);
conn_list_iterate(*dest, pconn) {
if (server_state >= RUN_GAME_STATE
@@ -1082,12 +1086,13 @@
/**************************************************************************
See vnotify_conn_ex - this is just the "non-v" version, with varargs.
**************************************************************************/
-void notify_conn_ex(struct conn_list *dest, int x, int y, int event,
+void notify_conn_ex(struct conn_list *dest,
+ int x, int y, struct player *ptarget, int event,
const char *format, ...)
{
va_list args;
va_start(args, format);
- vnotify_conn_ex(dest, x, y, event, format, args);
+ vnotify_conn_ex(dest, x, y, ptarget, event, format, args);
va_end(args);
}
@@ -1098,7 +1103,7 @@
{
va_list args;
va_start(args, format);
- vnotify_conn_ex(dest, -1, -1, E_NOEVENT, format, args);
+ vnotify_conn_ex(dest, -1, -1, NULL, E_NOEVENT, format, args);
va_end(args);
}
@@ -1109,8 +1114,9 @@
old code, but this feature may go away - should use notify_conn with
explicitly game.est_connections or game.game_connections as dest.
**************************************************************************/
-void notify_player_ex(const struct player *pplayer, int x, int y,
- int event, const char *format, ...)
+void notify_player_ex(const struct player *pplayer,
+ int x, int y, struct player *ptarget, int event,
+ const char *format, ...)
{
struct conn_list *dest;
va_list args;
@@ -1122,7 +1128,7 @@
}
va_start(args, format);
- vnotify_conn_ex(dest, x, y, event, format, args);
+ vnotify_conn_ex(dest, x, y, ptarget, event, format, args);
va_end(args);
}
@@ -1141,7 +1147,7 @@
}
va_start(args, format);
- vnotify_conn_ex(dest, -1, -1, E_NOEVENT, format, args);
+ vnotify_conn_ex(dest, -1, -1, NULL, E_NOEVENT, format, args);
va_end(args);
}
@@ -1461,11 +1467,11 @@
pplayer1->diplstates[player2].type
= pplayer2->diplstates[player1].type
= dipstate;
- notify_player_ex(pplayer1, x, y,
+ notify_player_ex(pplayer1, x, y, pplayer2,
E_FIRST_CONTACT,
_("Game: You have made contact with the %s, ruled by %s."),
get_nation_name_plural(pplayer2->nation), pplayer2->name);
- notify_player_ex(pplayer2, x, y,
+ notify_player_ex(pplayer2, x, y, pplayer1,
E_FIRST_CONTACT,
_("Game: You have made contact with the %s, ruled by %s."),
get_nation_name_plural(pplayer1->nation), pplayer1->name);
@@ -1841,7 +1847,7 @@
freelog(LOG_VERBOSE,
"%s's nation is thrust into civil war, created AI player %s",
pplayer->name, cplayer->name);
- notify_player_ex(pplayer, -1, -1, E_CIVIL_WAR,
+ notify_player_ex(pplayer, -1, -1, cplayer, E_CIVIL_WAR,
_("Game: Your nation is thrust into civil war, "
" %s is declared the leader of the rebel states."),
cplayer->name);
@@ -1861,7 +1867,7 @@
transfer_city(cplayer, pcity, -1, FALSE, FALSE, FALSE);
freelog(LOG_VERBOSE, "%s declares allegiance to %s",
pcity->name, cplayer->name);
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_LOST,
+ notify_player_ex(pplayer, pcity->x, pcity->y, cplayer, E_CITY_LOST,
_("Game: %s declares allegiance to %s."),
pcity->name, cplayer->name);
i--;
Index: server/plrhand.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.h,v
retrieving revision 1.59
diff -u -r1.59 plrhand.h
--- server/plrhand.h 2003/10/20 08:30:22 1.59
+++ server/plrhand.h 2003/10/23 18:29:39
@@ -46,16 +46,19 @@
void send_player_info(struct player *src, struct player *dest);
void send_player_info_c(struct player *src, struct conn_list *dest);
-void notify_conn_ex(struct conn_list *dest, int x, int y, int event,
+void notify_conn_ex(struct conn_list *dest,
+ int x, int y, struct player *ptarget, int event,
const char *format, ...)
- fc__attribute((format (printf, 5, 6)));
-void vnotify_conn_ex(struct conn_list *dest, int x, int y, int event,
+ fc__attribute((format (printf, 6, 7)));
+void vnotify_conn_ex(struct conn_list *dest,
+ int x, int y, struct player *ptarget, int event,
const char *format, va_list vargs);
void notify_conn(struct conn_list *dest, const char *format, ...)
fc__attribute((format (printf, 2, 3)));
-void notify_player_ex(const struct player *pplayer, int x, int y,
- int event, const char *format, ...)
- fc__attribute((format (printf, 5, 6)));
+void notify_player_ex(const struct player *pplayer,
+ int x, int y, struct player *ptarget, int event,
+ const char *format, ...)
+ fc__attribute((format (printf, 6, 7)));
void notify_player(const struct player *pplayer, const char *format, ...)
fc__attribute((format (printf, 2, 3)));
void notify_embassies(struct player *pplayer, struct player *exclude,
Index: server/spacerace.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/spacerace.c,v
retrieving revision 1.35
diff -u -r1.35 spacerace.c
--- server/spacerace.c 2003/08/09 15:34:19 1.35
+++ server/spacerace.c 2003/10/23 18:29:39
@@ -179,7 +179,7 @@
ship->launch_year = game.year;
arrival = ship->launch_year + (int) ship->travel_time;
- notify_player_ex(NULL, -1, -1, E_SPACESHIP,
+ notify_player_ex(NULL, -1, -1, pplayer, E_SPACESHIP,
_("Game: The %s have launched a spaceship! "
"It is estimated to arrive on Alpha Centauri in %s."),
get_nation_name_plural(pplayer->nation),
@@ -338,7 +338,7 @@
**************************************************************************/
void spaceship_lost(struct player *pplayer)
{
- notify_player_ex(NULL, -1, -1, E_SPACESHIP,
+ notify_player_ex(NULL, -1, -1, pplayer, E_SPACESHIP,
_("Game: Without guidance from the capital, the %s "
"spaceship is lost!"),
get_nation_name(pplayer->nation));
@@ -369,7 +369,7 @@
if (best_pplayer) {
best_pplayer->spaceship.state = SSHIP_ARRIVED;
server_state = GAME_OVER_STATE;
- notify_player_ex(NULL, -1, -1, E_SPACESHIP,
+ notify_player_ex(NULL, -1, -1, best_pplayer, E_SPACESHIP,
_("Game: The %s spaceship has arrived "
"at Alpha Centauri."),
get_nation_name(best_pplayer->nation));
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.142
diff -u -r1.142 srv_main.c
--- server/srv_main.c 2003/10/13 07:27:20 1.142
+++ server/srv_main.c 2003/10/23 18:29:39
@@ -198,7 +198,7 @@
/* quit if we are past the year limit */
if (game.year > game.end_year) {
- notify_conn_ex(&game.est_connections, -1, -1, E_GAME_END,
+ notify_conn_ex(&game.est_connections, -1, -1, NULL, E_GAME_END,
_("Game ended in a draw as end year exceeded"));
gamelog(GAMELOG_NORMAL, _("Game ended in a draw as end year exceeded"));
return TRUE;
@@ -227,7 +227,7 @@
/* quit if we have team victory */
team_iterate(pteam) {
if (team_count_members_alive(pteam->id) == alive) {
- notify_conn_ex(&game.est_connections, -1, -1, E_GAME_END,
+ notify_conn_ex(&game.est_connections, -1, -1, NULL, E_GAME_END,
_("Team victory to %s"), pteam->name);
gamelog(GAMELOG_NORMAL, _("Team victory to %s"), pteam->name);
gamelog(GAMELOG_TEAM, "TEAMVICTORY %s", pteam->name);
@@ -237,14 +237,14 @@
/* quit if only one player is left alive */
if (alive == 1) {
- notify_conn_ex(&game.est_connections, -1, -1, E_GAME_END,
+ notify_conn_ex(&game.est_connections, -1, -1, victor, E_GAME_END,
_("Game ended in victory for %s"), victor->name);
gamelog(GAMELOG_NORMAL, _("Game ended in victory for %s"),
victor->name);
gamelog(GAMELOG_TEAM, "SINGLEWINNER %s", victor->name);
return TRUE;
} else if (alive == 0) {
- notify_conn_ex(&game.est_connections, -1, -1, E_GAME_END,
+ notify_conn_ex(&game.est_connections, -1, -1, NULL, E_GAME_END,
_("Game ended in a draw"));
gamelog(GAMELOG_NORMAL, _("Game ended in a draw"));
gamelog(GAMELOG_TEAM, "NOWINNER");
@@ -268,7 +268,7 @@
}
} players_iterate_end;
if (all_allied) {
- notify_conn_ex(&game.est_connections, -1, -1, E_GAME_END,
+ notify_conn_ex(&game.est_connections, -1, -1, NULL, E_GAME_END,
_("Game ended in allied victory"));
gamelog(GAMELOG_NORMAL, _("Game ended in allied victory"));
gamelog(GAMELOG_TEAM, "ALLIEDVICTORY");
@@ -1071,7 +1071,7 @@
}
} players_iterate_end;
- notify_conn_ex(&game.game_connections, -1, -1, E_NATION_SELECTED,
+ notify_conn_ex(&game.game_connections, -1, -1, pplayer, E_NATION_SELECTED,
_("Game: %s is the %s ruler %s."), pplayer->username,
get_nation_name(packet->nation_no), packet->name);
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.299
diff -u -r1.299 stdinhand.c
--- server/stdinhand.c 2003/10/22 18:02:56 1.299
+++ server/stdinhand.c 2003/10/23 18:29:39
@@ -2529,7 +2529,7 @@
******************************************************************/
static void wall(char *str)
{
- notify_conn_ex(&game.game_connections, -1, -1, E_MESSAGE_WALL,
+ notify_conn_ex(&game.game_connections, -1, -1, NULL, E_MESSAGE_WALL,
_("Server Operator: %s"), str);
}
Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.275
diff -u -r1.275 unithand.c
--- server/unithand.c 2003/10/08 16:56:07 1.275
+++ server/unithand.c 2003/10/23 18:29:39
@@ -420,7 +420,7 @@
}
wipe_unit(punit);
} else {
- notify_player_ex(unit_owner(punit), punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(unit_owner(punit), punit->x, punit->y, NULL, E_NOEVENT,
_("Game: %s refuses to disband!"), unit_name(punit->type));
return;
}
@@ -443,19 +443,19 @@
switch (res) {
case AB_NOT_BUILD_LOC:
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: Can't place city here."));
break;
case AB_NOT_BUILD_UNIT:
{
const char *us = get_units_with_flag_string(F_CITIES);
if (us) {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: Only %s can build a city."),
us);
free((void *) us);
} else {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: Can't build a city."));
}
}
@@ -464,39 +464,39 @@
{
const char *us = get_units_with_flag_string(F_ADD_TO_CITY);
if (us) {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: Only %s can add to a city."),
us);
free((void *) us);
} else {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: Can't add to a city."));
}
}
break;
case AB_NO_MOVES_ADD:
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: %s unit has no moves left to add to %s."),
unit_name, pcity->name);
break;
case AB_NO_MOVES_BUILD:
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: %s unit has no moves left to build city."),
unit_name);
break;
case AB_TOO_BIG:
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: %s is too big to add %s."),
pcity->name, unit_name);
break;
case AB_NO_AQUEDUCT:
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: %s needs %s to grow, so you cannot add %s."),
pcity->name, get_improvement_name(B_AQUEDUCT),
unit_name);
break;
case AB_NO_SEWER:
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: %s needs %s to grow, so you cannot add %s."),
pcity->name, get_improvement_name(B_SEWER),
unit_name);
@@ -505,7 +505,7 @@
/* Shouldn't happen */
freelog(LOG_ERROR, "Cannot add %s to %s for unknown reason",
unit_name, pcity->name);
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: Can't add %s to %s."),
unit_name, pcity->name);
break;
@@ -529,7 +529,7 @@
auto_arrange_workers(pcity);
wipe_unit(punit);
send_city_info(NULL, pcity);
- notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity->x, pcity->y, NULL, E_NOEVENT,
_("Game: %s added to aid %s in growing."),
unit_name, pcity->name);
}
@@ -544,7 +544,7 @@
char *name)
{
if (!is_sane_name(name)) {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: Let's not build a city with "
"such a stupid name."));
return;
@@ -680,10 +680,12 @@
packet.x=def_x;
packet.y=def_y;
if ((pcity=sdi_defense_close(unit_owner(punit), def_x, def_y))) {
- notify_player_ex(pplayer, punit->x, punit->y, E_UNIT_LOST_ATT,
+ struct player *cplayer = city_owner(pcity);
+
+ notify_player_ex(pplayer, punit->x, punit->y, cplayer, E_UNIT_LOST_ATT,
_("Game: Your Nuclear missile was shot down by"
" SDI defences, what a waste."));
- notify_player_ex(city_owner(pcity), def_x, def_y, E_UNIT_WIN,
+ notify_player_ex(cplayer, def_x, def_y, pplayer, E_UNIT_WIN,
_("Game: The nuclear attack on %s was avoided by"
" your SDI defense."), pcity->name);
wipe_unit(punit);
@@ -787,13 +789,15 @@
} conn_list_iterate_end;
if (punit == plooser) {
+ struct player *pplayer2 = unit_owner(pwinner);
+
/* The attacker lost */
freelog(LOG_DEBUG, "Attacker lost: %s's %s against %s's %s.",
pplayer->name, unit_type(punit)->name,
unit_owner(pdefender)->name, unit_type(pdefender)->name);
- notify_player_ex(unit_owner(pwinner),
- pwinner->x, pwinner->y, E_UNIT_WIN,
+ notify_player_ex(pplayer2, pwinner->x, pwinner->y, pplayer,
+ E_UNIT_WIN,
_("Game: Your %s%s survived the pathetic attack"
" from %s's %s."),
unit_name(pwinner->type),
@@ -801,8 +805,7 @@
pwinner->x, pwinner->y),
unit_owner(plooser)->name, unit_name(plooser->type));
- notify_player_ex(unit_owner(plooser),
- def_x, def_y, E_UNIT_LOST_ATT,
+ notify_player_ex(pplayer, def_x, def_y, pplayer2, E_UNIT_LOST_ATT,
_("Game: Your attacking %s failed "
"against %s's %s%s!"),
unit_name(plooser->type), unit_owner(pwinner)->name,
@@ -819,7 +822,7 @@
punit->moved = TRUE; /* We moved */
notify_player_ex(unit_owner(pwinner), punit->x, punit->y,
- E_UNIT_WIN_ATT,
+ unit_owner(plooser), E_UNIT_WIN_ATT,
_("Game: Your attacking %s succeeded"
" against %s's %s%s!"), unit_name(pwinner->type),
unit_owner(plooser)->name, unit_name(plooser->type),
@@ -870,7 +873,8 @@
**************************************************************************/
static void how_to_declare_war(struct player *pplayer)
{
- notify_player_ex(pplayer, -1, -1, E_NOEVENT,
+ /* FIXME: set target player properly. */
+ notify_player_ex(pplayer, -1, -1, NULL, E_NOEVENT,
_("Game: Cancel treaty in the players dialog first (F3)."));
}
@@ -893,20 +897,20 @@
if (reason == MR_BAD_TYPE_FOR_CITY_TAKE_OVER) {
const char *units_str = get_units_with_flag_string(F_MARINES);
if (units_str) {
- notify_player_ex(unit_owner(punit), src_x, src_y,
+ notify_player_ex(unit_owner(punit), src_x, src_y, NULL,
E_NOEVENT, _("Game: Only %s can attack from sea."),
units_str);
free((void *) units_str);
} else {
- notify_player_ex(unit_owner(punit), src_x, src_y,
+ notify_player_ex(unit_owner(punit), src_x, src_y, NULL,
E_NOEVENT, _("Game: Cannot attack from sea."));
}
} else if (reason == MR_NO_WAR) {
- notify_player_ex(unit_owner(punit), src_x, src_y,
+ notify_player_ex(unit_owner(punit), src_x, src_y, NULL,
E_NOEVENT,
_("Game: Cannot attack unless you declare war first."));
} else if (reason == MR_ZOC) {
- notify_player_ex(unit_owner(punit), src_x, src_y, E_NOEVENT,
+ notify_player_ex(unit_owner(punit), src_x, src_y, NULL, E_NOEVENT,
_("Game: %s can only move into your own zone of control."),
unit_type(punit)->name);
}
@@ -948,7 +952,7 @@
if (punit->moves_left<=0) {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: This unit has no moves left."));
return FALSE;
}
@@ -1006,7 +1010,7 @@
lsend_packet_diplomat_action(player_reply_dest(pplayer), &packet);
return FALSE;
} else if (!can_unit_move_to_tile(punit, x, y, igzoc)) {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
is_ocean(map_get_terrain(punit->x, punit->y))
? _("Game: Unit must be on land to "
"perform diplomatic action.")
@@ -1024,7 +1028,8 @@
/* We can attack ONLY in enemy cities */
if (pcity && !pplayers_at_war(city_owner(pcity), pplayer)) {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, city_owner(pcity),
+ E_NOEVENT,
_("Game: Can't attack %s "
"because you are not at war with %s."),
pcity->name,
@@ -1035,7 +1040,8 @@
/* Tile must contain ONLY enemy units. */
if ((victim = is_non_attack_unit_tile(pdesttile, pplayer))) {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, unit_owner(victim),
+ E_NOEVENT,
_("Game: Can't attack %s's unit"
"because you are not at war with %s."),
unit_owner(victim)->name,
@@ -1050,7 +1056,8 @@
if (victim) {
/* Must be physically able to attack EVERY unit there */
if (!can_unit_attack_all_at_tile(punit, x, y)) {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ /* FIXME: Set target player correctly. */
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: You can't attack there."));
return FALSE;
}
@@ -1064,7 +1071,7 @@
* If not it would have been caught in the attack case.
* FIXME: Move this check into test_unit_move_tile */
if (!COULD_OCCUPY(punit)) {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: This type of troops cannot "
"take over a city."));
return FALSE;
@@ -1082,7 +1089,7 @@
if (pcargo->transported_by == punit->id
&& (is_non_allied_unit_tile(pdesttile, unit_owner(pcargo))
|| is_non_allied_city_tile(pdesttile, unit_owner(pcargo)))) {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: A transported unit is not allied to all "
"units or city on target tile."));
return FALSE;
@@ -1141,7 +1148,7 @@
} else {
text = _("Game: Your %s helps build the %s in %s (%d surplus).");
}
- notify_player_ex(pplayer, pcity_dest->x, pcity_dest->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity_dest->x, pcity_dest->y, NULL, E_NOEVENT,
text, /* Must match arguments below. */
unit_name(punit->type),
get_improvement_type(pcity_dest->currently_building)->name,
@@ -1209,10 +1216,12 @@
pcity_out_of_home = find_city_by_id(pcity_homecity->trade[slot]);
assert(pcity_out_of_home != NULL);
} else {
- notify_player_ex(pplayer, pcity_dest->x, pcity_dest->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity_dest->x, pcity_dest->y, NULL,
+ E_NOEVENT,
_("Game: Sorry, your %s cannot establish"
" a trade route here!"), unit_name(punit->type));
- notify_player_ex(pplayer, pcity_dest->x, pcity_dest->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity_dest->x, pcity_dest->y, NULL,
+ E_NOEVENT,
_(" The city of %s already has %d "
"better trade routes!"), pcity_homecity->name,
NUM_TRADEROUTES);
@@ -1226,10 +1235,12 @@
pcity_out_of_dest = find_city_by_id(pcity_dest->trade[slot]);
assert(pcity_out_of_dest != NULL);
} else {
- notify_player_ex(pplayer, pcity_dest->x, pcity_dest->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity_dest->x, pcity_dest->y, NULL,
+ E_NOEVENT,
_("Game: Sorry, your %s cannot establish"
" a trade route here!"), unit_name(punit->type));
- notify_player_ex(pplayer, pcity_dest->x, pcity_dest->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity_dest->x, pcity_dest->y, NULL,
+ E_NOEVENT,
_(" The city of %s already has %d "
"better trade routes!"), pcity_dest->name,
NUM_TRADEROUTES);
@@ -1241,7 +1252,8 @@
if (can_establish && pcity_out_of_home) {
remove_trade_route(pcity_homecity, pcity_out_of_home);
notify_player_ex(city_owner(pcity_out_of_home),
- pcity_out_of_home->x, pcity_out_of_home->y, E_NOEVENT,
+ pcity_out_of_home->x, pcity_out_of_home->y,
+ city_owner(pcity_homecity), E_NOEVENT,
_("Game: Sorry, %s has canceled the trade route "
"from %s to your city %s."),
city_owner(pcity_homecity)->name,
@@ -1252,7 +1264,8 @@
if (can_establish && pcity_out_of_dest) {
remove_trade_route(pcity_dest, pcity_out_of_dest);
notify_player_ex(city_owner(pcity_out_of_dest),
- pcity_out_of_dest->x, pcity_out_of_dest->y, E_NOEVENT,
+ pcity_out_of_dest->x, pcity_out_of_dest->y,
+ city_owner(pcity_dest), E_NOEVENT,
_("Game: Sorry, %s has canceled the trade route "
"from %s to your city %s."),
city_owner(pcity_dest)->name,
@@ -1284,7 +1297,8 @@
}
conn_list_do_buffer(&pplayer->connections);
- notify_player_ex(pplayer, pcity_dest->x, pcity_dest->y, E_NOEVENT,
+ notify_player_ex(pplayer, pcity_dest->x, pcity_dest->y,
+ city_owner(pcity_homecity), E_NOEVENT,
_("Game: Your %s from %s has arrived in %s,"
" and revenues amount to %d in gold and research."),
unit_name(punit->type), pcity_homecity->name,
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.260
diff -u -r1.260 unittools.c
--- server/unittools.c 2003/10/13 21:33:59 1.260
+++ server/unittools.c 2003/10/23 18:29:39
@@ -301,7 +301,7 @@
* improvements will not help so we will have to disband */
assert(pplayer->economic.gold + potential_gold >= 0);
- notify_player_ex(pplayer, -1, -1, E_UNIT_LOST,
+ notify_player_ex(pplayer, -1, -1, NULL, E_UNIT_LOST,
_("Not enough gold. %s disbanded"),
unit_type(punit)->name);
wipe_unit(punit);
@@ -426,7 +426,7 @@
/* This should usually only happen for heli units,
but if any other units get 0 hp somehow, catch
them too. --dwp */
- notify_player_ex(pplayer, punit->x, punit->y, E_UNIT_LOST,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_UNIT_LOST,
_("Game: Your %s has run out of hit points."),
unit_name(punit->type));
gamelog(GAMELOG_UNITF, _("%s lose a %s (out of hp)"),
@@ -439,7 +439,7 @@
/* 4) Check that triremes are near coastline, otherwise... */
if (unit_flag(punit, F_TRIREME)
&& myrand(100) < trireme_loss_pct(pplayer, punit->x, punit->y)) {
- notify_player_ex(pplayer, punit->x, punit->y, E_UNIT_LOST,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_UNIT_LOST,
_("Game: Your %s has been lost on the high seas."),
unit_name(punit->type));
gamelog(GAMELOG_UNITTRI, _("%s Trireme lost at sea"),
@@ -468,7 +468,7 @@
set_goto_dest(punit, x_itr, y_itr);
set_unit_activity(punit, ACTIVITY_GOTO);
(void) do_unit_goto(punit, GOTO_MOVE_ANY, FALSE);
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: Your %s has returned to refuel."),
unit_name(punit->type));
goto OUT;
@@ -494,7 +494,7 @@
unit_list_iterate(pplayer->units, punit) {
if (is_air_unit(punit) && punit->fuel <= 0
&& unit_type(punit)->fuel > 0) {
- notify_player_ex(pplayer, punit->x, punit->y, E_UNIT_LOST,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_UNIT_LOST,
_("Game: Your %s has run out of fuel."),
unit_name(punit->type));
gamelog(GAMELOG_UNITF, _("%s lose a %s (fuel)"),
@@ -934,7 +934,7 @@
unit_owner(punit2)->name, unit_name(punit2->type),
punit2->x, punit2->y);
notify_player_ex(unit_owner(punit2),
- punit2->x, punit2->y, E_UNIT_RELOCATED,
+ punit2->x, punit2->y, NULL, E_UNIT_RELOCATED,
_("Game: Moved your %s due to changing"
" land to sea at (%d, %d)."),
unit_name(punit2->type), punit2->x, punit2->y);
@@ -957,7 +957,7 @@
unit_owner(punit2)->name, unit_name(punit2->type),
punit2->x, punit2->y);
notify_player_ex(unit_owner(punit2),
- punit2->x, punit2->y, E_UNIT_RELOCATED,
+ punit2->x, punit2->y, NULL, E_UNIT_RELOCATED,
_("Game: Embarked your %s due to changing"
" land to sea at (%d, %d)."),
unit_name(punit2->type), punit2->x, punit2->y);
@@ -973,7 +973,7 @@
unit_owner(punit2)->name, unit_name(punit2->type),
punit2->x, punit2->y);
notify_player_ex(unit_owner(punit2),
- punit2->x, punit2->y, E_UNIT_LOST,
+ punit2->x, punit2->y, NULL, E_UNIT_LOST,
_("Game: Disbanded your %s due to changing"
" land to sea at (%d, %d)."),
unit_name(punit2->type), punit2->x, punit2->y);
@@ -997,7 +997,7 @@
unit_owner(punit2)->name, unit_name(punit2->type),
punit2->x, punit2->y);
notify_player_ex(unit_owner(punit2),
- punit2->x, punit2->y, E_UNIT_RELOCATED,
+ punit2->x, punit2->y, NULL, E_UNIT_RELOCATED,
_("Game: Moved your %s due to changing"
" sea to land at (%d, %d)."),
unit_name(punit2->type), punit2->x, punit2->y);
@@ -1019,7 +1019,7 @@
unit_owner(punit2)->name, unit_name(punit2->type),
punit2->x, punit2->y);
notify_player_ex(unit_owner(punit2),
- punit2->x, punit2->y, E_UNIT_RELOCATED,
+ punit2->x, punit2->y, NULL, E_UNIT_RELOCATED,
_("Game: Docked your %s due to changing"
" sea to land at (%d, %d)."),
unit_name(punit2->type), punit2->x, punit2->y);
@@ -1035,7 +1035,7 @@
unit_owner(punit2)->name, unit_name(punit2->type),
punit2->x, punit2->y);
notify_player_ex(unit_owner(punit2),
- punit2->x, punit2->y, E_UNIT_LOST,
+ punit2->x, punit2->y, NULL, E_UNIT_LOST,
_("Game: Disbanded your %s due to changing"
" sea to land at (%d, %d)."),
unit_name(punit2->type), punit2->x, punit2->y);
@@ -1591,7 +1591,8 @@
/* check if this unit had F_GAMELOSS flag */
if (unit_flag(punit, F_GAMELOSS) && unit_owner(punit)->is_alive) {
- notify_conn_ex(&game.est_connections, punit->x, punit->y, E_UNIT_LOST,
+ notify_conn_ex(&game.est_connections,
+ punit->x, punit->y, unit_owner(punit), E_UNIT_LOST,
_("Unable to defend %s, %s has lost the game."),
unit_name(punit->type), unit_owner(punit)->name);
notify_player(unit_owner(punit), _("Losing %s meant losing the game! "
@@ -1684,14 +1685,14 @@
pcity = find_closest_owned_city(unit_owner(pcargo),
pcargo->x, pcargo->y, TRUE, NULL);
if (pcity && teleport_unit_to_city(pcargo, pcity, 0, FALSE)) {
- notify_player_ex(pplayer, x, y, E_NOEVENT,
+ notify_player_ex(pplayer, x, y, NULL, E_NOEVENT,
_("Game: %s escaped the destruction of %s, and "
"fled to %s."), unit_type(pcargo)->name,
ptype->name, pcity->name);
}
}
if (!unit_flag(pcargo, F_UNDISBANDABLE) || !pcity) {
- notify_player_ex(pplayer, x, y, E_UNIT_LOST,
+ notify_player_ex(pplayer, x, y, NULL, E_UNIT_LOST,
_("Game: %s lost when %s was lost."),
unit_type(pcargo)->name,
ptype->name);
@@ -1752,7 +1753,7 @@
&& (unit_list_size(&(map_get_tile(punit->x, punit->y)->units)) == 1)
&& (is_ground_unit(pkiller) || is_heli_unit(pkiller)) ) {
ransom = (pplayer->economic.gold >= 100)?100:pplayer->economic.gold;
- notify_player_ex(destroyer, pkiller->x, pkiller->y, E_UNIT_WIN_ATT,
+ notify_player_ex(destroyer, pkiller->x, pkiller->y, NULL, E_UNIT_WIN_ATT,
_("Game: Barbarian leader captured, %d gold ransom paid."),
ransom);
destroyer->economic.gold += ransom;
@@ -1769,7 +1770,7 @@
}
if (!is_stack_vulnerable(punit->x,punit->y) || unitcount == 1) {
- notify_player_ex(pplayer, punit->x, punit->y, E_UNIT_LOST,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_UNIT_LOST,
_("Game: %s lost to an attack by %s's %s%s."),
unit_type(punit)->name, destroyer->name,
unit_name(pkiller->type), loc_str);
@@ -1797,7 +1798,8 @@
/* inform the owners */
for (i = 0; i<MAX_NUM_PLAYERS+MAX_NUM_BARBARIANS; i++) {
if (num_killed[i]>0) {
- notify_player_ex(get_player(i), punit->x, punit->y, E_UNIT_LOST,
+ notify_player_ex(get_player(i), punit->x, punit->y, destroyer,
+ E_UNIT_LOST,
PL_("Game: You lost %d unit to an attack "
"from %s's %s%s.",
"Game: You lost %d units to an attack "
@@ -1812,7 +1814,7 @@
unit_list_iterate(map_get_tile(punit->x, punit->y)->units, punit2) {
if (pplayers_at_war(unit_owner(pkiller), unit_owner(punit2))) {
notify_player_ex(unit_owner(punit2),
- punit2->x, punit2->y, E_UNIT_LOST,
+ punit2->x, punit2->y, destroyer, E_UNIT_LOST,
_("Game: %s lost to an attack"
" from %s's %s."),
unit_type(punit2)->name, destroyer->name,
@@ -2037,13 +2039,13 @@
unit_list_iterate(map_get_tile(x, y)->units, punit) {
notify_player_ex(unit_owner(punit),
- x, y, E_UNIT_LOST,
+ x, y, pplayer, E_UNIT_LOST,
_("Game: Your %s was nuked by %s."),
unit_name(punit->type),
pplayer == unit_owner(punit) ? _("yourself") :
pplayer->name);
if (unit_owner(punit) != pplayer) {
notify_player_ex(pplayer,
- x, y, E_UNIT_WIN,
+ x, y, unit_owner(punit), E_UNIT_WIN,
_("Game: %s's %s was nuked."),
unit_owner(punit)->name,
unit_name(punit->type));
@@ -2053,14 +2055,14 @@
if (pcity) {
notify_player_ex(city_owner(pcity),
- x, y, E_CITY_NUKED,
+ x, y, pplayer, E_CITY_NUKED,
_("Game: %s was nuked by %s."),
pcity->name,
pplayer == city_owner(pcity) ? _("yourself") :
pplayer->name);
if (city_owner(pcity) != pplayer) {
notify_player_ex(pplayer,
- x, y, E_CITY_NUKED,
+ x, y, city_owner(pcity), E_CITY_NUKED,
_("Game: You nuked %s."),
pcity->name);
}
@@ -2097,7 +2099,7 @@
do_nuke_tile(pplayer, x1, y1);
} square_iterate_end;
- notify_conn_ex(&game.game_connections, x, y, E_NUKE,
+ notify_conn_ex(&game.game_connections, x, y, pplayer, E_NUKE,
_("Game: %s detonated a nuke!"), pplayer->name);
}
@@ -2135,7 +2137,7 @@
city1->airlift = FALSE;
city2->airlift = FALSE;
- notify_player_ex(unit_owner(punit), city2->x, city2->y, E_NOEVENT,
+ notify_player_ex(unit_owner(punit), city2->x, city2->y, NULL, E_NOEVENT,
_("Game: %s transported succesfully."),
unit_name(punit->type));
@@ -2159,7 +2161,7 @@
struct player *pplayer = unit_owner(punit);
if (!unit_flag(punit, F_PARATROOPERS)) {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: This unit type can not be paradropped."));
return FALSE;
}
@@ -2169,14 +2171,14 @@
}
if (!map_is_known(dest_x, dest_y, pplayer)) {
- notify_player_ex(pplayer, dest_x, dest_y, E_NOEVENT,
+ notify_player_ex(pplayer, dest_x, dest_y, NULL, E_NOEVENT,
_("Game: The destination location is not known."));
return FALSE;
}
if (is_ocean(map_get_player_tile(dest_x, dest_y, pplayer)->terrain)
&& is_ground_unit(punit)) {
- notify_player_ex(pplayer, dest_x, dest_y, E_NOEVENT,
+ notify_player_ex(pplayer, dest_x, dest_y, NULL, E_NOEVENT,
_("Game: This unit cannot paradrop into ocean."));
return FALSE;
}
@@ -2185,7 +2187,8 @@
&& ((ptile->city
&& pplayers_non_attack(pplayer, city_owner(ptile->city)))
|| is_non_attack_unit_tile(ptile, pplayer))) {
- notify_player_ex(pplayer, dest_x, dest_y, E_NOEVENT,
+ /* TODO: determine target player properly. */
+ notify_player_ex(pplayer, dest_x, dest_y, NULL, E_NOEVENT,
_("Game: Cannot attack unless you declare war first."));
return FALSE;
}
@@ -2194,7 +2197,7 @@
int range = unit_type(punit)->paratroopers_range;
int distance = real_map_distance(punit->x, punit->y, dest_x, dest_y);
if (distance > range) {
- notify_player_ex(pplayer, dest_x, dest_y, E_NOEVENT,
+ notify_player_ex(pplayer, dest_x, dest_y, NULL, E_NOEVENT,
_("Game: The distance to the target (%i) "
"is greater than the unit's range (%i)."),
distance, range);
@@ -2208,7 +2211,7 @@
show_area(pplayer, dest_x, dest_y, srange);
- notify_player_ex(pplayer, dest_x, dest_y, E_UNIT_LOST,
+ notify_player_ex(pplayer, dest_x, dest_y, NULL, E_UNIT_LOST,
_("Game: Your %s paradropped into the ocean "
"and was lost."),
unit_type(punit)->name);
@@ -2221,7 +2224,8 @@
int srange = unit_type(punit)->vision_range;
show_area(pplayer, dest_x, dest_y, srange);
maybe_make_contact(dest_x, dest_y, pplayer);
- notify_player_ex(pplayer, dest_x, dest_y, E_UNIT_LOST_ATT,
+ /* TODO: determine target player properly. */
+ notify_player_ex(pplayer, dest_x, dest_y, NULL, E_UNIT_LOST_ATT,
_("Game: Your %s was killed by enemy units at the "
"paradrop destination."),
unit_type(punit)->name);
@@ -2243,7 +2247,7 @@
static void hut_get_gold(struct unit *punit, int cred)
{
struct player *pplayer = unit_owner(punit);
- notify_player_ex(pplayer, punit->x, punit->y, E_HUT_GOLD,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_HUT_GOLD,
_("Game: You found %d gold."), cred);
pplayer->economic.gold += cred;
}
@@ -2269,7 +2273,7 @@
pplayer->research.researching = res_ing;
tech_name = get_tech_name(pplayer, new_tech);
- notify_player_ex(pplayer, punit->x, punit->y, E_HUT_TECH,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_HUT_TECH,
_("Game: You found %s in ancient scrolls of wisdom."),
tech_name);
gamelog(GAMELOG_TECH, _("%s discover %s (Hut)"),
@@ -2293,7 +2297,7 @@
{
struct player *pplayer = unit_owner(punit);
- notify_player_ex(pplayer, punit->x, punit->y, E_HUT_MERC,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_HUT_MERC,
_("Game: A band of friendly mercenaries joins your cause."));
(void) create_unit(pplayer, punit->x, punit->y,
find_a_unit_type(L_HUT, L_HUT_TECH), FALSE,
@@ -2311,7 +2315,7 @@
if (city_exists_within_city_radius(punit->x, punit->y, TRUE)
|| unit_flag(punit, F_GAMELOSS)) {
- notify_player_ex(pplayer, punit->x, punit->y, E_HUT_BARB_CITY_NEAR,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_HUT_BARB_CITY_NEAR,
_("Game: An abandoned village is here."));
} else {
/* save coords and type in case unit dies */
@@ -2322,10 +2326,10 @@
ok = unleash_barbarians(punit_x, punit_y);
if (ok) {
- notify_player_ex(pplayer, punit_x, punit_y, E_HUT_BARB,
+ notify_player_ex(pplayer, punit_x, punit_y, NULL, E_HUT_BARB,
_("Game: You have unleashed a horde of barbarians!"));
} else {
- notify_player_ex(pplayer, punit_x, punit_y, E_HUT_BARB_KILLED,
+ notify_player_ex(pplayer, punit_x, punit_y, NULL, E_HUT_BARB_KILLED,
_("Game: Your %s has been killed by barbarians!"),
unit_name(type));
}
@@ -2341,12 +2345,12 @@
struct player *pplayer = unit_owner(punit);
if (city_can_be_built_here(punit->x, punit->y, NULL)) {
- notify_player_ex(pplayer, punit->x, punit->y, E_HUT_CITY,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_HUT_CITY,
_("Game: You found a friendly city."));
create_city(pplayer, punit->x, punit->y,
city_name_suggestion(pplayer, punit->x, punit->y));
} else {
- notify_player_ex(pplayer, punit->x, punit->y, E_HUT_SETTLER,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_HUT_SETTLER,
_("Game: Friendly nomads are impressed by you,"
" and join you."));
(void) create_unit(pplayer, punit->x, punit->y, get_role_unit(F_CITIES,0),
@@ -2371,7 +2375,7 @@
send_tile_info(NULL, punit->x, punit->y);
if (game.rgame.hut_overflight==OVERFLIGHT_FRIGHTEN && is_air_unit(punit)) {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: Your overflight frightens the tribe;"
" they scatter in terror."));
return ok;
@@ -3078,7 +3082,7 @@
if (is_non_allied_unit_tile(ptile, pplayer)
|| is_non_allied_city_tile(ptile, pplayer)) {
- notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ notify_player_ex(pplayer, punit->x, punit->y, NULL, E_NOEVENT,
_("Game: %s aborted GOTO "
"as there are units in the way."),
unit_type(punit)->name);
@@ -3115,7 +3119,8 @@
if (cancel) {
handle_unit_activity_request(punit, ACTIVITY_IDLE);
- notify_player_ex(unit_owner(punit), punit->x, punit->y, E_NOEVENT,
+ /* TODO: determine target player properly. */
+ notify_player_ex(unit_owner(punit), punit->x, punit->y, NULL, E_NOEVENT,
_("Game: Your %s cancelled patrol order because it "
"encountered a foreign unit."), unit_name(punit->type));
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] associate a player with events (PR#6523),
Jason Short <=
|
|