[Freeciv-Dev] (PR#13753) RFC: death to E_NOEVENT
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13753 >
Here's the next patch:
This one removes notify_player. Most users are changed to use
notify_player_ex, with an event and (optional) tile. A few users are
switched over to notify_conn (which postpones the issue since
notify_conn has the same event-type problem).
Actually notify_player is just #defined to notify_player_ex. The next
step is to rename notify_player_ex as notify_player to simplify the naming.
-jason
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.343
diff -p -u -r1.343 citytools.c
--- server/citytools.c 25 Aug 2005 19:12:23 -0000 1.343
+++ server/citytools.c 25 Aug 2005 20:07:04 -0000
@@ -507,7 +507,8 @@ static void transfer_unit(struct unit *p
freelog(LOG_VERBOSE, "Changed homecity of %s's %s to %s",
from_player->name, unit_name(punit->type), tocity->name);
if (verbose) {
- notify_player(from_player, _("Changed homecity of %s to %s."),
+ notify_player(from_player, punit->tile, E_UNIT_RELOCATED,
+ _("Changed homecity of %s to %s."),
unit_name(punit->type), tocity->name);
}
} else {
@@ -517,7 +518,8 @@ static void transfer_unit(struct unit *p
unit_name(punit->type), in_city->name,
from_player->name, to_player->name);
if (verbose) {
- notify_player(from_player, _("Transfered %s in %s from %s to %s."),
+ notify_player(from_player, punit->tile, E_UNIT_RELOCATED,
+ _("Transfered %s in %s from %s to %s."),
unit_name(punit->type), in_city->name,
from_player->name, to_player->name);
}
@@ -526,7 +528,8 @@ static void transfer_unit(struct unit *p
unit_name(punit->type),
from_player->name, to_player->name);
if (verbose) {
- notify_player(from_player, _("Transfered %s from %s to %s."),
+ notify_player(from_player, punit->tile, E_UNIT_RELOCATED,
+ _("Transfered %s from %s to %s."),
unit_name(punit->type),
from_player->name, to_player->name);
}
@@ -535,8 +538,9 @@ static void transfer_unit(struct unit *p
unit_name(punit->type),
from_player->name, to_player->name);
if (verbose) {
- notify_player(from_player, _("%s from %s lost in transfer "
- "to %s's %s"), unit_name(punit->type),
+ notify_player(from_player, punit->tile, E_UNIT_LOST,
+ _("%s from %s lost in transfer to %s's %s"),
+ unit_name(punit->type),
from_player->name, to_player->name, tocity->name);
}
wipe_unit(punit);
@@ -733,7 +737,8 @@ static void build_free_small_wonders(str
*/
send_player_cities(pplayer);
- notify_player(pplayer, _("You lost %s. A new %s was built in %s."),
+ notify_player(pplayer, pnew_city->tile, E_CITY_LOST,
+ _("You lost %s. A new %s was built in %s."),
old_capital_name, get_improvement_name(id),
pnew_city->name);
/*
@@ -888,7 +893,7 @@ void transfer_city(struct player *ptaker
if (terrain_control.may_road
&& player_knows_techs_with_flag (ptaker, TF_RAILROAD)
&& !tile_has_special(pcity->tile, S_RAILROAD)) {
- notify_player(ptaker,
+ notify_player(ptaker, pcity->tile, E_CITY_TRANSFER,
_("The people in %s are stunned by your"
" technological insight!\n"
" Workers spontaneously gather and upgrade"
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.331
diff -p -u -r1.331 cityturn.c
--- server/cityturn.c 18 Aug 2005 06:44:28 -0000 1.331
+++ server/cityturn.c 25 Aug 2005 20:07:05 -0000
@@ -1124,11 +1124,10 @@ static bool city_build_building(struct p
if ((mod = get_current_construction_bonus(pcity, EFT_GIVE_IMM_TECH))) {
int i;
- notify_player(pplayer, PL_("%s boosts research; "
- "you gain %d immediate advance.",
- "%s boosts research; "
- "you gain %d immediate advances.",
- mod),
+ notify_player(pplayer, NULL, E_TECH_GAIN,
+ PL_("%s boosts research; you gain %d immediate advance.",
+ "%s boosts research; you gain %d immediate advances.",
+ mod),
get_improvement_name(id), mod);
for (i = 0; i < mod; i++) {
Index: server/diplhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/diplhand.c,v
retrieving revision 1.101
diff -p -u -r1.101 diplhand.c
--- server/diplhand.c 22 Aug 2005 21:15:48 -0000 1.101
+++ server/diplhand.c 25 Aug 2005 20:07:05 -0000
@@ -141,7 +141,7 @@ void handle_diplomacy_accept_treaty_req(
freelog(LOG_ERROR, "Treaty: The %s can't have tech %s",
get_nation_name_plural(pother->nation),
get_tech_name(pplayer, pclause->value));
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_DIPLOMACY,
_("The %s can't accept %s."),
get_nation_name_plural(pother->nation),
get_tech_name(pplayer, pclause->value));
@@ -153,7 +153,7 @@ void handle_diplomacy_accept_treaty_req(
get_nation_name_plural(pplayer->nation),
get_tech_name(pplayer, pclause->value),
get_nation_name_plural(pother->nation));
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_DIPLOMACY,
_("You don't have tech %s, you can't accept treaty."),
get_tech_name(pplayer, pclause->value));
return;
@@ -162,19 +162,19 @@ void handle_diplomacy_accept_treaty_req(
case CLAUSE_CITY:
pcity = find_city_by_id(pclause->value);
if (!pcity) { /* Can't find out cityname any more. */
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_DIPLOMACY,
_("City you are trying to give no longer exists, "
"you can't accept treaty."));
return;
}
if (pcity->owner != pplayer) {
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_DIPLOMACY,
_("You are not owner of %s, you can't accept
treaty."),
pcity->name);
return;
}
if (is_capital(pcity)) {
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_DIPLOMACY,
_("Your capital (%s) is requested, "
"you can't accept treaty."),
pcity->name);
@@ -183,14 +183,14 @@ void handle_diplomacy_accept_treaty_req(
break;
case CLAUSE_ALLIANCE:
if (!pplayer_can_ally(pplayer, pother)) {
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_DIPLOMACY,
_("You are at war with one of %s's "
"allies - an alliance with %s is impossible."),
pother->name, pother->name);
return;
}
if (!pplayer_can_ally(pother, pplayer)) {
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_DIPLOMACY,
_("%s is at war with one of your allies "
"- an alliance with %s is impossible."),
pother->name, pother->name);
@@ -199,7 +199,7 @@ void handle_diplomacy_accept_treaty_req(
break;
case CLAUSE_GOLD:
if (pplayer->economic.gold < pclause->value) {
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_DIPLOMACY,
_("You don't have enough gold, "
"you can't accept treaty."));
return;
@@ -231,12 +231,12 @@ void handle_diplomacy_accept_treaty_req(
pplayer->player_no,
pplayer->player_no);
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_DIPLOMACY,
PL_("A treaty containing %d clause was agreed upon.",
"A treaty containing %d clauses was agreed upon.",
nclauses),
nclauses);
- notify_player(pother,
+ notify_player(pother, NULL, E_DIPLOMACY,
PL_("A treaty containing %d clause was agreed upon.",
"A treaty containing %d clauses was agreed upon.",
nclauses),
@@ -252,23 +252,23 @@ void handle_diplomacy_accept_treaty_req(
case CLAUSE_CITY:
pcity = find_city_by_id(pclause->value);
if (!pcity) { /* Can't find out cityname any more. */
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_DIPLOMACY,
_("One of the cities %s is giving away is destroyed! "
"Treaty canceled!"),
get_nation_name_plural(pother->nation));
- notify_player(pother,
+ notify_player(pother, NULL, E_DIPLOMACY,
_("One of the cities %s is giving away is destroyed! "
"Treaty canceled!"),
get_nation_name_plural(pother->nation));
goto cleanup;
}
if (pcity->owner != pother) {
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_DIPLOMACY,
_("The %s no longer control %s! "
"Treaty canceled!"),
get_nation_name_plural(pother->nation),
pcity->name);
- notify_player(pother,
+ notify_player(pother, NULL, E_DIPLOMACY,
_("The %s no longer control %s! "
"Treaty canceled!"),
get_nation_name_plural(pother->nation),
@@ -276,7 +276,7 @@ void handle_diplomacy_accept_treaty_req(
goto cleanup;
}
if (is_capital(pcity)) {
- notify_player(pother,
+ notify_player(pother, NULL, E_DIPLOMACY,
_("Your capital (%s) is requested, "
"you can't accept treaty."), pcity->name);
goto cleanup;
@@ -287,11 +287,11 @@ void handle_diplomacy_accept_treaty_req(
/* We need to recheck this way since things might have
* changed. */
if (!pplayer_can_ally(pother, pplayer)) {
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_DIPLOMACY,
_("%s is at war with one of your "
"allies - an alliance with %s is impossible."),
pother->name, pother->name);
- notify_player(pother,
+ notify_player(pother, NULL, E_DIPLOMACY,
_("You are at war with one of %s's "
"allies - an alliance with %s is impossible."),
pplayer->name, pplayer->name);
@@ -300,11 +300,11 @@ void handle_diplomacy_accept_treaty_req(
break;
case CLAUSE_GOLD:
if (pother->economic.gold < pclause->value) {
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_DIPLOMACY,
_("The %s don't have the promised amount "
"of gold! Treaty canceled!"),
get_nation_name_plural(pother->nation));
- notify_player(pother,
+ notify_player(pother, NULL, E_DIPLOMACY,
_("The %s don't have the promised amount "
"of gold! Treaty canceled!"),
get_nation_name_plural(pother->nation));
@@ -374,20 +374,23 @@ void handle_diplomacy_accept_treaty_req(
found_new_tech(pdest, pclause->value, FALSE, TRUE);
break;
case CLAUSE_GOLD:
- notify_player(pdest, _("You get %d gold."), pclause->value);
+ notify_player(pdest, NULL, E_DIPLOMACY,
+ _("You get %d gold."), pclause->value);
pgiver->economic.gold -= pclause->value;
pdest->economic.gold += pclause->value;
gamelog(GAMELOG_TREATY, GL_GOLD, pgiver, pdest);
break;
case CLAUSE_MAP:
give_map_from_player_to_player(pgiver, pdest);
- notify_player(pdest, _("You receive %s's worldmap."),
+ notify_player(pdest, NULL, E_DIPLOMACY,
+ _("You receive %s's worldmap."),
pgiver->name);
gamelog(GAMELOG_TREATY, GL_MAP, pgiver, pdest);
break;
case CLAUSE_SEAMAP:
give_seamap_from_player_to_player(pgiver, pdest);
- notify_player(pdest, _("You receive %s's seamap."),
+ notify_player(pdest, NULL, E_DIPLOMACY,
+ _("You receive %s's seamap."),
pgiver->name);
gamelog(GAMELOG_TREATY, GL_SEAMAP, pgiver, pdest);
break;
@@ -615,13 +618,15 @@ static void really_diplomacy_cancel_meet
dlsend_packet_diplomacy_cancel_meeting(pother->connections,
pplayer->player_no,
pplayer->player_no);
- notify_player(pother, _("%s canceled the meeting!"),
+ notify_player(pother, NULL, E_DIPLOMACY,
+ _("%s canceled the meeting!"),
pplayer->name);
/* Need to send to pplayer too, for multi-connects: */
dlsend_packet_diplomacy_cancel_meeting(pplayer->connections,
pother->player_no,
pplayer->player_no);
- notify_player(pplayer, _("Meeting with %s canceled."),
+ notify_player(pplayer, NULL, E_DIPLOMACY,
+ _("Meeting with %s canceled."),
pother->name);
treaty_list_unlink(treaties, ptreaty);
clear_treaty(ptreaty);
@@ -662,7 +667,8 @@ void handle_diplomacy_init_meeting_req(s
if (get_player_bonus(pplayer, EFT_NO_DIPLOMACY)
|| get_player_bonus(pother, EFT_NO_DIPLOMACY)) {
- notify_player(pplayer, _("Your diplomatic envoy was decapitated!"));
+ notify_player(pplayer, NULL, E_DIPLOMACY,
+ _("Your diplomatic envoy was decapitated!"));
return;
}
Index: server/gamehand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamehand.c,v
retrieving revision 1.166
diff -p -u -r1.166 gamehand.c
--- server/gamehand.c 25 Aug 2005 19:12:23 -0000 1.166
+++ server/gamehand.c 25 Aug 2005 20:07:05 -0000
@@ -132,8 +132,9 @@ static void place_starting_unit(struct t
if (utype->move_type == SEA_MOVING) {
freelog(LOG_ERROR, _("Sea moving start units are not yet supported, "
"%s not created."), utype->name);
- notify_player(pplayer, _("Sea moving start units are not yet supported. "
- "Nobody gets %s."), utype->name);
+ notify_player(pplayer, NULL, E_BAD_COMMAND,
+ _("Sea moving start units are not yet supported. "
+ "Nobody gets %s."), utype->name);
return;
}
Index: server/maphand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/maphand.c,v
retrieving revision 1.173
diff -p -u -r1.173 maphand.c
--- server/maphand.c 23 Aug 2005 00:09:41 -0000 1.173
+++ server/maphand.c 25 Aug 2005 20:07:05 -0000
@@ -248,8 +248,9 @@ void global_warming(int effect)
notify_player_ex(NULL, NULL, E_GLOBAL_ECO,
_("Global warming has occurred!"));
- notify_player(NULL, _("Coastlines have been flooded and vast "
- "ranges of grassland have become deserts."));
+ notify_player(NULL, NULL, E_GLOBAL_ECO,
+ _("Coastlines have been flooded and vast "
+ "ranges of grassland have become deserts."));
}
/**************************************************************************
@@ -291,8 +292,9 @@ void nuclear_winter(int effect)
notify_player_ex(NULL, NULL, E_GLOBAL_ECO,
_("Nuclear winter has occurred!"));
- notify_player(NULL, _("Wetlands have dried up and vast "
- "ranges of grassland have become tundra."));
+ notify_player(NULL, NULL, E_GLOBAL_ECO,
+ _("Wetlands have dried up and vast "
+ "ranges of grassland have become tundra."));
}
/***************************************************************
@@ -311,13 +313,13 @@ void upgrade_city_rails(struct player *p
conn_list_do_buffer(pplayer->connections);
if (discovery) {
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_TECH_GAIN,
_("New hope sweeps like fire through the country as "
"the discovery of railroad is announced.\n"
" Workers spontaneously gather and upgrade all "
"cities with railroads."));
} else {
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_TECH_GAIN,
_("The people are pleased to hear that your "
"scientists finally know about railroads.\n"
" Workers spontaneously gather and upgrade all "
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.415
diff -p -u -r1.415 plrhand.c
--- server/plrhand.c 25 Aug 2005 19:15:50 -0000 1.415
+++ server/plrhand.c 25 Aug 2005 20:07:06 -0000
@@ -196,7 +196,7 @@ void handle_player_rates(struct player *
if (server_state != RUN_GAME_STATE) {
freelog(LOG_ERROR, "received player_rates packet from %s before start",
pplayer->name);
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_BAD_COMMAND,
_("Cannot change rates before game start."));
return;
}
@@ -220,7 +220,8 @@ void handle_player_rates(struct player *
rtype = _("Science");
}
- notify_player(pplayer, _("%s rate exceeds the max rate for %s."),
+ notify_player(pplayer, NULL, E_BAD_COMMAND,
+ _("%s rate exceeds the max rate for %s."),
rtype, get_government_name(pplayer->government));
} else {
pplayer->economic.tax = tax;
@@ -440,19 +441,19 @@ void check_player_government_rates(struc
player_limit_to_government_rates(pplayer);
if (pplayer->economic.tax != old_econ.tax) {
changed = TRUE;
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_NEW_GOVERNMENT,
_("Tax rate exceeded the max rate for %s; adjusted."),
get_government_name(pplayer->government));
}
if (pplayer->economic.science != old_econ.science) {
changed = TRUE;
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_NEW_GOVERNMENT,
_("Science rate exceeded the max rate for %s; adjusted."),
get_government_name(pplayer->government));
}
if (pplayer->economic.luxury != old_econ.luxury) {
changed = TRUE;
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_NEW_GOVERNMENT,
_("Luxury rate exceeded the max rate for %s; adjusted."),
get_government_name(pplayer->government));
}
@@ -763,19 +764,6 @@ void notify_player_ex(const struct playe
}
/**************************************************************************
- Just like notify_player_ex, but no (x,y) nor event type.
-**************************************************************************/
-void notify_player(const struct player *pplayer, const char *format, ...)
-{
- struct conn_list *dest = pplayer ? pplayer->connections : NULL;
- va_list args;
-
- va_start(args, format);
- vnotify_conn_ex(dest, NULL, E_NOEVENT, format, args);
- va_end(args);
-}
-
-/**************************************************************************
Send message to all players who have an embassy with pplayer,
but excluding pplayer and specified player.
**************************************************************************/
@@ -1121,7 +1109,8 @@ void server_remove_player(struct player
}
freelog(LOG_NORMAL, _("Removing player %s."), pplayer->name);
- notify_player(pplayer, _("You've been removed from the game!"));
+ notify_conn(pplayer->connections,
+ _("You've been removed from the game!"));
notify_conn(game.est_connections,
_("%s has been removed from the game."), pplayer->name);
@@ -1422,15 +1411,17 @@ struct player *create_global_observer(vo
* a slot available to create one. Observers are taken from the slots of
* normal civs (barbarians are reserved separately). */
if (game.info.nplayers - game.info.nbarbarians >= MAX_NUM_PLAYERS) {
- notify_player(NULL, _("A global observer cannot be created: too "
- "many regular players."));
+ notify_conn(NULL,
+ _("A global observer cannot be created: too "
+ "many regular players."));
return NULL;
}
nation = pick_observer_nation();
if (nation == NO_NATION_SELECTED) {
- notify_player(NULL, _("A global observer cannot be created: there's "
- "no observer nation in the ruleset."));
+ notify_conn(NULL,
+ _("A global observer cannot be created: there's "
+ "no observer nation in the ruleset."));
return NULL;
}
@@ -1470,7 +1461,8 @@ struct player *create_global_observer(vo
/* tell everyone that game.info.nplayers has been updated */
send_game_info(NULL);
send_player_info(pplayer, NULL);
- notify_player(NULL, _("A global observer has been created"));
+ notify_conn(NULL,
+ _("A global observer has been created"));
return pplayer;
}
@@ -1764,7 +1756,7 @@ void civil_war(struct player *pplayer)
resolve_unit_stacks(pplayer, cplayer, FALSE);
- notify_player(NULL,
+ notify_player(NULL, NULL, E_CIVIL_WAR,
_("The capture of %s's capital and the destruction "
"of the empire's administrative\n"
" structures have sparked a civil war. "
Index: server/plrhand.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.h,v
retrieving revision 1.80
diff -p -u -r1.80 plrhand.h
--- server/plrhand.h 18 Jul 2005 22:46:29 -0000 1.80
+++ server/plrhand.h 25 Aug 2005 20:07:06 -0000
@@ -57,8 +57,7 @@ void notify_conn(struct conn_list *dest,
void notify_player_ex(const struct player *pplayer, struct tile *ptile,
enum event_type event, const char *format, ...)
fc__attribute((format (printf, 4, 5)));
-void notify_player(const struct player *pplayer, const char *format, ...)
- fc__attribute((format (printf, 2, 3)));
+#define notify_player notify_player_ex
void notify_embassies(struct player *pplayer, struct player *exclude,
const char *format, ...)
fc__attribute((format (printf, 3, 4)));
Index: server/spacerace.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/spacerace.c,v
retrieving revision 1.41
diff -p -u -r1.41 spacerace.c
--- server/spacerace.c 5 May 2005 18:32:53 -0000 1.41
+++ server/spacerace.c 25 Aug 2005 20:07:06 -0000
@@ -162,18 +162,20 @@ void handle_spaceship_launch(struct play
int arrival;
if (!find_palace(pplayer)) {
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_SPACESHIP,
_("You need to have a capital in order to launch "
"your spaceship."));
return;
}
if (ship->state >= SSHIP_LAUNCHED) {
- notify_player(pplayer, _("Your spaceship is already launched!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("Your spaceship is already launched!"));
return;
}
if (ship->state != SSHIP_STARTED
|| ship->success_rate == 0.0) {
- notify_player(pplayer, _("Your spaceship can't be launched yet!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("Your spaceship can't be launched yet!"));
return;
}
@@ -199,13 +201,14 @@ void handle_spaceship_place(struct playe
struct player_spaceship *ship = &pplayer->spaceship;
if (ship->state == SSHIP_NONE) {
- notify_player(pplayer, _("Spaceship action received,"
- " but you don't have a spaceship!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("Spaceship action received,"
+ " but you don't have a spaceship!"));
return;
}
if (ship->state >= SSHIP_LAUNCHED) {
- notify_player(pplayer, _("You can't modify your"
- " spaceship after launch!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("You can't modify your spaceship after launch!"));
return;
}
if (type == SSHIP_PLACE_STRUCTURAL) {
@@ -213,13 +216,14 @@ void handle_spaceship_place(struct playe
return;
}
if (num_spaceship_structurals_placed(ship) >= ship->structurals) {
- notify_player(pplayer, _("You don't have any unplaced"
- " Space Structurals!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("You don't have any unplaced Space Structurals!"));
return;
}
if (num!=0 && !ship->structure[structurals_info[num].required]) {
- notify_player(pplayer, _("That Space Structural"
- " would not be connected!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("That Space Structural"
+ " would not be connected!"));
return;
}
ship->structure[num] = TRUE;
@@ -232,13 +236,15 @@ void handle_spaceship_place(struct playe
return;
}
if (ship->fuel + ship->propulsion >= ship->components) {
- notify_player(pplayer, _("You don't have any unplaced"
- " Space Components!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("You don't have any unplaced"
+ " Space Components!"));
return;
}
if (num > NUM_SS_COMPONENTS/2) {
- notify_player(pplayer, _("Your spaceship already has"
- " the maximum number of Fuel Components!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("Your spaceship already has"
+ " the maximum number of Fuel Components!"));
return;
}
ship->fuel++;
@@ -251,13 +257,15 @@ void handle_spaceship_place(struct playe
return;
}
if (ship->fuel + ship->propulsion >= ship->components) {
- notify_player(pplayer, _("You don't have any unplaced"
- " Space Components!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("You don't have any unplaced"
+ " Space Components!"));
return;
}
if (num > NUM_SS_COMPONENTS/2) {
- notify_player(pplayer, _("Your spaceship already has the"
- " maximum number of Propulsion Components!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("Your spaceship already has the"
+ " maximum number of Propulsion Components!"));
return;
}
ship->propulsion++;
@@ -271,13 +279,15 @@ void handle_spaceship_place(struct playe
}
if (ship->habitation + ship->life_support + ship->solar_panels
>= ship->modules) {
- notify_player(pplayer, _("You don't have any unplaced"
- " Space Modules!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("You don't have any unplaced"
+ " Space Modules!"));
return;
}
if (num > NUM_SS_MODULES/3) {
- notify_player(pplayer, _("Your spaceship already has the"
- " maximum number of Habitation Modules!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("Your spaceship already has the"
+ " maximum number of Habitation Modules!"));
return;
}
ship->habitation++;
@@ -291,13 +301,15 @@ void handle_spaceship_place(struct playe
}
if (ship->habitation + ship->life_support + ship->solar_panels
>= ship->modules) {
- notify_player(pplayer, _("You don't have any unplaced"
- " Space Modules!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("You don't have any unplaced"
+ " Space Modules!"));
return;
}
if (num > NUM_SS_MODULES/3) {
- notify_player(pplayer, _("Your spaceship already has the"
- " maximum number of Life Support Modules!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("Your spaceship already has the"
+ " maximum number of Life Support Modules!"));
return;
}
ship->life_support++;
@@ -311,13 +323,15 @@ void handle_spaceship_place(struct playe
}
if (ship->habitation + ship->life_support + ship->solar_panels
>= ship->modules) {
- notify_player(pplayer, _("You don't have any unplaced"
- " Space Modules!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("You don't have any unplaced"
+ " Space Modules!"));
return;
}
if (num > NUM_SS_MODULES/3) {
- notify_player(pplayer, _("Your spaceship already has the"
- " maximum number of Solar Panel Modules!"));
+ notify_player(pplayer, NULL, E_SPACESHIP,
+ _("Your spaceship already has the"
+ " maximum number of Solar Panel Modules!"));
return;
}
ship->solar_panels++;
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.287
diff -p -u -r1.287 srv_main.c
--- server/srv_main.c 18 Aug 2005 06:53:31 -0000 1.287
+++ server/srv_main.c 25 Aug 2005 20:07:06 -0000
@@ -421,13 +421,13 @@ static void update_diplomatics(void)
if(pdiplstate->type == DS_CEASEFIRE) {
switch(--pdiplstate->turns_left) {
case 1:
- notify_player(player1,
+ notify_player(player1, NULL, E_DIPLOMACY,
_("Concerned citizens point "
"out that the cease-fire with %s will run out soon."),
player2->name);
break;
case 0:
- notify_player(player1,
+ notify_player(player1, NULL, E_DIPLOMACY,
_("The cease-fire with %s has "
"run out. You are now neutral towards the %s."),
player2->name,
@@ -1341,11 +1341,11 @@ void handle_player_ready(struct player *
}
} players_iterate_end;
if (num_unready > 0) {
- notify_player(NULL, _("Waiting to start game: %d out of %d players "
- "are ready to start."),
- num_ready, num_ready + num_unready);
+ notify_conn(NULL, _("Waiting to start game: %d out of %d players "
+ "are ready to start."),
+ num_ready, num_ready + num_unready);
} else {
- notify_player(NULL, _("All players are ready; starting game."));
+ notify_conn(NULL, _("All players are ready; starting game."));
start_game();
}
}
@@ -1402,10 +1402,10 @@ void aifill(int amount)
_("%s has been added as %s level AI-controlled player."),
pplayer->name,
name_of_skill_level(pplayer->ai.skill_level));
- notify_player(NULL,
- _("%s has been added as %s level AI-controlled player."),
- pplayer->name,
- name_of_skill_level(pplayer->ai.skill_level));
+ notify_conn(NULL,
+ _("%s has been added as %s level AI-controlled player."),
+ pplayer->name,
+ name_of_skill_level(pplayer->ai.skill_level));
game.info.nplayers++;
@@ -1546,7 +1546,7 @@ static void announce_player (struct play
get_nation_name_plural(pplayer->nation));
players_iterate(other_player) {
- notify_player(other_player,
+ notify_player(other_player, NULL, E_GAME_START,
_("%s rules the %s."), pplayer->name,
get_nation_name_plural(pplayer->nation));
} players_iterate_end;
@@ -1720,7 +1720,7 @@ void srv_main(void)
send_game_state(game.game_connections, CLIENT_GAME_OVER_STATE);
report_final_scores();
show_map_to_all();
- notify_player(NULL, _("The game is over..."));
+ notify_player(NULL, NULL, E_GAME_END, _("The game is over..."));
gamelog(GAMELOG_JUDGE, GL_NONE);
send_server_info_to_metaserver(META_INFO);
if (game.info.save_nturns > 0
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.431
diff -p -u -r1.431 stdinhand.c
--- server/stdinhand.c 18 Aug 2005 06:53:31 -0000 1.431
+++ server/stdinhand.c 25 Aug 2005 20:07:07 -0000
@@ -233,14 +233,16 @@ static void check_vote(struct voting *vo
}
if (vote->yes > num_voters / 2) {
/* Do it! */
- notify_player(NULL, _("Vote \"%s\" is passed %d to %d with %d "
- "abstentions."), vote->command, vote->yes, vote->no,
- num_voters - vote->yes - vote->no);
+ notify_conn(NULL, _("Vote \"%s\" is passed %d to %d with %d "
+ "abstentions."),
+ vote->command, vote->yes, vote->no,
+ num_voters - vote->yes - vote->no);
handle_stdin_input((struct connection *)NULL, vote->command, FALSE);
} else {
- notify_player(NULL, _("Vote \"%s\" failed with %d against, %d for "
- "and %d abstentions."), vote->command, vote->no,
vote->yes,
- num_voters - vote->yes - vote->no);
+ notify_conn(NULL, _("Vote \"%s\" failed with %d against, %d for "
+ "and %d abstentions."),
+ vote->command, vote->no, vote->yes,
+ num_voters - vote->yes - vote->no);
}
vote->command[0] = '\0';
}
@@ -360,12 +362,12 @@ static void cmd_reply_line(enum command_
}
if (rfc_status == C_OK) {
- players_iterate(pplayer) {
+ conn_list_iterate(game.est_connections, pconn) {
/* Do not tell caller, since he was told above! */
- if (!(caller && caller->player && caller->player == pplayer)) {
- notify_player(pplayer, _("%s"), line);
+ if (caller != pconn) {
+ notify_conn(pconn->self, "%s", line);
}
- } players_iterate_end;
+ } conn_list_iterate_end;
}
}
@@ -501,8 +503,8 @@ static void open_metaserver_connection(s
{
server_open_meta();
if (send_server_info_to_metaserver(META_INFO)) {
- notify_player(NULL, _("Open metaserver connection to [%s]."),
- meta_addr_port());
+ notify_conn(NULL, _("Open metaserver connection to [%s]."),
+ meta_addr_port());
}
}
@@ -513,8 +515,8 @@ static void close_metaserver_connection(
{
if (send_server_info_to_metaserver(META_GOODBYE)) {
server_close_meta();
- notify_player(NULL, _("Close metaserver connection to [%s]."),
- meta_addr_port());
+ notify_conn(NULL, _("Close metaserver connection to [%s]."),
+ meta_addr_port());
}
}
@@ -577,10 +579,10 @@ static bool metapatches_command(struct c
if (is_metaserver_open()) {
send_server_info_to_metaserver(META_INFO);
- notify_player(NULL, _("Metaserver patches string set to '%s'."), arg);
+ notify_conn(NULL, _("Metaserver patches string set to '%s'."), arg);
} else {
- notify_player(NULL, _("Metaserver patches string set to '%s', "
- "not reporting to metaserver."), arg);
+ notify_conn(NULL, _("Metaserver patches string set to '%s', "
+ "not reporting to metaserver."), arg);
}
return TRUE;
@@ -598,9 +600,9 @@ static bool metatopic_command(struct con
set_meta_topic_string(arg);
if (is_metaserver_open()) {
send_server_info_to_metaserver(META_INFO);
- notify_player(NULL, _("Metaserver topic string set to '%s'."), arg);
+ notify_conn(NULL, _("Metaserver topic string set to '%s'."), arg);
} else {
- notify_player(NULL, _("Metaserver topic string set to '%s', "
+ notify_conn(NULL, _("Metaserver topic string set to '%s', "
"not reporting to metaserver."), arg);
}
@@ -620,10 +622,10 @@ static bool metamessage_command(struct c
set_meta_message_string(arg);
if (is_metaserver_open()) {
send_server_info_to_metaserver(META_INFO);
- notify_player(NULL, _("Metaserver message string set to '%s'."), arg);
+ notify_conn(NULL, _("Metaserver message string set to '%s'."), arg);
} else {
- notify_player(NULL, _("Metaserver message string set to '%s', "
- "not reporting to metaserver."), arg);
+ notify_conn(NULL, _("Metaserver message string set to '%s', "
+ "not reporting to metaserver."), arg);
}
return TRUE;
@@ -642,8 +644,8 @@ static bool metaserver_command(struct co
sz_strlcpy(srvarg.metaserver_addr, arg);
- notify_player(NULL, _("Metaserver is now [%s]."),
- meta_addr_port());
+ notify_conn(NULL, _("Metaserver is now [%s]."),
+ meta_addr_port());
return TRUE;
}
@@ -902,8 +904,8 @@ static bool create_ai_player(struct conn
game.info.nplayers++;
- notify_player(NULL, _("%s has been added as an AI-controlled player."),
- arg);
+ notify_conn(NULL, _("%s has been added as an AI-controlled player."),
+ arg);
pplayer = find_player_by_name(arg);
if (!pplayer)
@@ -1175,9 +1177,9 @@ void notify_if_first_access_level_is_ava
{
if (first_access_level > default_access_level
&& !first_access_level_is_taken()) {
- notify_player(NULL, _("Anyone can now become game organizer "
- "'%s' by issuing the 'first' command."),
- cmdlevel_name(first_access_level));
+ notify_conn(NULL, _("Anyone can now become game organizer "
+ "'%s' by issuing the 'first' command."),
+ cmdlevel_name(first_access_level));
}
}
@@ -2497,7 +2499,7 @@ static bool set_command(struct connectio
}
if (!check && strlen(buffer) > 0 && sset_is_to_client(cmd)) {
- notify_player(NULL, "%s", buffer);
+ notify_conn(NULL, "%s", buffer);
}
if (!check && do_update) {
@@ -3333,8 +3335,8 @@ bool handle_stdin_input(struct connectio
/* Check if the vote command would succeed. */
if (handle_stdin_input(caller, full_command, TRUE)) {
last_vote++;
- notify_player(NULL, _("New vote (number %d) by %s: %s."), last_vote,
- caller->player->name, full_command);
+ notify_conn(NULL, _("New vote (number %d) by %s: %s."), last_vote,
+ caller->player->name, full_command);
sz_strlcpy(votes[idx].command, full_command);
votes[idx].vote_no = last_vote;
memset(votes[idx].votes_cast, VOTE_NONE, sizeof(votes[idx].votes_cast));
@@ -3376,7 +3378,7 @@ bool handle_stdin_input(struct connectio
* use command,arg instead of str because of the trailing
* newline in str when it comes from the server command line
*/
- notify_player(NULL, "%s: '%s %s'",
+ notify_conn(NULL, "%s: '%s %s'",
caller ? caller->username : _("(server prompt)"), command, arg);
}
Index: server/techtools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/techtools.c,v
retrieving revision 1.19
diff -p -u -r1.19 techtools.c
--- server/techtools.c 22 Aug 2005 07:47:02 -0000 1.19
+++ server/techtools.c 25 Aug 2005 20:07:07 -0000
@@ -404,8 +404,8 @@ void found_new_tech(struct player *plr,
if (bonus_tech_hack) {
if (advances[tech_found].bonus_message) {
- notify_player(plr, _("%s"),
- _(advances[tech_found].bonus_message));
+ notify_team_ex(plr, NULL, E_TECH_GAIN,
+ "%s", _(advances[tech_found].bonus_message));
} else {
notify_team_ex(plr, NULL, E_TECH_GAIN,
_("Great scientists from all the "
@@ -576,7 +576,8 @@ void choose_tech_goal(struct player *plr
{
/* It's been suggested that if the research target is empty then
* choose_random_tech should be called here. */
- notify_player(plr, _("Technology goal is %s."),
+ notify_player(plr, NULL, E_TECH_GAIN /* ? */,
+ _("Technology goal is %s."),
get_tech_name(plr, tech));
get_player_research(plr)->tech_goal = tech;
}
Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.348
diff -p -u -r1.348 unithand.c
--- server/unithand.c 25 Aug 2005 19:12:23 -0000 1.348
+++ server/unithand.c 25 Aug 2005 20:07:08 -0000
@@ -95,7 +95,7 @@ void handle_unit_type_upgrade(struct pla
to_unittype = can_upgrade_unittype(pplayer, from_unittype);
if (!to_unittype) {
- notify_player(pplayer,
+ notify_player(pplayer, NULL, E_BAD_COMMAND,
_("Illegal packet, can't upgrade %s (yet)."),
from_unittype->name);
return;
@@ -123,13 +123,15 @@ void handle_unit_type_upgrade(struct pla
/* Alert the player about what happened. */
if (number_of_upgraded_units > 0) {
const int cost = unit_upgrade_price(pplayer, from_unittype, to_unittype);
- notify_player(pplayer, _("%d %s upgraded to %s for %d gold."),
+ notify_player(pplayer, NULL, E_UNIT_UPGRADED,
+ _("%d %s upgraded to %s for %d gold."),
number_of_upgraded_units, from_unittype->name,
to_unittype->name,
cost * number_of_upgraded_units);
send_player_info(pplayer, pplayer);
} else {
- notify_player(pplayer, _("No units could be upgraded."));
+ notify_player(pplayer, NULL, E_UNIT_UPGRADED,
+ _("No units could be upgraded."));
}
}
@@ -152,10 +154,12 @@ void handle_unit_upgrade(struct player *
upgrade_unit(punit, to_unit, FALSE);
send_player_info(pplayer, pplayer);
- notify_player(pplayer, _("%s upgraded to %s for %d gold."),
+ notify_player(pplayer, punit->tile, E_UNIT_UPGRADED,
+ _("%s upgraded to %s for %d gold."),
unit_name(from_unit), unit_name(to_unit), cost);
} else {
- notify_player(pplayer, _("%s"), buf);
+ notify_player(pplayer, punit->tile, E_UNIT_UPGRADED,
+ "%s", buf);
}
}
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.377
diff -p -u -r1.377 unittools.c
--- server/unittools.c 25 Aug 2005 19:12:23 -0000 1.377
+++ server/unittools.c 25 Aug 2005 20:07:08 -0000
@@ -270,7 +270,7 @@ static void do_upgrade_effects(struct pl
struct unit_type *upgrade_type
= can_upgrade_unittype(pplayer, punit->type);
- notify_player(pplayer,
+ notify_player(pplayer, punit->tile, E_UNIT_UPGRADED,
_("%s was upgraded for free to %s%s."),
unit_type(punit)->name,
upgrade_type->name,
@@ -1462,7 +1462,8 @@ static void server_remove_unit(struct un
notify_conn_ex(game.est_connections, punit->tile, 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! "
+ notify_player(unit_owner(punit), punit->tile, E_GAME_END,
+ _("Losing %s meant losing the game! "
"Be more careful next time!"), unit_name(punit->type));
gamelog(GAMELOG_UNITGAMELOSS, punit);
unit_owner(punit)->is_dying = TRUE;
|
|