diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/client/gui-gtk/dialogs.c event/client/gui-gtk/dialogs.c --- freeciv/client/gui-gtk/dialogs.c Thu Jul 27 13:47:10 2000 +++ event/client/gui-gtk/dialogs.c Thu Jul 27 23:54:51 2000 @@ -314,7 +314,7 @@ GtkWidget *notify_dialog_shell, *notify_command, *notify_goto_command; GtkWidget *notify_label; - if (x == 0 && y == 0) { + if (y < 0 || y >= map.ysize) { popup_notify_dialog(_("Message:"), headline, lines); return; } diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/client/gui-gtk/messagewin.c event/client/gui-gtk/messagewin.c --- freeciv/client/gui-gtk/messagewin.c Sat Jul 22 22:33:33 2000 +++ event/client/gui-gtk/messagewin.c Thu Jul 27 23:54:51 2000 @@ -363,10 +363,7 @@ x = xpos[row]; y = ypos[row]; - location_ok = (x || y); - /* Note: bad luck if tile (x=0,y=0) has a message, but can't - * easily fix this without making the protocol incompatibile --dwp - */ + location_ok = (y >= 0 && y < map.ysize); city_ok = (location_ok && (pcity=map_get_city(x,y)) && (pcity->owner == game.player_idx)); diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/client/gui-mui/messagewin.c event/client/gui-mui/messagewin.c --- freeciv/client/gui-mui/messagewin.c Thu Jul 27 13:47:16 2000 +++ event/client/gui-mui/messagewin.c Thu Jul 27 23:54:51 2000 @@ -154,7 +154,7 @@ int location_ok; int city_ok; - location_ok = (x || y); + location_ok = (y >= 0 && y < map.ysize); city_ok = (location_ok && (pcity = map_get_city(x, y)) && (pcity->owner == game.player_idx)); set(mes_goto_button, MUIA_Disabled, !location_ok); diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/client/gui-xaw/dialogs.c event/client/gui-xaw/dialogs.c --- freeciv/client/gui-xaw/dialogs.c Tue Jun 27 14:48:59 2000 +++ event/client/gui-xaw/dialogs.c Thu Jul 27 23:54:51 2000 @@ -325,7 +325,7 @@ Widget notify_headline, notify_label; Dimension width, width2, width_1, width_2; - if (x == 0 && y == 0) { + if (y < 0 || y >= map.ysize) { popup_notify_dialog("Message:", headline, lines); return; } diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/client/gui-xaw/messagewin.c event/client/gui-xaw/messagewin.c --- freeciv/client/gui-xaw/messagewin.c Sat Jan 1 19:55:39 2000 +++ event/client/gui-xaw/messagewin.c Thu Jul 27 23:54:51 2000 @@ -374,10 +374,7 @@ int x, y; x = xpos[ret->list_index]; y = ypos[ret->list_index]; - location_ok = (x || y); - /* Note: bad luck if tile (x=0,y=0) has a message, but can't - * easily fix this without making the protocol incompatibile --dwp - */ + location_ok = (y >= 0 && y < map.ysize); city_ok = (location_ok && (pcity=map_get_city(x,y)) && (pcity->owner == game.player_idx)); } diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/common/packets.c event/common/packets.c --- freeciv/common/packets.c Thu Jul 27 13:47:30 2000 +++ event/common/packets.c Thu Jul 27 23:54:51 2000 @@ -2345,8 +2345,16 @@ { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, type); + + /* when removing "event00_fix" capability, + leave only the code from the *else* clause (send unmodified values) */ +if (packet->y < 0 && pc && !has_capability("event00_fix", pc->capability)) { + cptr=put_uint8(cptr, 0); + cptr=put_uint8(cptr, 0); +} else { cptr=put_uint8(cptr, packet->x); cptr=put_uint8(cptr, packet->y); +} cptr=put_uint32(cptr, packet->event); cptr=put_string(cptr, packet->message); @@ -2436,6 +2444,15 @@ iget_uint8(&iter, &packet->x); iget_uint8(&iter, &packet->y); + + /* when removing "event00_fix" capability, remove following block */ + if (packet->x==0 && packet->y==0 + && !has_capability("event00_fix", pc->capability)) { + packet->x = -1; + packet->y = -1; + } + /* remove to here */ + iget_uint32(&iter, &packet->event); iget_string(&iter, packet->message, sizeof(packet->message)); diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/cityturn.c event/server/cityturn.c --- freeciv/server/cityturn.c Thu Jul 27 20:19:28 2000 +++ event/server/cityturn.c Thu Jul 27 23:54:51 2000 @@ -794,7 +794,7 @@ city_list_iterate_end; pplayer->ai.prev_gold = gold; if (gold-(gold-pplayer->economic.gold)*3<0) { - notify_player_ex(pplayer, 0, 0, E_LOW_ON_FUNDS, + notify_player_ex(pplayer, -1, -1, E_LOW_ON_FUNDS, _("Game: WARNING, we're LOW on FUNDS sire.")); } /* uncomment to unbalance the game, like in civ1 (CLG) diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/maphand.c event/server/maphand.c --- freeciv/server/maphand.c Thu Jul 27 22:29:43 2000 +++ event/server/maphand.c Thu Jul 27 23:54:51 2000 @@ -121,7 +121,7 @@ } } - notify_player_ex(0, 0,0, E_GLOBAL_ECO, + notify_player_ex(0, -1, -1, E_GLOBAL_ECO, _("Game: Global warming has occurred!")); notify_player(0, _("Game: Coastlines have been flooded and vast " "ranges of grassland have become deserts.")); @@ -169,7 +169,7 @@ } } - notify_player_ex(0, 0,0, E_GLOBAL_ECO, + notify_player_ex(0, -1, -1, E_GLOBAL_ECO, _("Game: Nuclear winter has occurred!")); notify_player(0, _("Game: Wetlands have dried up and vast " "ranges of grassland have become tundra.")); diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/plrhand.c event/server/plrhand.c --- freeciv/server/plrhand.c Thu Jul 27 23:55:25 2000 +++ event/server/plrhand.c Thu Jul 27 23:55:49 2000 @@ -1337,7 +1337,7 @@ for (i=0;i=2) { - notify_player_ex(pplayer,0,0, E_TECH_GAIN, + notify_player_ex(pplayer, -1, -1, E_TECH_GAIN, _("Game: %s acquired from The Great Library!"), advances[i].name); gamelog(GAMELOG_TECH,"%s discover %s (Library)", @@ -1411,7 +1411,7 @@ city_list_size(&pplayer->cities)==0) { pplayer->is_alive=0; if( !is_barbarian(pplayer) ) { - notify_player_ex(0, 0,0, E_DESTROYED, _("Game: The %s are no more!"), + notify_player_ex(0, -1, -1, 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)); @@ -1452,7 +1452,7 @@ (pcity = find_city_by_id(game.global_wonders[wonder]))) { pplayer = city_owner(pcity); if (pplayer->conn) - notify_player_ex(pplayer, 0, 0, + notify_player_ex(pplayer, -1, -1, has_capability("event_wonder_obsolete", pplayer->conn->capability) ? E_WONDER_OBSOLETE : E_NOEVENT, _("Game: Discovery of %s OBSOLETES %s in %s!"), @@ -1963,10 +1963,10 @@ get_nation_name_plural(pplayer->nation), get_nation_name_plural(pplayer2->nation), diplstate_text(new_type)); - notify_player_ex(pplayer2, 0, 0, E_NOEVENT, + notify_player_ex(pplayer2, -1, -1, E_NOEVENT, _("Game: %s cancelled the diplomatic agreement!"), pplayer->name); - notify_player_ex(pplayer2, 0, 0, E_CANCEL_PACT, + notify_player_ex(pplayer2, -1, -1, E_CANCEL_PACT, _("Game: The diplomatic state between the %s and the %s is now %s."), get_nation_name_plural(pplayer2->nation), get_nation_name_plural(pplayer->nation), @@ -1974,7 +1974,12 @@ } /************************************************************************** -... + Notify player of an event, specifying event type (from events.h) and + (x,y) coords associated with the event. Coords will only apply if game + has started and the player knows that tile. If coords are not required, + caller should specify (x,y) = (-1,-1). For generic event use E_NOEVENT. + (Although current clients do not use (x,y) data for E_NOEVENT events...) + (If both coords and event are not required, use notify_player() instead.) **************************************************************************/ void notify_player_ex(const struct player *pplayer, int x, int y, int event, const char *format, ...) @@ -1988,13 +1993,13 @@ genmsg.event = event; for(i=0; i= RUN_GAME_STATE + if (y >= 0 && y < map.ysize && server_state >= RUN_GAME_STATE && map_get_known(x, y, &game.players[i])) { genmsg.x = x; genmsg.y = y; } else { - genmsg.x = 0; - genmsg.y = 0; + genmsg.x = -1; + genmsg.y = -1; } send_packet_generic_message(game.players[i].conn, PACKET_CHAT_MSG, &genmsg); } @@ -2034,7 +2039,7 @@ va_end(args); genmsg.x = -1; genmsg.y = -1; - genmsg.event = -1; + genmsg.event = E_NOEVENT; for(i=0; ilaunch_year = game.year; arrival = ship->launch_year + (int) ship->travel_time; - notify_player_ex(0, 0, 0, E_SPACESHIP, + notify_player_ex(0, -1, -1, E_SPACESHIP, _("Game: The %s have launched a spaceship! " "It is estimated to arrive on Alpha Centauri in %s."), get_nation_name(pplayer->nation), @@ -332,7 +332,7 @@ **************************************************************************/ void spaceship_lost(struct player *pplayer) { - notify_player_ex(0, 0, 0, E_SPACESHIP, + notify_player_ex(0, -1, -1, E_SPACESHIP, _("Game: With the capture of %s's capital, the %s" " spaceship is lost!"), pplayer->name, get_nation_name(pplayer->nation)); @@ -370,7 +370,7 @@ if (best_pplayer) { best_pplayer->spaceship.state = SSHIP_ARRIVED; server_state = GAME_OVER_STATE; - notify_player_ex(0, 0, 0, E_SPACESHIP, + notify_player_ex(0, -1, -1, E_SPACESHIP, _("Game: The %s spaceship has arrived at Alpha Centauri."), get_nation_name(best_pplayer->nation)); }