Searching for targets: squares versus circles

Discuss the future of Warzone 2100 with us.
User avatar
mfreire
New user
Posts: 4
Joined: 05 Nov 2008, 01:20

Searching for targets: squares versus circles

Post by mfreire »

Hi,

Since Ubuntu 8.10 doesn't have updated versions in the repository (beta4 is buggy indeed), I decided to download the source from SVN. While waiting for everything to finish, I started browsing through the code.

Within 'actionVTOLLandingPos', the algorithm to find a landing place involves looking at the droid's present position, and using increasingly wide (+1 tile in each direction per iteration) square borders to look for a nice landing place. This leads to VTOLs using 'Manhattan Distance' (instead of straight-line distance). I would like to contribute some code to transform this square search into a spiral. How can I submit a patch, or should I just post it as a message to the forum?

The patch adds a function 'spiralSearch' with the following prototype:

Code: Select all

BOOL spiralSearch(SDWORD startX, SDWORD startY, SDWORD radius, searchFunction f, void *data);
where the searchFunction is typedeffed as something with prototype

Code: Select all

BOOL f(SDWORD x, SDWORD y, void *data);
that will be called whenever there is a new x,y to evaluate, and should return 'true' if the search should continue, or 'false' if it should be aborted. (Do you have any policies on code style regarding function pointers?). Efficiency should be similar to that of the present implementation.
User avatar
whippersnapper
Regular
Regular
Posts: 1183
Joined: 21 Feb 2007, 15:46

Re: Searching for targets: squares versus circles

Post by whippersnapper »

.

the following page will afford guidance for contributing to the project:

http://wiki.wz2100.net/Coding

.
.
"I need no warrant for being, and no word of sanction upon my being. I am the warrant and the sanction." Anthem

"Art is the selective recreation of reality according to the artist's metaphysical value judgments." A. Rand
.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Searching for targets: squares versus circles

Post by Per »

Add the patch to a new ticket at http://developer.wz2100.net/

Thanks for contributing!