Complete.Org: Mailing Lists: Archives: freeciv-ai: December 2004:
[freeciv-ai] (PR#9610) autosettler "territory" and danger maps
Home

[freeciv-ai] (PR#9610) autosettler "territory" and danger maps

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [freeciv-ai] (PR#9610) autosettler "territory" and danger maps
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 19 Dec 2004 10:22:09 -0800
Reply-to: bugs@xxxxxxxxxxx

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

You can't cast an int as a void* and treat it as a pointer.  This won't work on 
64-bit systems 
where sizeof(int) != sizeof(void*).  (Or so I'm told; I've never actually 
compiled on a 64-bit 
system.)

There are two choices (unless you want to redesign the movemap to hold unit 
pointers 
directly and work properly with deletions).  Probably the better one is to 
malloc(sizeof(int)) 
and keep the unit ID in a malloced pointer.  Naturally you then have to free 
the pointer 
afterwards.  The other is to develop our own version of G_POINTER_TO_INT/
G_INT_TO_POINTER that could probably just be copied verbatim from the glib 
sources.  
Naturally then we have to make sure this macro works on any new systems that 
turn up in 
the future.

-jason




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