[Freeciv-Dev] (PR#12774) RFC: new file tile.h
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12774 >
I'd like to move all tile-specific code out of map.h into a new file tile.h.
map.h is the largest common/*.h file and deals with multiple things. I
will leave the topology and global-map code in map.h but everything
relating strictly to struct tile can be moved out. These should also be
renamed to be tile_xxx instead of map_xxx - probably this should happen
afterwards so we first decide what functions are tile and what are
map-related.
* The struct tile declaration.
* map_get_owner/map_set_owner
* map_get_city/map_set_city
* map_get_terrain/map_set_terrain
* map_get_special/map_set_special
* map_clear_special
* map_clear_all_specials
* map_get_known (maybe [1])
* map_has_special + tile_has_special
* map_build_road_time
* map_transform_time
* map_build_rail_time
* map_build_airbase_time
* map_build_fortress_time
* map_clean_pollution_time
* map_clean_fallout_time
* map_activity_time
* map_get_tile_info_text
* map_get_tile_fpt_text
* map_get_continent/map_set_continent
* TILE_XY [2]
* get_tile_output_base (maybe)
* get_tile_infrastructure_set
Some other functions should be moved into terrain.h. As of now
terrain.h contains the functions for "specials" as well as terrain so
these functions should be moved there:
* get_special_name
* get_special_by_name
* contains_special
* get_preferred_pillage (maybe)
* map_get_infrastructure_prerequisite
* map_get_infrastructure_text
Finally a number of functions relate to global or at least regional map
data. Note many "tile" functions actually access global data.
Functions like rand_neighbour are pretty obvious but is_safe_ocean is
less so. These should all stay in map.h:
* All xxx_iterate macros.
* All xxx_to_yyy_pos macros and functions.
* the civ_map structure
* the direction8 enum (I think)
* topo_has_flag
* map_is_empty
* map_init
* map_init_topology
* map_allocate
* map_free
* map_vector_to_real_distance
* map_vector_to_sq_distance
* map_distance
* real_map_distance
* sq_map_distance
* same_pos
* base_get_direction_for_step
* get_direction_for_step
* initialize_move_costs [3]
* reset_move_costs [3]
* all MAP_XXX_SIZE (or XXX_WIDTH/XXX_HEIGHT) macros
* all CHECK_XXX_POS macros
* all do_in_xxx_pos macos
* DIRSTEP
* mapstep
* all xxx_to_tile macros
* is_real_map_pos
* is_normal_map_pos
* is_singular_tile
* normalize_map_pos
* nearest_real_tile
* base_map_distance_vector
* map_distance_vector
* map_num_tiles
* rand_neighbour
* rand_map_pos
* rand_map_pos_filtered
* is_water_adjacent_to_tile
* is_tiles_adjacent
* is_move_cardinal
* map_move_cost
* is_safe_ocean
* is_cardinally_adj_to_ocean
* map_irrigate_tile
* map_mine_tile
* change_terrain
* map_transform_tile [4]
* can_channel_land
* can_reclaim_ocean
* dir_cw
* dir_ccw
* dir_get_name
* is_valid_dir
* is_cardinal_dir
* DIR_DX/DIR_DY
* All map server-settings #defines
* ACTIVITY_FACTOR #define (maybe)
[1] map_get_known is a special-case function because it's declared
separately in server and client. I'm not positive this should be moved.
[2] TILE_XY is a convenience macro and may eventually be removed
[3] As discussed in a long-ago ticket, I think the move costs are
unnecessary.
[4] map_irrigate_tile, map_mine_tile, change_terrain, and
map-transform_tile change the tile struct but may also change data in
adjacent tiles. The can stay in map.h for now.
-jason
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12774) RFC: new file tile.h,
Jason Short <=
|
|