Snap to building location on index change

Closes #231
This commit is contained in:
Kurt 2020-05-17 09:14:59 -07:00
parent 6b678ac704
commit 4e1b5ab87f

View File

@ -748,7 +748,10 @@ private void LB_Items_SelectedIndexChanged(object sender, EventArgs e)
if (LB_Items.SelectedIndex < 0)
return;
LoadIndex(LB_Items.SelectedIndex);
ReloadBuildingsTerrain();
// View location snap has changed the view. Reload everything
LoadItemGridAcre();
ReloadMapBackground();
}
private void LoadIndex(int index)
@ -765,6 +768,11 @@ private void LoadIndex(int index)
NUD_TypeArg.Value = b.TypeArg;
NUD_UniqueID.Value = b.UniqueID;
Loading = false;
// -32 for relative offset on map (buildings can be placed on the exterior ocean acres)
// -16 to put it in the center of the view
const int shift = 48;
View.SetViewTo(b.X - shift, b.Y - shift);
}
private void NUD_BuildingType_ValueChanged(object sender, EventArgs e)