Complete.Org:
Mailing Lists:
Archives:
freeciv-dev:
September 2005: [Freeciv-Dev] (PR#13922) use create_event more |
![]() |
[Freeciv-Dev] (PR#13922) use create_event more[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13922 > This patch uses create_event (with a tile and event type) in a few places in the client in place of append_output_window. -jason Index: client/climisc.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v retrieving revision 1.180 diff -p -u -r1.180 climisc.c --- client/climisc.c 4 Sep 2005 04:31:16 -0000 1.180 +++ client/climisc.c 8 Sep 2005 21:44:39 -0000 @@ -163,13 +163,12 @@ void client_change_all(struct city_produ char buf[512]; int last_request_id = 0; - my_snprintf(buf, sizeof(buf), - _("Changing production of every %s into %s."), - from.is_unit ? get_unit_type(from.value)->name - : get_improvement_name(from.value), - to.is_unit ? get_unit_type(to.value)->name - : get_improvement_name(to.value)); - append_output_window(buf); + create_event(NULL, E_CITY_PRODUCTION_CHANGED, + _("Changing production of every %s into %s."), + from.is_unit ? get_unit_type(from.value)->name + : get_improvement_name(from.value), + to.is_unit ? get_unit_type(to.value)->name + : get_improvement_name(to.value)); connection_do_buffer(&aconnection); city_list_iterate (game.player_ptr->cities, pcity) { @@ -996,11 +995,10 @@ void cityrep_buy(struct city *pcity) char buf[512]; assert(!pcity->production.is_unit); - my_snprintf(buf, sizeof(buf), + create_event(pcity->tile, E_BAD_COMMAND, _("You don't buy %s in %s!"), get_improvement_name(pcity->production.value), pcity->name); - append_output_window(buf); return; } @@ -1016,10 +1014,9 @@ void cityrep_buy(struct city *pcity) name = get_impr_name_ex(pcity, pcity->production.value); } - my_snprintf(buf, sizeof(buf), - _("%s costs %d gold and you only have %d gold."), - name, value, game.player_ptr->economic.gold); - append_output_window(buf); + create_event(NULL, E_BAD_COMMAND, + _("%s costs %d gold and you only have %d gold."), + name, value, game.player_ptr->economic.gold); } } Index: client/control.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/control.c,v retrieving revision 1.186 diff -p -u -r1.186 control.c --- client/control.c 4 Sep 2005 01:15:48 -0000 1.186 +++ client/control.c 8 Sep 2005 21:44:39 -0000 @@ -781,7 +781,8 @@ void request_unit_unload_all(struct unit struct unit *plast = NULL; if(get_transporter_capacity(punit) == 0) { - append_output_window(_("Only transporter units can be unloaded.")); + create_event(punit->tile, E_BAD_COMMAND, + _("Only transporter units can be unloaded.")); return; } @@ -985,8 +986,9 @@ void request_unit_autosettlers(const str { if (punit && can_unit_do_autosettlers(punit)) { dsend_packet_unit_autosettlers(&aconnection, punit->id); - } else { - append_output_window(_("Only settler units can be put into auto mode.")); + } else if (punit) { + create_event(punit->tile, E_BAD_COMMAND, + _("Only settler units can be put into auto mode.")); } } @@ -1057,7 +1059,8 @@ void request_unit_caravan_action(struct void request_unit_nuke(struct unit *punit) { if(!unit_flag(punit, F_NUCLEAR)) { - append_output_window(_("Only nuclear units can do this.")); + create_event(punit->tile, E_BAD_COMMAND, + _("Only nuclear units can do this.")); return; } if(punit->moves_left == 0) @@ -1074,7 +1077,8 @@ void request_unit_nuke(struct unit *puni void request_unit_paradrop(struct unit *punit) { if(!unit_flag(punit, F_PARATROOPERS)) { - append_output_window(_("Only paratrooper units can do this.")); + create_event(punit->tile, E_BAD_COMMAND, + _("Only paratrooper units can do this.")); return; } if(!can_unit_paradrop(punit)) @@ -1509,7 +1513,7 @@ void do_map_click(struct tile *ptile, en case HOVER_NUKE: if (3 * real_map_distance(punit->tile, ptile) > punit->moves_left) { - append_output_window(_("Too far for this unit.")); + create_event(punit->tile, E_BAD_COMMAND, _("Too far for this unit.")); } else { do_unit_goto(ptile); /* note that this will be executed by the server after the goto */ @@ -1714,7 +1718,8 @@ void do_unit_goto(struct tile *ptile) if (ptile == dest_tile) { send_goto_route(punit); } else { - append_output_window(_("Didn't find a route to the destination!")); + create_event(punit->tile, E_BAD_COMMAND, + _("Didn't find a route to the destination!")); } } @@ -1750,7 +1755,8 @@ void do_unit_patrol_to(struct unit *puni && !is_non_allied_unit_tile(ptile, unit_owner(punit))) { send_patrol_route(punit); } else { - append_output_window(_("Didn't find a route to the destination!")); + create_event(punit->tile, E_BAD_COMMAND, + _("Didn't find a route to the destination!")); } set_hover_state(NULL, HOVER_NONE, ACTIVITY_LAST, ORDER_LAST); @@ -1763,8 +1769,8 @@ void do_unit_connect(struct unit *punit, enum unit_activity activity) { if (is_air_unit(punit)) { - append_output_window(_("Sorry, airunit connect " - "not yet implemented.")); + create_event(punit->tile, E_BAD_COMMAND, + _("Sorry, airunit connect not yet implemented.")); } else { struct tile *dest_tile; @@ -1773,8 +1779,8 @@ void do_unit_connect(struct unit *punit, if (same_pos(dest_tile, ptile)) { send_connect_route(punit, activity); } else { - append_output_window(_("Didn't find a route to " - "the destination!")); + create_event(punit->tile, E_BAD_COMMAND, + _("Didn't find a route to the destination!")); } } @@ -1818,7 +1824,8 @@ void key_center_capital(void) center_tile_mapcanvas(capital->tile); put_cross_overlay_tile(capital->tile); } else { - append_output_window(_("Oh my! You seem to have no capital!")); + create_event(NULL, E_BAD_COMMAND, + _("Oh my! You seem to have no capital!")); } } Index: client/mapctrl_common.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/mapctrl_common.c,v retrieving revision 1.61 diff -p -u -r1.61 mapctrl_common.c --- client/mapctrl_common.c 3 Aug 2005 16:19:07 -0000 1.61 +++ client/mapctrl_common.c 8 Sep 2005 21:44:39 -0000 @@ -336,10 +336,9 @@ void clipboard_copy_production(struct ti return; } if (!can_player_build_unit_direct(game.player_ptr, punit->type)) { - my_snprintf(msg, sizeof(msg), - _("You don't know how to build %s!"), - punit->type->name); - append_output_window(msg); + create_event(ptile, E_BAD_COMMAND, + _("You don't know how to build %s!"), + punit->type->name); return; } clipboard.is_unit = TRUE; @@ -347,10 +346,10 @@ void clipboard_copy_production(struct ti } upgrade_canvas_clipboard(); - my_snprintf(msg, sizeof(msg), _("Copy %s to clipboard."), - clipboard.is_unit ? get_unit_type(clipboard.value)->name - : get_improvement_name(clipboard.value)); - append_output_window(msg); + create_event(ptile, E_CITY_PRODUCTION_CHANGED, /* ? */ + _("Copy %s to clipboard."), + clipboard.is_unit ? get_unit_type(clipboard.value)->name + : get_improvement_name(clipboard.value)); } /************************************************************************** @@ -363,8 +362,7 @@ void clipboard_paste_production(struct c return; } if (clipboard.value == -1) { - append_output_window( - _("Clipboard is empty.")); + create_event(pcity->tile, E_BAD_COMMAND, _("Clipboard is empty.")); return; } if (!tiles_hilited_cities) {
|