Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2000:
[Freeciv-Dev] DIR_X, DIR_Y patch correction
Home

[Freeciv-Dev] DIR_X, DIR_Y patch correction

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] DIR_X, DIR_Y patch correction
From: Dirk Stoecker <stoecker@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 17 Jul 2000 09:28:21 +0200 (MET DST)

Hi,

The DIR_X, DIR_Y fix is not very clever, as all modules produce a copy of
this array now, which is really wasted space (nearly every module reports
static variable unreachable)!

Here the definition of map.h:
static const int DIR_DX[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
static const int DIR_DY[8] = { -1, -1, -1, 0, 0, 1, 1, 1 };

change it to:
IMPORT const int DIR_DX[8];
IMPORT const int DIR_DY[8];

and add in map.c:
const int DIR_DX[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
const int DIR_DY[8] = { -1, -1, -1, 0, 0, 1, 1, 1 };

Now it is really an GLOBAL variable and not an multi-copied local one.
Normally variable declarations should never be in .h files!

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!

************************************************************************
* snail-mail: Dirk Stoecker              * e-mail:                     *
*             Geschwister-Scholl-Str. 10 * stoecker@xxxxxxxxxxxxxx     *
*             01877 Bischofswerda        * phone:                      *
*             GERMANY                    * GERMANY +49 (0)3594/706666  *
************************************************************************




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