[Freeciv-Dev] (PR#6174) Loading transports
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=6174 >
> [rwetmore@xxxxxxxxxxxx - Sun Mar 07 14:27:34 2004]:
> If these are unit functions, then they should start with "unit_"
> followed by the method name. Thus in C++ the unit_ is dropped as they
> are made part of a class unit.
Perhaps. But Freeciv has no standard for doing it this way. Note that
there are can_player_xxx, player_can_xxx, can_unit_xxx, unit_can_xxx,
etc., functions.
Should we introduce this standard?
> So with the unit_ prefix, something like
>
> can_survive_at_tile()
> can_survive_at_tile_fuelled()
>
> is_valid_tile()
> is_valid_tile_and_fuelled()
>
> are slightly better as they at least don't introduce additional
differences
> as between exist and survive, but hopefully give the idea of a basic and
> extended test that just adds more clauses.
Also note that what I called "survival" may mean more than just fuel.
For instance if the terrain is dangerous to the unit (tririemes over
deep water) it should probably be put into a transporter automatically.
Of course then we have to worry about if the transporter can "survive"
on the location - we don't want to load units into a tririeme that's
about to die (unless we have to)!
I don't mind if the programmer can't immediately tell what the function
name ("survive", "exist") means and has to look it up. What I oppose is
if the name is overly simple so as to suggest an inaccurate meaning.
From this point of view, so long as the terminology is unique it doesn't
have to be entirely descriptive. Perhaps we can define "exist" to mean
"be present on the tile without a transporter" and "survive" to mean "be
present on the tile without a transporter for multiple turns without
risk of inanimate death". Then the names would be
unit_can_exist_at_tile
unit_can_survive_at_tile
We should probably go through the full list of functions and make their
names consistent the above ways.
jason
|
|