<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39905 >

Two places in the client/ code define variables midway through functions.

This can break older compilers unnecessarily and has been reported on 
IRC today as a problem when compiling on beos.

This patch fixes it - for 2.1, should apply to 2.2 and trunk as well.

There are more such places in gui-sdl as well.

-jason


Index: client/reqtree.c
===================================================================
--- client/reqtree.c	(revision 14048)
+++ client/reqtree.c	(working copy)
@@ -907,6 +907,8 @@
 static enum reqtree_edge_type get_edge_type(struct tree_node *node, 
                                             struct tree_node *dest_node)
 {
+  struct player_research* research;
+
   if (dest_node == NULL) {
     /* assume node is a dummy */
     dest_node = node;
@@ -921,9 +923,10 @@
   /* find destination advance by recursing in dest_node->provide[]
    * watch out: recursion */
   if (dest_node->is_dummy) {
-    assert(dest_node->nprovide > 0);
     enum reqtree_edge_type sum_type = REQTREE_EDGE;
     int i;
+
+    assert(dest_node->nprovide > 0);
     for (i = 0; i < dest_node->nprovide; ++i) {
       enum reqtree_edge_type type = get_edge_type(node, dest_node->provide[i]);
       switch (type) {
@@ -942,7 +945,7 @@
     return sum_type;
   }
 
-  struct player_research* research = get_player_research(game.player_ptr);
+  research = get_player_research(game.player_ptr);
 
   if (!game.player_ptr || !research) {
     return REQTREE_KNOWN_EDGE; /* Global observer case */
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to