diff -urd -X freeciv.clean/diff_ignore ex_ev/client/agents/cma_core.c freeciv.clean/client/agents/cma_core.c --- ex_ev/client/agents/cma_core.c Tue Feb 19 20:43:19 2002 +++ freeciv.clean/client/agents/cma_core.c Wed Feb 20 16:29:51 2002 @@ -1596,38 +1596,23 @@ cma_query_result(pcity, ¶meter, &result); if (!result.found_a_valid) { - struct packet_generic_message packet; - freelog(HANDLE_CITY_LOG_LEVEL2, " no valid found result"); cma_release_city(pcity); - my_snprintf(packet.message, sizeof(packet.message), - _("CMA: The agent can't fulfill the requirements " - "for %s. Passing back control."), pcity->name); - packet.x = pcity->x; - packet.y = pcity->y; - packet.event = E_CITY_CMA_RELEASE; - - handle_chat_msg(&packet); + create_event(pcity->x, pcity->y, E_CITY_CMA_RELEASE, + _("CMA: The agent can't fulfill the requirements " + "for %s. Passing back control."), pcity->name); handled = TRUE; break; } else { if (!apply_result_on_server(pcity, &result)) { freelog(HANDLE_CITY_LOG_LEVEL2, " doesn't cleanly apply"); if (i == 0) { - struct packet_generic_message packet; - - my_snprintf(packet.message, sizeof(packet.message), - _("CMA: %s has changed and the calculated " - "result can't be applied. Will retry."), - pcity->name); - packet.x = pcity->x; - packet.y = pcity->y; - packet.event = E_NOEVENT; - - append_output_window(packet.message); - add_notify_window(&packet); + create_event(pcity->x, pcity->y, E_NOEVENT, + _("CMA: %s has changed and the calculated " + "result can't be applied. Will retry."), + pcity->name); } } else { freelog(HANDLE_CITY_LOG_LEVEL2, " ok"); @@ -1639,26 +1624,21 @@ } if (!handled) { - struct packet_generic_message packet; - freelog(HANDLE_CITY_LOG_LEVEL2, " not handled"); - my_snprintf(packet.message, sizeof(packet.message), - _("CMA: %s has changed multiple times. This may be " - "an error in freeciv or bad luck. Please contact " - ". The CMA will detach " - "itself from the city now."), pcity->name); - packet.x = pcity->x; - packet.y = pcity->y; - packet.event = E_CITY_CMA_RELEASE; - - append_output_window(packet.message); - add_notify_window(&packet); + create_event(pcity->x, pcity->y, E_CITY_CMA_RELEASE, + _("CMA: %s has changed multiple times. This may be " + "an error in freeciv or bad luck. Please contact " + ". The CMA will detach " + "itself from the city now."), pcity->name); cma_release_city(pcity); #if (IS_DEVEL_VERSION || IS_BETA_VERSION) - freelog(LOG_ERROR, "%s", packet.message); + freelog(LOG_ERROR, _("CMA: %s has changed multiple times. This may be " + "an error in freeciv or bad luck. Please contact " + ". The CMA will detach " + "itself from the city now."), pcity->name); assert(0); exit(EXIT_FAILURE); #endif diff -urd -X freeciv.clean/diff_ignore ex_ev/client/civclient.c freeciv.clean/client/civclient.c --- ex_ev/client/civclient.c Tue Feb 19 21:56:46 2002 +++ freeciv.clean/client/civclient.c Wed Feb 20 15:19:17 2002 @@ -519,6 +519,7 @@ if (client_state==CLIENT_PRE_GAME_STATE && (newstate==CLIENT_SELECT_RACE_STATE || newstate==CLIENT_GAME_RUNNING_STATE)) { + create_event(-1, -1, E_GAME_START, ("Game started.")); translate_data_names(); } diff -urd -X freeciv.clean/diff_ignore ex_ev/client/climisc.c freeciv.clean/client/climisc.c --- ex_ev/client/climisc.c Tue Feb 19 16:44:52 2002 +++ freeciv.clean/client/climisc.c Wed Feb 20 16:47:19 2002 @@ -48,6 +48,7 @@ #include "tilespec.h" #include "civclient.h" #include "spaceship.h" +#include "packhand.h" #include "climisc.h" @@ -1112,4 +1113,24 @@ mass_buf, travel_buf, (int) (pship->success_rate * 100.0), arrival); return buf; +} + +/************************************************************************** + Creates a struct packet_generic_message packet and injects it via + handle_chat_msg. +**************************************************************************/ +void create_event(int x, int y, int event, const char *format, ...) +{ + va_list ap; + struct packet_generic_message packet; + + packet.x = x; + packet.y = y; + packet.event = event; + + va_start(ap, format); + my_vsnprintf(packet.message, sizeof(packet.message), format, ap); + va_end(ap); + + handle_chat_msg(&packet); } diff -urd -X freeciv.clean/diff_ignore ex_ev/client/climisc.h freeciv.clean/client/climisc.h --- ex_ev/client/climisc.h Tue Feb 19 16:46:04 2002 +++ freeciv.clean/client/climisc.h Wed Feb 20 16:27:56 2002 @@ -109,4 +109,9 @@ int num_supported_units_in_city(struct city* pcity); char *get_spaceship_descr(struct player_spaceship *pship); + + +void create_event(int x, int y, int event, const char *format, ...) + fc__attribute((format (printf, 4, 5))); + #endif /* FC__CLIMISC_H */ diff -urd -X freeciv.clean/diff_ignore ex_ev/client/control.c freeciv.clean/client/control.c --- ex_ev/client/control.c Tue Feb 19 16:49:15 2002 +++ freeciv.clean/client/control.c Wed Feb 20 15:22:31 2002 @@ -110,6 +110,7 @@ if(punit) { auto_center_on_focus_unit(); + create_event(punit->x, punit->y, E_UNIT_FOCUS, _("focus change")); punit->focus_status=FOCUS_AVAIL; refresh_tile_mapcanvas(punit->x, punit->y, TRUE); diff -urd -X freeciv.clean/diff_ignore ex_ev/client/options.c freeciv.clean/client/options.c --- ex_ev/client/options.c Wed Feb 20 10:40:20 2002 +++ freeciv.clean/client/options.c Wed Feb 20 17:00:29 2002 @@ -183,6 +183,26 @@ GEN_EV(N_("City Nuked"), E_CITY_NUKED), GEN_EV(N_("Messages from the Server Operator"), E_MESSAGE_WALL), GEN_EV(N_("City Released from CMA"), E_CITY_CMA_RELEASE), + GEN_EV(N_("City Was Build"), E_CITY_BUILD), + GEN_EV(N_("Revolt Started"), E_REVOLT_START), + GEN_EV(N_("Revold Ended"), E_REVOLT_DONE), + GEN_EV(N_("Nuke Denotated"), E_NUKE), + GEN_EV(N_("Gold Found In Hut"), E_HUT_GOLD), + GEN_EV(N_("Tech Found In Hut"), E_HUT_TECH), + GEN_EV(N_("Mercenaries Found In Hut"), E_HUT_MERC), + GEN_EV(N_("Unit Spared By Barbarians"), E_HUT_BARB_CITY_NEAR), + GEN_EV(N_("Barbarians In A Hut Roused"), E_HUT_BARB), + GEN_EV(N_("Unit Killed By Hut-Barbarians"), E_HUT_BARB_KILLED), + GEN_EV(N_("City Founded Via a Hut"), E_HUT_CITY), + GEN_EV(N_("Settler Found In Hut"), E_HUT_SETTLER), + GEN_EV(N_("Game Started"), E_GAME_START), + GEN_EV(N_("Year Advance"), E_NEXT_YEAR), + GEN_EV(N_("Report"), E_REPORT), + GEN_EV(N_("Broadcast Report"), E_BROADCAST_REPORT), + GEN_EV(N_("Nation Selected"), E_NATION_SELECTED), + GEN_EV(N_("Diplomat Arrived"), E_DIPLOMAT_ARRIVE), + GEN_EV(N_("Sabotage Target"), E_DIPLOMAT_SABOTAGE), + GEN_EV(N_("Unit Focus"), E_UNIT_FOCUS), GEN_EV_TERMINATOR }; diff -urd -X freeciv.clean/diff_ignore ex_ev/client/packhand.c freeciv.clean/client/packhand.c --- ex_ev/client/packhand.c Tue Feb 19 16:57:25 2002 +++ freeciv.clean/client/packhand.c Wed Feb 20 16:14:24 2002 @@ -809,7 +809,7 @@ } if (!game.player_ptr->ai.control || ai_popup_windows || - packet->event != BROADCAST_EVENT) + packet->event != E_BROADCAST_REPORT) popup_notify_dialog(caption, headline, lines); } @@ -1241,12 +1241,14 @@ } } - if(pplayer==game.player_ptr && - (pplayer->revolution < 1 || pplayer->revolution > 5) && - pplayer->government==game.government_when_anarchy && - (!game.player_ptr->ai.control || ai_popup_windows) && - (get_client_state()==CLIENT_GAME_RUNNING_STATE)) + if (pplayer == game.player_ptr && + (pplayer->revolution < 1 || pplayer->revolution > 5) && + pplayer->government == game.government_when_anarchy && + (!game.player_ptr->ai.control || ai_popup_windows) && + (get_client_state() == CLIENT_GAME_RUNNING_STATE)) { + create_event(-1, -1, E_REVOLT_DONE, _("Game: Revolution finished")); popup_government_dialog(); + } update_players_dialog(); update_worklist_report_dialog(); @@ -2251,6 +2253,7 @@ switch(packet->action_type) { case DIPLOMAT_CLIENT_POPUP_DIALOG: process_diplomat_arrival(pdiplomat, packet->target_id); + create_event(-1, -1, E_DIPLOMAT_ARRIVE, _("Game: Diplomat arrived.")); break; default: freelog(LOG_ERROR, "Received bad action %d in handle_diplomat_action()", @@ -2271,7 +2274,7 @@ int i; for(i=0; iimprovements[i] = (packet->improvements[i]=='1') ? I_ACTIVE : I_NONE; - + create_event(-1, -1, E_DIPLOMAT_SABOTAGE, _("Game: Diplomat sabotage.")); popup_sabotage_dialog(pcity); } } diff -urd -X freeciv.clean/diff_ignore ex_ev/common/events.h freeciv.clean/common/events.h --- ex_ev/common/events.h Wed Feb 20 09:46:05 2002 +++ freeciv.clean/common/events.h Wed Feb 20 16:30:54 2002 @@ -62,6 +62,26 @@ E_CITY_NUKED, E_MESSAGE_WALL, E_CITY_CMA_RELEASE, + E_CITY_BUILD, + E_REVOLT_START, + E_REVOLT_DONE, + E_NUKE, + E_HUT_GOLD, + E_HUT_TECH, + E_HUT_MERC, + E_HUT_BARB_CITY_NEAR, + E_HUT_BARB, + E_HUT_BARB_KILLED, + E_HUT_CITY, + E_HUT_SETTLER, + E_GAME_START, + E_NEXT_YEAR, + E_REPORT, + E_BROADCAST_REPORT, + E_NATION_SELECTED, + E_DIPLOMAT_ARRIVE, + E_DIPLOMAT_SABOTAGE, + E_UNIT_FOCUS, /* Note: If you add a new event, make sure you make a similar change to message_text in client/options.c */ diff -urd -X freeciv.clean/diff_ignore ex_ev/common/shared.h freeciv.clean/common/shared.h --- ex_ev/common/shared.h Thu Feb 14 09:46:05 2002 +++ freeciv.clean/common/shared.h Wed Feb 20 15:30:49 2002 @@ -23,8 +23,6 @@ #define BUG_EMAIL_ADDRESS "bugs@xxxxxxxxxxxxxxxxxxx" #define WEBSITE_URL "http://www.freeciv.org/" -#define BROADCAST_EVENT -2 - #define MAX_NUM_PLAYERS 30 #define MAX_NUM_BARBARIANS 2 #define MAX_NUM_ITEMS 200 /* eg, unit_types */ diff -urd -X freeciv.clean/diff_ignore ex_ev/server/citytools.c freeciv.clean/server/citytools.c --- ex_ev/server/citytools.c Wed Feb 20 09:41:01 2002 +++ freeciv.clean/server/citytools.c Wed Feb 20 16:18:38 2002 @@ -1028,6 +1028,9 @@ pcity->synced = FALSE; send_city_info(NULL, pcity); sync_cities(); /* Will also send pcity. */ + + notify_player_ex(pplayer, x, y, E_CITY_BUILD, + _("Game: You have founded %s"), pcity->name); maybe_make_first_contact(x, y, city_owner(pcity)); /* Catch fortress building, transforming into ocean, etc. */ diff -urd -X freeciv.clean/diff_ignore ex_ev/server/gamehand.c freeciv.clean/server/gamehand.c --- ex_ev/server/gamehand.c Tue Feb 19 22:46:11 2002 +++ freeciv.clean/server/gamehand.c Wed Feb 20 16:19:51 2002 @@ -22,6 +22,7 @@ #include "mem.h" #include "packets.h" #include "rand.h" +#include "events.h" #include "maphand.h" #include "plrhand.h" @@ -178,7 +179,8 @@ lsend_packet_new_year(&game.est_connections, &apacket); /* Hmm, clients could add this themselves based on above packet? */ - notify_conn(&game.est_connections, _("Year: %s"), textyear(year)); + notify_conn_ex(&game.est_connections, -1, -1, E_NEXT_YEAR, _("Year: %s"), + textyear(year)); } diff -urd -X freeciv.clean/diff_ignore ex_ev/server/plrhand.c freeciv.clean/server/plrhand.c --- ex_ev/server/plrhand.c Wed Feb 20 09:41:01 2002 +++ freeciv.clean/server/plrhand.c Wed Feb 20 14:42:45 2002 @@ -725,8 +725,9 @@ return; pplayer->revolution=myrand(5)+1; pplayer->government=game.government_when_anarchy; - notify_player(pplayer, _("Game: The %s have incited a revolt!"), - get_nation_name_plural(pplayer->nation)); + notify_player_ex(pplayer, -1, -1, E_REVOLT_START, + _("Game: The %s have incited a revolt!"), + get_nation_name_plural(pplayer->nation)); gamelog(GAMELOG_REVOLT,"The %s revolt!", get_nation_name_plural(pplayer->nation)); diff -urd -X freeciv.clean/diff_ignore ex_ev/server/report.c freeciv.clean/server/report.c --- ex_ev/server/report.c Tue Feb 19 23:09:21 2002 +++ freeciv.clean/server/report.c Wed Feb 20 16:20:37 2002 @@ -27,6 +27,7 @@ #include "rand.h" #include "support.h" #include "version.h" +#include "events.h" #include "report.h" @@ -132,7 +133,7 @@ my_snprintf(title, sizeof(title), _(historian_message[which_news]), _(historian_name[which_historian])); page_conn_etype(&game.game_connections, _("Historian Publishes!"), - title, buffer, BROADCAST_EVENT); + title, buffer, E_BROADCAST_REPORT); } /************************************************************************** @@ -1441,18 +1442,20 @@ **************************************************************************/ void page_conn(struct conn_list *dest, char *caption, char *headline, char *lines) { - page_conn_etype(dest, caption, headline, lines, -1); + page_conn_etype(dest, caption, headline, lines, E_REPORT); } /************************************************************************** This function pops up a non-modal message dialog on the player's desktop -event == -1: message should not be ignored by clients watching AI players with - ai_popup_windows off. Example: Server Options, Demographics - Report, etc. -event == BROADCAST_EVENT: message can safely be ignored by clients watching AI - players with ai_popup_windows off. - For example: Herodot's report... and similar messages. + +event == E_REPORT: message should not be ignored by clients watching + AI players with ai_popup_windows off. Example: + Server Options, Demographics Report, etc. + +event == E_BROADCAST_REPORT: message can safely be ignored by clients + watching AI players with ai_popup_windows off. For + example: Herodot's report... and similar messages. **************************************************************************/ void page_conn_etype(struct conn_list *dest, char *caption, char *headline, char *lines, int event) diff -urd -X freeciv.clean/diff_ignore ex_ev/server/srv_main.c freeciv.clean/server/srv_main.c --- ex_ev/server/srv_main.c Wed Feb 20 09:41:01 2002 +++ freeciv.clean/server/srv_main.c Wed Feb 20 16:21:32 2002 @@ -949,8 +949,9 @@ return; } - freelog(LOG_NORMAL, _("%s is the %s ruler %s."), pplayer->name, - get_nation_name(packet->nation_no), packet->name); + notify_conn_ex(&game.est_connections, -1, -1, E_NATION_SELECTED, + _("Game: %s is the %s ruler %s."), pplayer->name, + get_nation_name(packet->nation_no), packet->name); /* inform player his choice was ok */ select_nation.value2=0xffff; diff -urd -X freeciv.clean/diff_ignore ex_ev/server/unittools.c freeciv.clean/server/unittools.c --- ex_ev/server/unittools.c Tue Feb 19 14:51:10 2002 +++ freeciv.clean/server/unittools.c Wed Feb 20 15:03:28 2002 @@ -2157,8 +2157,8 @@ do_nuke_tile(pplayer, x1, y1); } square_iterate_end; - notify_player_ex(pplayer, x, y, - E_NOEVENT, _("Game: You detonated a nuke.")); + notify_conn_ex(&game.game_connections, x, y, E_NUKE, + _("Game: %s detonated a nuke!"), pplayer->name); } /************************************************************************** @@ -2287,7 +2287,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_NOEVENT, + notify_player_ex(pplayer, punit->x, punit->y, E_HUT_GOLD, _("Game: You found %d gold."), cred); pplayer->economic.gold += cred; } @@ -2300,7 +2300,7 @@ struct player *pplayer = unit_owner(punit); int res_ed, res_ing, new_tech; - notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT, + notify_player_ex(pplayer, punit->x, punit->y, E_HUT_TECH, _("Game: You found ancient scrolls of wisdom.")); /* Save old values, choose tech, then restore old values: */ @@ -2343,7 +2343,7 @@ { struct player *pplayer = unit_owner(punit); - notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT, + notify_player_ex(pplayer, punit->x, punit->y, E_HUT_MERC, _("Game: A band of friendly mercenaries joins your cause.")); create_unit(pplayer, punit->x, punit->y, find_a_unit_type(L_HUT,L_HUT_TECH), FALSE, punit->homecity, -1); @@ -2359,7 +2359,7 @@ bool ok = TRUE; if (city_exists_within_city_radius(punit->x, punit->y, TRUE)) { - notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT, + notify_player_ex(pplayer, punit->x, punit->y, E_HUT_BARB_CITY_NEAR, _("Game: An abandoned village is here.")); } else { @@ -2371,10 +2371,10 @@ ok = unleash_barbarians(pplayer, punit_x, punit_y); if (ok) { - notify_player_ex(pplayer, punit_x, punit_y, E_NOEVENT, + notify_player_ex(pplayer, punit_x, punit_y, E_HUT_BARB, _("Game: You have unleashed a horde of barbarians!")); } else { - notify_player_ex(pplayer, punit_x, punit_y, E_NOEVENT, + notify_player_ex(pplayer, punit_x, punit_y, E_HUT_BARB_KILLED, _("Game: Your %s has been killed by barbarians!"), unit_name(type)); } @@ -2390,10 +2390,12 @@ struct player *pplayer = unit_owner(punit); if (is_ok_city_spot(punit->x, punit->y)) { + notify_player_ex(pplayer, punit->x, punit->y, 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_NOEVENT, + notify_player_ex(pplayer, punit->x, punit->y, E_HUT_SETTLER, _("Game: Friendly nomads are impressed by you," " and join you.")); create_unit(pplayer, punit->x, punit->y, get_role_unit(F_CITIES,0),