[Freeciv-Dev] Re: PATCH: map iteration (PR#1018)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Fri, Oct 19, 2001 at 09:15:46PM -0400, Ross W. Wetmore wrote:
> The is_normal_map_pos() solution is really just a bad hack because you
> aren't willing to think about the case and fix it right at the moment :-).
>
> But in most cases, the right fix it is far easier than what you are
> proposing.
>
> The examples below should use whole_map_iterate(). When you get weird
> maps, then whole_map_iterate() will become weird, but until then it will
> remain as is, i.e. efficient iteration over the whole map. The change
> when needed is to 1 line of code in a header.
Yes whole_map_iterate should be prefered. However whole_map_iterate
doesn't allow an action if the map position is unreal or an extra
action for every new line.
What about a new macro:
#define whole_map_iterate(x_itr, y_itr,new_line_code,real_code, unreal_code)
{
int x_itr, y_itr;
for (y_itr = 0; y_itr < map.ysize; y_itr++){
new_line_code;
for (x_itr = 0; x_itr < map.xsize; x_itr++)
{
if(is_normal_map_pos(...))
{
real_code;
}
else
{
unreal_code;
}
}
???
> You want to use square_iterate() or block_iterate() in most of the
> other cases. These functions do the right thing by definition. They
> will also not change until they need to.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
1) Customers cause problems.
2) Marketing is trying to create more customers.
Therefore:
3) Marketing is evil.
- [Freeciv-Dev] PATCH: map iteration (PR#1018), jdorje, 2001/10/18
- [Freeciv-Dev] Re: PATCH: map iteration (PR#1018), Raimar Falke, 2001/10/18
- [Freeciv-Dev] Re: PATCH: map iteration (PR#1018), Ross W. Wetmore, 2001/10/19
- [Freeciv-Dev] Re: PATCH: map iteration (PR#1018),
Raimar Falke <=
- [Freeciv-Dev] Re: PATCH: map iteration (PR#1018), Ross W. Wetmore, 2001/10/20
- [Freeciv-Dev] Re: PATCH: map iteration (PR#1018), Jason Dorje Short, 2001/10/21
- [Freeciv-Dev] Re: PATCH: map iteration (PR#1018), Raimar Falke, 2001/10/22
- [Freeciv-Dev] Re: PATCH: map iteration (PR#1018), Jason Dorje Short, 2001/10/22
- [Freeciv-Dev] Re: PATCH: map iteration (PR#1018), Raimar Falke, 2001/10/22
- [Freeciv-Dev] Re: PATCH: map iteration (PR#1018), Jason Dorje Short, 2001/10/22
- [Freeciv-Dev] Re: PATCH: map iteration (PR#1018), Ross W. Wetmore, 2001/10/23
- [Freeciv-Dev] Re: PATCH: map iteration (PR#1018), Raimar Falke, 2001/10/24
- [Freeciv-Dev] Re: PATCH: map iteration (PR#1018), Ross W. Wetmore, 2001/10/28
- [Freeciv-Dev] Re: PATCH: map iteration (PR#1018), Jason Dorje Short, 2001/10/28
|
|