diff -ur freeciv/client/civclient.c dipl_pop/client/civclient.c --- freeciv/client/civclient.c Sat Mar 25 16:56:03 2000 +++ dipl_pop/client/civclient.c Sun Mar 26 00:54:52 2000 @@ -330,6 +330,10 @@ case PACKET_CITY_NAME_SUGGESTION: handle_city_name_suggestion((struct packet_city_name_suggestion *)packet); break; + + case PACKET_DIPLOMAT_ACTION: + handle_diplomat_action((struct packet_diplomat_action *)packet); + break; default: freelog(LOG_FATAL, _("Received unknown packet from server!")); diff -ur freeciv/client/packhand.c dipl_pop/client/packhand.c --- freeciv/client/packhand.c Sat Mar 25 16:56:03 2000 +++ dipl_pop/client/packhand.c Sun Mar 26 00:54:52 2000 @@ -1511,3 +1511,23 @@ } /* maybe unit died; ignore */ } + +/************************************************************************** +... +**************************************************************************/ +void handle_diplomat_action(struct packet_diplomat_action *packet) +{ + struct unit *pdiplomat=unit_list_find(&game.player_ptr->units, packet->diplomat_id); + struct city *pcity=find_city_by_id(packet->target_id); + + if (!pdiplomat || !pcity) { + printf("Error: could not find city or diplomat."); + return; + } + + switch(packet->action_type) { + case DIPLOMAT_ACTION_POPUP: + popup_diplomat_dialog(pdiplomat, pcity->x, pcity->y); + break; + } +} diff -ur freeciv/client/packhand.h dipl_pop/client/packhand.h --- freeciv/client/packhand.h Sat Mar 25 16:56:03 2000 +++ dipl_pop/client/packhand.h Sun Mar 26 00:54:52 2000 @@ -45,5 +45,6 @@ void handle_city_name_suggestion(struct packet_city_name_suggestion *packet); void handle_ruleset_nation(struct packet_ruleset_nation *packet); void handle_ruleset_city(struct packet_ruleset_city *packet); +void handle_diplomat_action(struct packet_diplomat_action *packet); #endif /* FC__PACKHAND_H */ diff -ur freeciv/common/packets.h dipl_pop/common/packets.h --- freeciv/common/packets.h Sat Mar 25 16:56:06 2000 +++ dipl_pop/common/packets.h Sun Mar 26 00:54:52 2000 @@ -129,7 +129,7 @@ }; /********************************************************* - diplomat action! + diplomacy action! *********************************************************/ struct packet_diplomacy_info { int plrno0, plrno1; diff -ur freeciv/common/unit.c dipl_pop/common/unit.c --- freeciv/common/unit.c Sat Mar 25 16:56:07 2000 +++ dipl_pop/common/unit.c Sun Mar 26 00:54:52 2000 @@ -503,9 +503,17 @@ /************************************************************************** ... **************************************************************************/ -int is_military_unit(struct unit *this_unit) +int is_military_unit(struct unit *punit) { - return (unit_flag(this_unit->type, F_NONMIL) == 0); + return (unit_flag(punit->type, F_NONMIL) == 0); +} + +/************************************************************************** +... +**************************************************************************/ +int is_diplomat_unit(struct unit *punit) +{ + return (unit_flag(punit->type, F_DIPLOMAT)); } /************************************************************************** @@ -1433,4 +1441,9 @@ } } return L_LAST; +} + +struct player *unit_owner(struct unit *punit) +{ + return (&game.players[punit->owner]); } diff -ur freeciv/common/unit.h dipl_pop/common/unit.h --- freeciv/common/unit.h Sat Mar 25 16:56:07 2000 +++ dipl_pop/common/unit.h Sun Mar 26 00:54:52 2000 @@ -70,7 +70,8 @@ DIPLOMAT_BRIBE, DIPLOMAT_EMBASSY, DIPLOMAT_SABOTAGE, DIPLOMAT_STEAL, DIPLOMAT_INCITE, SPY_POISON, DIPLOMAT_INVESTIGATE, SPY_SABOTAGE_UNIT, - DIPLOMAT_ANY_ACTION + DIPLOMAT_ANY_ACTION, + DIPLOMAT_ACTION_POPUP /* from server to client */ }; struct unit_ai { @@ -266,7 +267,8 @@ int is_unit_activity_on_tile(enum unit_activity activity, int x, int y); int get_unit_tile_pillage_set(int x, int y); int unit_value(Unit_Type_id id); -int is_military_unit(struct unit *this_unit); /* !set !dip !cara */ +int is_military_unit(struct unit *punit); /* !set !dip !cara */ +int is_diplomat_unit(struct unit *punit); int is_ground_threat(struct player *pplayer, struct unit *punit); int is_square_threatened(struct player *pplayer, int x, int y); int is_field_unit(struct unit *this_unit); /* ships+aero */ @@ -317,5 +319,6 @@ int num_role_units(int role); Unit_Type_id get_role_unit(int role, int index); Unit_Type_id best_role_unit(struct city *pcity, int role); +struct player *unit_owner(struct unit *punit); #endif /* FC__UNIT_H */ Only in dipl_pop/po: cat-id-tbl.c Only in dipl_pop/po: freeciv.pot Only in dipl_pop/po: stamp-cat-id diff -ur freeciv/server/unithand.c dipl_pop/server/unithand.c --- freeciv/server/unithand.c Sat Mar 25 16:56:11 2000 +++ dipl_pop/server/unithand.c Sun Mar 26 00:57:02 2000 @@ -827,6 +827,16 @@ return handle_unit_establish_trade(pplayer, &req); } + if (is_diplomat_unit(punit) && (pcity = map_get_city(dest_x, dest_y))) + if (city_owner(pcity) != unit_owner(punit)) { + struct packet_diplomat_action packet; + packet.target_id = pcity->id; + packet.diplomat_id = punit->id; + packet.action_type = DIPLOMAT_ACTION_POPUP; + send_packet_diplomat_action(unit_owner(punit)->conn, &packet); + return 0; + } + pdefender=get_defender(pplayer, punit, dest_x, dest_y); if(pdefender && pdefender->owner!=punit->owner) {