protected void OnAddSpecificWarpButtonClicked(object sender, EventArgs e)
{
// Check if a pointer warp already exists
List<WarpSourceData> warps = sourceGroup.GetMapWarpSourceData(map);
foreach (WarpSourceData sourceData in warps) {
if (sourceData.WarpSourceType == WarpSourceType.PointerWarp) {
// Warning dialog
Gtk.MessageDialog d = new Gtk.MessageDialog(null,
DialogFlags.DestroyWithParent,
MessageType.Warning,
ButtonsType.YesNo,
"This map already has specific-position warp data; adding another would be redundant. Continue anyway?");
Gtk.ResponseType response = (ResponseType)d.Run();
d.Destroy();
if (response == ResponseType.Yes)
break;
else
return;
}
}
WarpSourceData data = new WarpSourceData(Project,
WarpSourceData.WarpCommands[(int)WarpSourceType.PointerWarp],
WarpSourceData.DefaultValues[(int)WarpSourceType.PointerWarp],
sourceGroup.FileParser,
new List<int>{-1,2});
data.Map = map;
sourceGroup.AddWarpSourceData(data);
SetWarpIndex((int)indexSpinButton.Adjustment.Upper+1);
}