This fixes the lag when moving character close to overmap boreders in the play-field:
1.) game.cpp, void game::update_map(int &x, int &y)
Move update_overmap_seen(); from the end of that function into this block of code in the same function:
[code] if(olevx != 0 || olevy != 0)
{
cur_om.save();
cur_om = overmap(this, cur_om.pos().x + olevx, cur_om.pos().y + olevy);
update_overmap_seen();
add_msg("CROSSING REGION BORDER...");
}[/code]
You could also place this bit before call to m.shift(this, levx, levy, levz, shiftx, shifty);
[code] if(!shiftx && !shifty)
return;
m.shift(this, levx, levy, levz, shiftx, shifty);
levx += shiftx;
levy += shifty;
.
.
[/code]
2.) mapgen.cpp, void map::generate(game *g, overmap *om, const int x, const int y, const int z, const int turn)
.
.
else {
// dbg(D_INFO) << "map::generate: In section 2";
g->add_msg("SECTION B, GENERATE-1");
t_above = om->ter(overx, overy, z + 1);
terrain_type = om->ter(overx, overy, z);
if (overy - 1 >= 0)
t_north = om->ter(overx, overy - 1, z);
else {
// overmap tmp(g, om->pos().x, om->pos().y - 1);
// t_north = tmp.ter(overx, OMAPY - 1, z);
}
if (overx + 1 < OMAPX)
t_east = om->ter(overx + 1, overy, z);
else {
// overmap tmp(g, om->pos().x + 1, om->pos().y);
// t_east = tmp.ter(0, overy, z);
}
if (overy + 1 < OMAPY)
t_south = om->ter(overx, overy + 1, z);
else {
// overmap tmp(g, om->pos().x, om->pos().y + 1);
// t_south = tmp.ter(overx, 0, z);
}
if (overx - 1 >= 0)
t_west = om->ter(overx - 1, overy, z);
else {
// overmap tmp(g, om->pos().x - 1, om->pos().y);
// t_west = tmp.ter(OMAPX - 1, overy, z);
}
g->add_msg("SECTION B, GENERATE-2");
}
Strangely “generate in section 1” block of code doesn’t seem to be executed ever, even if it seems that’s the one that should be handling overmaps when crossing overmap border.
I obviously haven’t looked into it past removing the glitch, so these changes could be producing some other bugs or have who knows what side effects, but since you guys are far more familiar with the code in general that’s something you should be able to sort out better than me, and fix it properly. Please let me know when you do. I haven’t seen any bugs though, but that’s very strange fix and so there are most likely more things that need to be changed to make it proper and complete.