CleverRaven/Cataclysm-DDA — pull request #5593 by BevapDin (2014-01-17 14:50:44+00:00)
Title: Allow access to content of overmaps to use global coordinates. [WIP]

This PR adds some functions to the overmap buffer, that allow to access an overmap with global overmap terrain coordinates, without first getting that overmap from the buffer.
The overmap buffer translates the coordinates to overmap local positions, gets the overmap and calls the specific function on that overmap (with local coordinates).

So instead of:
```
int ov_x = x / OMAPX;
int ov_y = y / OMAPY;
int lx = x % OMAPX;
int ly = y % OMAPY;
overmap &om = overmap_buffer.get(ov_x, oc_y);
return om.has_note(lx, ly, z);
```
one can simply write `return overmap_buffer.has_note(x, y, z);` and
```
point cur_loc = om_location();
oter_id cur_ter = cur_om->ter(cur_loc.x, cur_loc.y, levz);
if (cur_ter == "")
{
if (cur_loc.x >= OMAPX && cur_loc.y >= OMAPY)
cur_ter = om_diag->ter(cur_loc.x - OMAPX, cur_loc.y - OMAPY, levz);
else if (cur_loc.x >= OMAPX)
cur_ter = om_hori->ter(cur_loc.x - OMAPX, cur_loc.y, levz);
else if (cur_loc.y >= OMAPY)
cur_ter = om_vert->ter(cur_loc.x, cur_loc.y - OMAPY, levz);
}
```
becomes `const oter_id& cur_ter = overmap_buffer.ter(om_global_location());`

----
Changes:

- Several functions (like `overmap::draw`, mapgen.cpp) contained checks for diagonal/horizontal/vertical adjacent overmaps if the position is outside of cur_om - this is now handled by the overmap buffer.
- Therefor the om_hori, om_vert, om_diag and set_adjacent_overmaps from the game class are not used anymore and have been removed. Whenever an overmap is needed, call overmap_buffer.get..., those functions handle the outside-of-cur_om situation.
- A new overmap is only generated if the terrain there is actually requested. Currently scrolling the map view would create new overmaps, even if no actual terrain data of the map is required, because all of it is still invisible.

----
I'd like to move more functions from overmap to overmap_buffer up to a point where overmaps are only accessed though the wrapper of overmapbuffer.
These wrapper functions can dispatch the call to the actual overmap, or collect data from several overmaps.

TODO:
- Display/add/remove notes in unexplored terrain.
- Reformat overmap::draw and make it static, as it does not need a specific overmap.
- Search for notes in all overmaps.
- Missions are still created on the current overmap and the stored target is *local* to the current overmap.
- Several parts of the code only use `game::cur_om` which is actually the overmap that contains the top left loaded submap (`map::grid[0]`), not necessarily the overmap the player is on.
- Vehicle tracker adds vehicle to current overmap.
- Computers would only reveal things on the current overmap (same for initial revealed area).
- Some code (`iuse::radio_on`) uses (levx, levy) as center point, instead of levx+MAPSIZE/2, levy+MAPSIZE/2).
- Currently many things do not work correctly if the PC is near the overmap border (npc and monsters are only loaded from the current overmap).