diff -r -u freeciv-1.7.2-orig/client/Freeciv.h freeciv-1.7.2/client/Freeciv.h --- freeciv-1.7.2-orig/client/Freeciv.h Thu Dec 24 04:45:27 1998 +++ freeciv-1.7.2/client/Freeciv.h Wed Jan 13 09:04:15 1999 @@ -223,9 +223,25 @@ "Freeciv*diptechmenubutton1.bottom: chainTop", "Freeciv*diptechmenubutton1.left: chainLeft", "Freeciv*diptechmenubutton1.right: chainRight", +"Freeciv*dipcitymenubutton0.label: Cities", +"Freeciv*dipcitymenubutton0.fromVert: diptechmenubutton0", +"Freeciv*dipcitymenubutton0.foreground: white", +"Freeciv*dipcitymenubutton0.background: blue", +"Freeciv*dipcitymenubutton0.top: chainTop", +"Freeciv*dipcitymenubutton0.bottom: chainTop", +"Freeciv*dipcitymenubutton0.left: chainLeft", +"Freeciv*dipcitymenubutton0.right: chainRight", +"Freeciv*dipcitymenubutton1.label: Cities", +"Freeciv*dipcitymenubutton1.fromVert: diptechmenubutton1", +"Freeciv*dipcitymenubutton1.foreground: white", +"Freeciv*dipcitymenubutton1.background: blue", +"Freeciv*dipcitymenubutton1.top: chainTop", +"Freeciv*dipcitymenubutton1.bottom: chainTop", +"Freeciv*dipcitymenubutton1.left: chainLeft", +"Freeciv*dipcitymenubutton1.right: chainRight", "Freeciv*dipgoldinput0.foreground: black", "Freeciv*dipgoldinput0.background: white", -"Freeciv*dipgoldinput0.fromVert: diptechmenubutton0", +"Freeciv*dipgoldinput0.fromVert: dipcitymenubutton0", "Freeciv*dipgoldinput0.top: chainTop", "Freeciv*dipgoldinput0.bottom: chainTop", "Freeciv*dipgoldinput0.left: chainLeft", @@ -234,7 +250,7 @@ "Freeciv*dipgoldinput0.*.editType: edit", "Freeciv*dipgoldinput1.foreground: black", "Freeciv*dipgoldinput1.background: white", -"Freeciv*dipgoldinput1.fromVert: diptechmenubutton1", +"Freeciv*dipgoldinput1.fromVert: dipcitymenubutton1", "Freeciv*dipgoldinput1.top: chainTop", "Freeciv*dipgoldinput1.bottom: chainTop", "Freeciv*dipgoldinput1.left: chainLeft", @@ -246,7 +262,7 @@ "Freeciv*dipgoldlabel0.background: lightgrey", "Freeciv*dipgoldlabel0.foreground: black", "Freeciv*dipgoldlabel0.fromHoriz: dipgoldinput0", -"Freeciv*dipgoldlabel0.fromVert: diptechmenubutton0", +"Freeciv*dipgoldlabel0.fromVert: dipcitymenubutton0", "Freeciv*dipgoldlabel0.top: chainTop", "Freeciv*dipgoldlabel0.bottom: chainTop", "Freeciv*dipgoldlabel0.left: chainLeft", @@ -256,7 +272,7 @@ "Freeciv*dipgoldlabel1.background: lightgrey", "Freeciv*dipgoldlabel1.foreground: black", "Freeciv*dipgoldlabel1.fromHoriz: dipgoldinput1", -"Freeciv*dipgoldlabel1.fromVert: diptechmenubutton1", +"Freeciv*dipgoldlabel1.fromVert: dipcitymenubutton1", "Freeciv*dipgoldlabel1.top: chainTop", "Freeciv*dipgoldlabel1.bottom: chainTop", "Freeciv*dipgoldlabel1.left: chainLeft", diff -r -u freeciv-1.7.2-orig/client/diplodlg.c freeciv-1.7.2/client/diplodlg.c --- freeciv-1.7.2-orig/client/diplodlg.c Fri May 1 15:36:16 1998 +++ freeciv-1.7.2/client/diplodlg.c Wed Jan 13 11:45:11 1999 @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -36,6 +37,7 @@ #include #include #include +#include #include #include @@ -58,6 +60,8 @@ Widget dip_map_menubutton1; Widget dip_tech_menubutton0; Widget dip_tech_menubutton1; + Widget dip_city_menubutton0; + Widget dip_city_menubutton1; Widget dip_gold_label0; Widget dip_gold_label1; Widget dip_gold_input0; @@ -103,6 +107,8 @@ XtPointer call_data); void diplomacy_dialog_tech_callback(Widget w, XtPointer client_data, XtPointer call_data); +void diplomacy_dialog_city_callback(Widget w, XtPointer client_data, + XtPointer call_data); void close_diplomacy_dialog(struct Diplomacy_dialog *pdialog); void update_diplomacy_dialog(struct Diplomacy_dialog *pdialog); @@ -226,6 +232,39 @@ } /**************************************************************** + +Creates a sorted list of plr0's cities, excluding the capital and +any cities not visible to plr1. This means that you can only trade +cities visible to requesting player. + + - Kris Bubendorfer +*****************************************************************/ +void fill_diplomacy_city_menu(Widget popupmenu, + struct player *plr0, struct player *plr1) +{ + int i = 0, j = 0, n = city_list_size(&plr0->cities); + struct city **city_list_ptrs = (struct city **)malloc(sizeof(struct city*)*n); + + city_list_iterate(plr0->cities, pcity) { + if(!city_got_effect(pcity, B_PALACE)){ + city_list_ptrs[i] = pcity; + i++; + } + } city_list_iterate_end; + + qsort(city_list_ptrs, i, sizeof(struct city*), city_name_compare); + + for(j=0; jname, smeBSBObjectClass, + popupmenu, NULL); + XtAddCallback(entry, XtNcallback, diplomacy_dialog_city_callback, + (XtPointer)(plr0->player_no*100000+plr1->player_no*10000+city_list_ptrs[j]->id)); + } +} + + +/**************************************************************** ... *****************************************************************/ struct Diplomacy_dialog *create_diplomacy_dialog(struct player *plr0, @@ -338,6 +377,34 @@ NULL); if(!fill_diplomacy_tech_menu(popupmenu, plr1, plr0)) XtSetSensitive(pdialog->dip_tech_menubutton1, FALSE); + + /* Start of trade city code - Kris Bubendorfer */ + + pdialog->dip_city_menubutton0=XtVaCreateManagedWidget("dipcitymenubutton0", + menuButtonWidgetClass, + pdialog->dip_form0, + NULL); + popupmenu=XtVaCreatePopupShell("menu", + simpleMenuWidgetClass, + pdialog->dip_city_menubutton0, + NULL); + + fill_diplomacy_city_menu(popupmenu, plr0, plr1); + XtSetSensitive(pdialog->dip_city_menubutton0, TRUE); + + + pdialog->dip_city_menubutton1=XtVaCreateManagedWidget("dipcitymenubutton1", + menuButtonWidgetClass, + pdialog->dip_form1, + NULL); + popupmenu=XtVaCreatePopupShell("menu", + simpleMenuWidgetClass, + pdialog->dip_city_menubutton1, + NULL); + fill_diplomacy_city_menu(popupmenu, plr1, plr0); + XtSetSensitive(pdialog->dip_city_menubutton1, TRUE); + + /* End of trade city code */ pdialog->dip_gold_input0=XtVaCreateManagedWidget("dipgoldinput0", asciiTextWidgetClass, @@ -458,11 +525,13 @@ XtVaGetValues(pdialog->dip_map_menubutton0, XtNwidth, &maxwidth, NULL); XtVaGetValues(pdialog->dip_tech_menubutton0, XtNwidth, &width, NULL); + XtVaGetValues(pdialog->dip_city_menubutton0, XtNwidth, &width, NULL); maxwidth=MAX(width, maxwidth); XtVaGetValues(pdialog->dip_gold_input0, XtNwidth, &width, NULL); maxwidth=MAX(width, maxwidth); XtVaSetValues(pdialog->dip_map_menubutton0, XtNwidth, maxwidth, NULL); XtVaSetValues(pdialog->dip_tech_menubutton0, XtNwidth, maxwidth, NULL); + XtVaSetValues(pdialog->dip_city_menubutton0, XtNwidth, maxwidth, NULL); XtVaSetValues(pdialog->dip_gold_input0, XtNwidth, maxwidth, NULL); XtVaGetValues(pdialog->dip_formm, XtNheight, &height, NULL); @@ -498,6 +567,11 @@ get_race_name_plural(pclause->from->race), advances[pclause->value].name); break; + case CLAUSE_CITY: + sprintf(pdialog->clauselist_strings[i], "The %s give %s", + get_race_name_plural(pclause->from->race), + find_city_by_id(pclause->value)->name); + break; case CLAUSE_GOLD: sprintf(pdialog->clauselist_strings[i], "The %s give %d gold", get_race_name_plural(pclause->from->race), @@ -542,6 +616,31 @@ pa.clause_type=CLAUSE_ADVANCE; pa.plrno_from=pa.plrno0; pa.value=choice%100; + + send_packet_diplomacy_info(&aconnection, PACKET_DIPLOMACY_CREATE_CLAUSE, + &pa); +} + +/**************************************************************** +Callback for trading cities + - Kris Bubendorfer +*****************************************************************/ +void diplomacy_dialog_city_callback(Widget w, XtPointer client_data, + XtPointer call_data) +{ + int choice; + struct packet_diplomacy_info pa; + + choice=(int)client_data; + + pa.plrno0=choice/100000; + choice -= pa.plrno0 * 100000; + pa.plrno1=(choice/10000); + choice -= pa.plrno1 * 10000; + + pa.clause_type=CLAUSE_CITY; + pa.plrno_from=pa.plrno0; + pa.value=choice; send_packet_diplomacy_info(&aconnection, PACKET_DIPLOMACY_CREATE_CLAUSE, &pa); diff -r -u freeciv-1.7.2-orig/common/diptreaty.h freeciv-1.7.2/common/diptreaty.h --- freeciv-1.7.2-orig/common/diptreaty.h Fri May 1 15:45:24 1998 +++ freeciv-1.7.2/common/diptreaty.h Wed Jan 13 09:04:15 1999 @@ -1,7 +1,7 @@ #ifndef __DIPTREATY__H #define __DIPTREATY__H -enum clause_type { CLAUSE_ADVANCE, CLAUSE_GOLD, CLAUSE_MAP, CLAUSE_SEAMAP }; +enum clause_type { CLAUSE_ADVANCE, CLAUSE_GOLD, CLAUSE_MAP, CLAUSE_SEAMAP, CLAUSE_CITY}; struct Clause { enum clause_type type; diff -r -u freeciv-1.7.2-orig/data/Freeciv freeciv-1.7.2/data/Freeciv --- freeciv-1.7.2-orig/data/Freeciv Thu Dec 24 04:42:57 1998 +++ freeciv-1.7.2/data/Freeciv Wed Jan 13 09:04:15 1999 @@ -313,9 +313,27 @@ Freeciv*diptechmenubutton1.left: chainLeft Freeciv*diptechmenubutton1.right: chainRight +Freeciv*dipcitymenubutton0.label: Cities +Freeciv*dipcitymenubutton0.fromVert: diptechmenubutton0 +Freeciv*dipcitymenubutton0.foreground: white +Freeciv*dipcitymenubutton0.background: blue +Freeciv*dipcitymenubutton0.top: chainTop +Freeciv*dipcitymenubutton0.bottom: chainTop +Freeciv*dipcitymenubutton0.left: chainLeft +Freeciv*dipcitymenubutton0.right: chainRight + +Freeciv*dipcitymenubutton1.label: Cities +Freeciv*dipcitymenubutton1.fromVert: diptechmenubutton1 +Freeciv*dipcitymenubutton1.foreground: white +Freeciv*dipcitymenubutton1.background: blue +Freeciv*dipcitymenubutton1.top: chainTop +Freeciv*dipcitymenubutton1.bottom: chainTop +Freeciv*dipcitymenubutton1.left: chainLeft +Freeciv*dipcitymenubutton1.right: chainRight + Freeciv*dipgoldinput0.foreground: black Freeciv*dipgoldinput0.background: white -Freeciv*dipgoldinput0.fromVert: diptechmenubutton0 +Freeciv*dipgoldinput0.fromVert: dipcitymenubutton0 Freeciv*dipgoldinput0.top: chainTop Freeciv*dipgoldinput0.bottom: chainTop Freeciv*dipgoldinput0.left: chainLeft @@ -325,7 +343,7 @@ Freeciv*dipgoldinput1.foreground: black Freeciv*dipgoldinput1.background: white -Freeciv*dipgoldinput1.fromVert: diptechmenubutton1 +Freeciv*dipgoldinput1.fromVert: dipcitymenubutton1 Freeciv*dipgoldinput1.top: chainTop Freeciv*dipgoldinput1.bottom: chainTop Freeciv*dipgoldinput1.left: chainLeft @@ -338,7 +356,7 @@ Freeciv*dipgoldlabel0.background: lightgrey Freeciv*dipgoldlabel0.foreground: black Freeciv*dipgoldlabel0.fromHoriz: dipgoldinput0 -Freeciv*dipgoldlabel0.fromVert: diptechmenubutton0 +Freeciv*dipgoldlabel0.fromVert: dipcitymenubutton0 Freeciv*dipgoldlabel0.top: chainTop Freeciv*dipgoldlabel0.bottom: chainTop Freeciv*dipgoldlabel0.left: chainLeft @@ -349,7 +367,7 @@ Freeciv*dipgoldlabel1.background: lightgrey Freeciv*dipgoldlabel1.foreground: black Freeciv*dipgoldlabel1.fromHoriz: dipgoldinput1 -Freeciv*dipgoldlabel1.fromVert: diptechmenubutton1 +Freeciv*dipgoldlabel1.fromVert: dipcitymenubutton1 Freeciv*dipgoldlabel1.top: chainTop Freeciv*dipgoldlabel1.bottom: chainTop Freeciv*dipgoldlabel1.left: chainLeft diff -r -u freeciv-1.7.2-orig/data/helpdata.txt freeciv-1.7.2/data/helpdata.txt --- freeciv-1.7.2-orig/data/helpdata.txt Wed Jan 13 11:44:07 1999 +++ freeciv-1.7.2/data/helpdata.txt Wed Jan 13 11:41:10 1999 @@ -386,7 +386,7 @@ 7. Exploring the world. 8. Things to keep in mind. 9. Make your own strategy for the game. - +10. Interacting with other players (Diplomacy). 0. Choosing the first city site. @@ -510,6 +510,49 @@ pages at http://www.freeciv.org You'll find more tips for playing, and details of how to contact other players. + + 10. Interacting with other players (Diplomacy). + + Humans and AI differ in many ways, but the most significant is + the additional diplomacy that you can take part in with other + humans - and no, we are not talking about using spies and + diplomats to incite and steal. + + If you have established an embassy with another human player, + then you can arrange a diplomatic meeting. This is done by + going to the `Game' menu, selecting players and clicking on + the player with whom you wish to meet. If you actually have + an embassy (denoted by an X) and the other player is connected + then a diplomacy menu will pop up. + + In this menu you can choose to: + + - Trade Maps (Sea or entire map), + + - Trade advances, + + - Trade Cities, + + - and Give Gold. + + There is no need to trade like for like, by trading say, + an advance or city for gold - you can can consider this + buying and selling. + + A couple of notes: + + - You can't give away your capital. + + - If you can't see a city on your map, then you can't + request it. + + Of course, the owner of that city can still give it to + you, in which case the area around the city is shown + on your map. One important thing to note, any units + in the field and supported by that city are also transfered + (but not those sitting in other cities). So make sure the + other player isn't getting a better deal than you expect. + --- #City Improvements diff -r -u freeciv-1.7.2-orig/server/citytools.c freeciv-1.7.2/server/citytools.c --- freeciv-1.7.2-orig/server/citytools.c Wed Jan 13 11:44:07 1999 +++ freeciv-1.7.2/server/citytools.c Wed Jan 13 11:05:49 1999 @@ -591,9 +591,10 @@ * Units in a bought city are transferred to the new owner, units * supported by the city, but held in other cities are updated to * reflect those cities as their new homecity. Units supported - * by the bought city, that are not in a city square are deleted. - * This is consistent with Civ2, but units just outside the bought - * city are deleted rather than transferred as in Civ2. + * by the bought city, that are not in a city square may be deleted. + * This depends on the value of kill_outside. Just in case the + * supported units are in an unexplored part of the map, the + * area around them is lightened. * * - Kris Bubendorfer */ @@ -634,6 +635,7 @@ create_unit_full(pplayer, vunit->x, vunit->y, vunit->type, vunit->veteran, pcity->id, vunit->moves_left, vunit->hp); + lighten_area(pplayer, vunit->x,vunit->y); } wipe_unit_spec_safe(0, vunit, NULL, 0); } unit_list_iterate_end; diff -r -u freeciv-1.7.2-orig/server/diplhand.c freeciv-1.7.2/server/diplhand.c --- freeciv-1.7.2-orig/server/diplhand.c Sat Aug 22 08:34:02 1998 +++ freeciv-1.7.2/server/diplhand.c Wed Jan 13 11:13:34 1999 @@ -22,6 +22,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include struct genlist treaties; int did_init_treaties; @@ -155,6 +161,37 @@ notify_player(pdest, "Game: You receive %s's seamap", pgiver->name); break; + case CLAUSE_CITY:{ + struct city *pcity = find_city_by_id(pclause->value); + struct city *pnewcity = NULL; + + notify_player(pdest, "Game: You recieve city of %s from %s", + pcity->name, pgiver->name); + + notify_player(pgiver, "Game: You give city of %s to %s", + pcity->name, pdest->name); + + + if(!(pnewcity = transfer_city(pdest, pgiver, pcity))){ + flog(LOG_DEBUG,"Transfer city returned no city - aborting civil war."); + return; + } + map_set_city(pnewcity->x, pnewcity->y, pnewcity); + transfer_city_units(pdest, pgiver, pnewcity, pcity, 0); + remove_city(pcity); /* don't forget this! */ + map_set_city(pnewcity->x, pnewcity->y, pnewcity); + + city_check_workers(pdest ,pnewcity); + city_refresh(pnewcity); + initialize_infrastructure_cache(pnewcity); + send_city_info(0, pnewcity, 0); + + unit_list_iterate(pdest->units, punit) + resolve_unit_stack(punit->x, punit->y); + unit_list_iterate_end; + + break; + } } } @@ -205,6 +242,21 @@ plr0=&game.players[packet->plrno0]; plr1=&game.players[packet->plrno1]; pgiver=&game.players[packet->plrno_from]; + + /* + * If we are trading cities, then it is possible that the + * dest is unaware of it's existence. We have 2 choices, + * forbid it, or lighten that area. If we assume that + * the giver knows what they are doing, then 2. is the + * most powerful option - I'll choose that for now. + * - Kris Bubendorfer + */ + + if(packet->clause_type == CLAUSE_CITY){ + struct city *pcity = find_city_by_id(packet->value); + if(pcity && !map_get_known(pcity->x, pcity->y, plr1)) + lighten_area(plr1, pcity->x, pcity->y); + } if((ptreaty=find_treaty(plr0, plr1))) { if(add_clause(ptreaty, pgiver, packet->clause_type, packet->value)) {