[Freeciv-Dev] Re: Technical questions (numbered tile markers )
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Tue, 8 Jan 2002, Jason Short wrote:
> > 2. Other clients
> > Although I've implemented tile markers only for a non-isometric mode of
> > the GTK client, most of the code for tile markers is common to all
> > clients. However, there is one dependency from the common code to
> > the client specific code: function get_map_pos_under_mouse_pointer. I put
> > the declaration to client/include/mapctrl_g.h. I presume, that I need to
> > define dummy versions of this in all clients to make them compile, right ?
>
> If you've added it to mapctrl_g.h then you must add at least a stub to
> other functions. But be aware that if the code is called the stub must
> behave intelligently.
This can be done. If stub returns NULL (or FALSE, see below), current code
behaves well.
> Also, I'm no GUI expert, but it looks to me like
> such code can be used in multiple places throughout the GUI - but
> perhaps such a thing already exists? I don't know.
I searched for one, but I didn't found. GoTo functionality uses global
variables.
> Your get_map_pos_under_mouse_pointer uses a different structure from
> most other map code. You malloc a map_position structure, and return it
> to give the values. Most other code places the x and y values into
> pointer parameters passed in, and returns TRUE or FALSE to indicate
> whether the values have meaning. The only real problem with your way of
> doing it is that it means youmust free() the pointer later.
Yeah, I noticed this. I'm too used to functional programming and
garbage collectors, so I disliked pointer parameters. It takes some time
to set your brains back to the C-mode :)
I'll change my code to resemble other code. You are right, it's more
convenient that way.
Teemu
- [Freeciv-Dev] Re: Technical questions (numbered tile markers ), (continued)
[Freeciv-Dev] Re: Technical questions (numbered tile markers ), Jason Short, 2002/01/08
[Freeciv-Dev] Re: Technical questions (numbered tile markers ), Daniel Sjölie, 2002/01/09
[Freeciv-Dev] Re: Technical questions (numbered tile markers ), Raimar Falke, 2002/01/09
|
|