Complete.Org: Mailing Lists: Archives: freeciv-dev: February 1999:
[Freeciv-Dev] capability cleanup pre 1.8
Home

[Freeciv-Dev] capability cleanup pre 1.8

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] capability cleanup pre 1.8
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Sun, 28 Feb 1999 12:12:19 +1100

This patch replaces all the current capability tags by
the single tag "+1.8pre1".  The idea is that for 1.8.0
the capability string will be "+1.8", and this patch
is to test things properly before release.

I also changed researched and researchpoints into 32 bit
ints, to avoid possible over/under-flows.

This doesn't do the change to network byte order.
It also doesn't do anything about savefile_options;
those probably shouldn't be changed, to keep backward
compability with old savefiles when people upgrade.

-- David
diff -u -r --exclude-from exclude fc-adv/client/citydlg.c 
freeciv-mod/client/citydlg.c
--- fc-adv/client/citydlg.c     Sun Feb 28 12:02:38 1999
+++ freeciv-mod/client/citydlg.c        Sun Feb 28 12:04:03 1999
@@ -48,7 +48,6 @@
 #include <helpdlg.h>
 #include <graphics.h>
 #include <optiondlg.h>         /* for toggle_callback */
-#include <clinet.h>            /* server_has_autoattack */
 #include <cityrep.h>
 
 extern Display *display;
@@ -222,8 +221,7 @@
     XtSetSensitive(pdialog->show_units_command,
                    unit_list_size(&map_get_tile(pcity->x,pcity->y)->units)
                   ?True:False);
-    XtSetSensitive(pdialog->cityopt_command,
-                  server_has_autoattack?True:False);
+    XtSetSensitive(pdialog->cityopt_command, True);
   }
   if(pcity->owner == game.player_idx)  {
     city_report_dialog_update_city(pcity);
diff -u -r --exclude-from exclude fc-adv/client/clinet.c 
freeciv-mod/client/clinet.c
--- fc-adv/client/clinet.c      Thu Feb 11 18:29:27 1999
+++ freeciv-mod/client/clinet.c Sun Feb 28 12:04:03 1999
@@ -52,7 +52,7 @@
 extern Widget toplevel, main_form, menu_form, below_menu_form, 
left_column_form;
 
 struct connection aconnection;
-int server_has_autoattack=0;
+
 extern int errno;
 extern XtInputId x_input_id;
 extern XtAppContext app_context;
diff -u -r --exclude-from exclude fc-adv/client/clinet.h 
freeciv-mod/client/clinet.h
--- fc-adv/client/clinet.h      Thu Feb 11 18:29:27 1999
+++ freeciv-mod/client/clinet.h Sun Feb 28 12:04:03 1999
@@ -30,7 +30,4 @@
 extern struct connection aconnection;
 /* this is the client's connection to the server */
 
-extern int server_has_autoattack;
-/* cache whether the server knows about autoattack (from capability string) */
-
 #endif
diff -u -r --exclude-from exclude fc-adv/client/diplodlg.c 
freeciv-mod/client/diplodlg.c
--- fc-adv/client/diplodlg.c    Sun Jan 17 17:31:53 1999
+++ freeciv-mod/client/diplodlg.c       Sun Feb 28 12:04:03 1999
@@ -274,7 +274,6 @@
   char buf[512], *pheadlinem;
   struct Diplomacy_dialog *pdialog;
   Dimension width, height, maxwidth;
-  int tradecities = FALSE;
   Widget popupmenu;
   Widget entry;
   XtTranslations textfieldtranslations;
@@ -382,13 +381,6 @@
 
   /* Start of trade city code - Kris Bubendorfer */
 
-  
-  if(has_capability("tradecities", aconnection.capability) 
-     && has_capability("tradecities", plr0->conn->capability) 
-     && has_capability("tradecities", plr1->conn->capability))
-    tradecities = TRUE;
-
-     
   pdialog->dip_city_menubutton0=XtVaCreateManagedWidget("dipcitymenubutton0", 
                                                        menuButtonWidgetClass,
                                                        pdialog->dip_form0,
@@ -400,7 +392,7 @@
   
   
   fill_diplomacy_city_menu(popupmenu, plr0, plr1);
-  XtSetSensitive(pdialog->dip_city_menubutton0, tradecities);
+  XtSetSensitive(pdialog->dip_city_menubutton0, TRUE);
   
   
   pdialog->dip_city_menubutton1=XtVaCreateManagedWidget("dipcitymenubutton1", 
@@ -413,7 +405,7 @@
                                 NULL);
   
   fill_diplomacy_city_menu(popupmenu, plr1, plr0);
-  XtSetSensitive(pdialog->dip_city_menubutton1, tradecities);  
+  XtSetSensitive(pdialog->dip_city_menubutton1, TRUE);  
   
   /* End of trade city code */
   
diff -u -r --exclude-from exclude fc-adv/client/mapctrl.c 
freeciv-mod/client/mapctrl.c
--- fc-adv/client/mapctrl.c     Wed Feb 24 20:35:30 1999
+++ freeciv-mod/client/mapctrl.c        Sun Feb 28 12:04:03 1999
@@ -301,14 +301,10 @@
 void request_unit_auto(struct unit *punit)
 {
   if (can_unit_do_auto(punit)) {
-    if (is_military_unit(punit) && !server_has_autoattack) {
-      append_output_window("Game: server doesn't support auto-attack.");
-    } else {
-      struct packet_unit_request req;
-      req.unit_id=punit->id;
-      req.name[0]='\0';
-      send_packet_unit_request(&aconnection, &req, PACKET_UNIT_AUTO);
-    }
+    struct packet_unit_request req;
+    req.unit_id=punit->id;
+    req.name[0]='\0';
+    send_packet_unit_request(&aconnection, &req, PACKET_UNIT_AUTO);
   } else {
     append_output_window("Game: Only settlers, and military units"
                         " in cities, can be put in auto-mode.");
diff -u -r --exclude-from exclude fc-adv/client/menu.c freeciv-mod/client/menu.c
--- fc-adv/client/menu.c        Wed Feb 24 20:35:30 1999
+++ freeciv-mod/client/menu.c   Sun Feb 28 12:04:03 1999
@@ -265,7 +265,6 @@
 
       menu_entry_sensitive(orders_menu, MENU_ORDER_AUTO_ATTACK, 
                           (can_unit_do_auto(punit)
-                           && server_has_autoattack
                            && !unit_flag(punit->type, F_SETTLERS)));
 
       menu_entry_sensitive(orders_menu, MENU_ORDER_CITY, 
diff -u -r --exclude-from exclude fc-adv/client/packhand.c 
freeciv-mod/client/packhand.c
--- fc-adv/client/packhand.c    Mon Feb 22 21:10:54 1999
+++ freeciv-mod/client/packhand.c       Sun Feb 28 12:04:04 1999
@@ -54,7 +54,6 @@
   char *s_capability = aconnection.capability;
 
   strcpy(s_capability, packet->capability);
-  server_has_autoattack = has_capability("autoattack1", s_capability);
 
   if (packet->you_can_join) {
     freelog(LOG_DEBUG, "join game accept:%s", packet->message);
diff -u -r --exclude-from exclude fc-adv/common/packets.c 
freeciv-mod/common/packets.c
--- fc-adv/common/packets.c     Wed Feb 17 11:50:25 1999
+++ freeciv-mod/common/packets.c        Sun Feb 28 12:04:04 1999
@@ -662,8 +662,8 @@
   cptr=put_int8(cptr, pinfo->science);
   cptr=put_int8(cptr, pinfo->luxury);
 
-  cptr=put_int16(cptr, pinfo->researched);
-  cptr=put_int16(cptr, pinfo->researchpoints);
+  cptr=put_int32(cptr, pinfo->researched);
+  cptr=put_int32(cptr, pinfo->researchpoints);
   cptr=put_int8(cptr, pinfo->researching);
   cptr=put_bit_string(cptr, (char*)pinfo->inventions);
   cptr=put_int16(cptr, pinfo->future_tech);
@@ -674,9 +674,8 @@
   cptr=put_int8(cptr, pinfo->tech_goal);
   cptr=put_int8(cptr, pinfo->ai?1:0);
 
-  if (pc && has_capability("clientcapabilities", pc->capability)) {
-    cptr=put_string(cptr, pinfo->capability);
-  }
+  /* if (pc && has_capability("clientcapabilities", pc->capability)) */
+  cptr=put_string(cptr, pinfo->capability);
 
   put_int16(buffer, cptr-buffer);
 
@@ -712,9 +711,8 @@
   cptr=get_int8(cptr, &pinfo->science);
   cptr=get_int8(cptr, &pinfo->luxury);
 
-  cptr=get_int16(cptr, &pinfo->researched);
-  if(pinfo->researched > 32767) pinfo->researched-=65536;
-  cptr=get_int16(cptr, &pinfo->researchpoints);
+  cptr=get_int32(cptr, &pinfo->researched); /* signed */
+  cptr=get_int32(cptr, &pinfo->researchpoints);
   cptr=get_int8(cptr, &pinfo->researching);
   cptr=get_bit_string(cptr, (char*)pinfo->inventions);
   cptr=get_int16(cptr, &pinfo->future_tech);
@@ -725,10 +723,8 @@
   cptr=get_int8(cptr, &pinfo->tech_goal);
   cptr=get_int8(cptr, &pinfo->ai);
 
-  if (has_capability("clientcapabilities", pc->capability)) 
-    cptr=get_string(cptr, pinfo->capability);
-  else 
-    pinfo->capability[0] = '\0';
+  /* if (has_capability("clientcapabilities", pc->capability)) */
+  cptr=get_string(cptr, pinfo->capability);
   
   remove_packet_from_buffer(&pc->buffer);
   return pinfo;
@@ -1072,10 +1068,9 @@
   cptr=put_city_map(cptr, (char*)req->city_map);
   cptr=put_bit_string(cptr, (char*)req->improvements);
 
-  if(pc && has_capability("autoattack1", pc->capability)) {
-    /* only 8 options allowed before need to extend protocol */
-    cptr=put_int8(cptr, req->city_options);
-  }
+  /* if(pc && has_capability("autoattack1", pc->capability)) */
+  /* only 8 options allowed before need to extend protocol */
+  cptr=put_int8(cptr, req->city_options);
   
   for(data=0;data<4;data++)  {
     if(req->trade[data])  {
@@ -1145,9 +1140,8 @@
   cptr=get_city_map(cptr, (char*)packet->city_map);
   cptr=get_bit_string(cptr, (char*)packet->improvements);
 
-  if(has_capability("autoattack1", pc->capability)) {
-    cptr=get_int8(cptr, &packet->city_options);
-  }
+  /* if(has_capability("autoattack1", pc->capability)) */
+  cptr=get_int8(cptr, &packet->city_options);
 
   for(data=0;data<4;data++)  {
     if(pc->buffer.data+length-cptr < 3)  break;
diff -u -r --exclude-from exclude fc-adv/common/shared.h 
freeciv-mod/common/shared.h
--- fc-adv/common/shared.h      Sun Feb 28 12:03:53 1999
+++ freeciv-mod/common/shared.h Sun Feb 28 12:04:29 1999
@@ -71,8 +71,7 @@
  */
 
 /* The default string is really simple */
-/* rulesets: server sends client data on techs,unit_types,buildings */
-#define CAPABILITY "+1.7 clientcapabilities tradecities +spacerace2 +rulesets 
autoattack1 cityopt"
+#define CAPABILITY "+1.8pre1"
 
 #define CITY_NAMES_FONT "10x20"
 #define BROADCAST_EVENT -2

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] capability cleanup pre 1.8, David Pfitzner <=