[Freeciv-Dev] Re: tile_visible_and_not_on_border_mapcanvas
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
From the direction you are going any naming system would be better.
Personally, I would be mortified if I found myself proposing such
essays as function names. The only advantage I can see is to put
an extremely high barrier up for anyone to use them. It is certainly
not part of any "C" coding style I have ever seen.
Besides the functions are completely unnecessary. You should try the
Unix philosophy of building small modular elements you can combine
easily into sophisticted larger wholes. First you don't need so many
hardwired and generally useless wholes, and second, the small pieces
hopefully won't need such abominable names as the usage code will be
inline and (even more) self-explanatory than the attempted translations
of it.
(canvas_is_visible(pCanvas, x, y) && !canvas_is_border(pCanvas, x, y))
is both shorter and more descriptive code. The leading canvas_ can
disappear if Freeciv moves to C++ and the is_visible and is_border
methods become part of class Canvas. But for now, you can do pseudo
class objects in "C" with instance values as structs for data collection
plus prefixed names and macro definitions or functions for instance
methods. This will also tell you which header file to put the definitions
in, or more appropraitely to look them up, thus avoiding the need for
providing an indexed dictionary and reference when reading code.
Cheers,
RossW
=====
At 06:33 PM 02/11/24 -0500, Jason Dorje Short wrote:
[...]
> Raimar and I agreed on a solution:
... that explains it all.
[...]
> bool area_visible_and_not_on_border_mapcanvas(int canvas_x,
> int canvas_y,
> int canvas_width,
> int canvas_height);
[..]
>How does this sound? And, does anyone have a better naming suggestion?
>
>jason
|
|