Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2000:
[Freeciv-Dev] Warning fixes for server/settlers.c
Home

[Freeciv-Dev] Warning fixes for server/settlers.c

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Warning fixes for server/settlers.c
From: Dirk Stoecker <stoecker@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 5 Aug 2000 14:00:49 +0200 (MET DST)

Hi,

one more warning fixed file. This time not that easy.

/server/settlers.c 449 Warning 220: old-fashioned assignment operator
/server/settlers.c 961 Warning 220: old-fashioned assignment operator
/server/settlers.c 962 Warning 220: old-fashioned assignment operator
/server/settlers.c 1521 Warning 220: old-fashioned assignment operator
/server/settlers.c 1521 Warning 220: old-fashioned assignment operator

Added spaces between =-.
Last one in common/city.h.

/server/settlers.c 685 Warning 317: possibly uninitialized variable "rd"
/server/settlers.c 686 Warning 317: possibly uninitialized variable "te"
/server/settlers.c 687 Warning 317: possibly uninitialized variable "rd"
/server/settlers.c 688 Warning 317: possibly uninitialized variable "te"
/server/settlers.c 689 Warning 317: possibly uninitialized variable "rd"
/server/settlers.c 690 Warning 317: possibly uninitialized variable "te"
/server/settlers.c 691 Warning 317: possibly uninitialized variable "rd"
/server/settlers.c 692 Warning 317: possibly uninitialized variable "te"
/server/settlers.c 694 Warning 317: possibly uninitialized variable "rd"
/server/settlers.c 694 Warning 317: possibly uninitialized variable "te"
/server/settlers.c 695 Warning 317: possibly uninitialized variable "rd"
/server/settlers.c 695 Warning 317: possibly uninitialized variable "te"
/server/settlers.c 696 Warning 317: possibly uninitialized variable "rd"
/server/settlers.c 696 Warning 317: possibly uninitialized variable "te"
/server/settlers.c 697 Warning 317: possibly uninitialized variable "rd"
/server/settlers.c 697 Warning 317: possibly uninitialized variable "te"

Joined ii,jj and rd,te variables as they are used linear and the pos values
can be overwritten. Saves some stack space also (24*sizeof(int) = 96 byte
on my machine).

/server/settlers.c 228 Warning 304: dead assignment eliminated "n"
/server/settlers.c 933 Warning 304: dead assignment eliminated "d"
/server/settlers.c 933 Warning 304: dead assignment eliminated "b"

removed assignment.

/server/settlers.c 408 Warning 317: possibly uninitialized variable "best"
/server/settlers.c 1132 Warning 317: possibly uninitialized variable "bx"
/server/settlers.c 1132 Warning 317: possibly uninitialized variable "by"

added assignments to 0

/server/settlers.c 1321 Warning 308: inline function does not use formal 
parameter "pplayer"
/server/settlers.c 1323 Warning 308: inline function does not use formal 
parameter "pplayer"
/server/settlers.c 1325 Warning 308: inline function does not use formal 
parameter "pplayer"

Removed arguments in function and function call.

Here is a possible bug.

The first one is related to ai_calc_pollution, where it read in line 510.
  m = (m + best + 50) * 2;

Function ai_calc_fallout is equal to this one, but uses pplayer argument as
it preceeds that line with:

  if (!pplayer->ai.control)
    m = (m + best + 50) * 2;

So either my remove of pplayer is correct, as it is not needed or the if
must be added in ai_calc_pollution also and the pplayer argument is needed.

P.S. Fixed some comment text errors as well.

Ciao
 ____  _ _  ____  _ _    _ _  ____
|    |  |  |    |  | \  / |  |    | the cool Gremlin from Bischofswerda
|  __   |   ____|  |  \/  |  |    | WWW: http://home.pages.de/~stoecker/
|    |  |  |       |      |  |    | PGP key available on www page.
|____| _|_ |____| _|_    _|_ |____| I hope AMIGA never ends to make fun!

Attachment: OptSettlers.diff.gz
Description: Binary data


[Prev in Thread] Current Thread [Next in Thread]