| [Freeciv-Dev] server/cityturn.c patch for better math.[Top] [All Lists][Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
 
         Pardon my French, but Solaris diff doesn't seem to support -u, and I
don't have gnudiff installed.  ^$^*&$^
        Server/cityturn.c has inefficient and slightly incorrect math.
Since we're increasing city size anyway, it's silly to use (+1) and later
++ it.  Also, a granary allows a city to keep half of their food supply when
growing.  size*(foodbox/2) will understate this effect when foodbox is odd,
should someone take the time to customize it.  It is more correct to do
(size*foodbox)/2.
        This is from the November-14 CVS tarball.
zevon: tail +780 cityturn.c.old | head -10
  }
  if (has_granary)
    pcity->food_stock = (pcity->size + 1) * (game.foodbox / 2);
  else
    pcity->food_stock = 0;
  
  pcity->size++;
  if (!add_adjust_workers(pcity))
    auto_arrange_workers(pcity);
zevon: tail +780 cityturn.c | head -10    
  }
  pcity->size++;
  if (has_granary)
    pcity->food_stock = (pcity->size * game.foodbox) / 2;
  else
    pcity->food_stock = 0;
  
  if (!add_adjust_workers(pcity))
    auto_arrange_workers(pcity);
zevon: 
-- 
Anthony J. Stuckey                              stuckey@xxxxxxxxxxxxxxxxx
"When I was young, the sky was filled with stars.
 I watched them burn out one by one."  -Warren Zevon
 
| [Prev in Thread] | Current Thread | [Next in Thread] |  
[Freeciv-Dev] server/cityturn.c patch for better math.,
Tony & <=
 
 |  |