fix some dumb (nonfatal) crashes in the editor with nothing loaded
This commit is contained in:
1
OpenRA.Editor/Form1.Designer.cs
generated
1
OpenRA.Editor/Form1.Designer.cs
generated
@@ -429,7 +429,6 @@
|
|||||||
this.surface1.Size = new System.Drawing.Size(783, 727);
|
this.surface1.Size = new System.Drawing.Size(783, 727);
|
||||||
this.surface1.TabIndex = 5;
|
this.surface1.TabIndex = 5;
|
||||||
this.surface1.Text = "surface1";
|
this.surface1.Text = "surface1";
|
||||||
this.surface1.Click += new System.EventHandler(this.OnSurfaceClicked);
|
|
||||||
//
|
//
|
||||||
// saveFileDialog
|
// saveFileDialog
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -35,7 +35,13 @@ namespace OpenRA.Editor
|
|||||||
|
|
||||||
Rules.LoadRules(Game.modData.Manifest, new Map());
|
Rules.LoadRules(Game.modData.Manifest, new Map());
|
||||||
|
|
||||||
surface1.AfterChange += MakeDirty;
|
surface1.AfterChange += OnMapChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnMapChanged()
|
||||||
|
{
|
||||||
|
MakeDirty();
|
||||||
|
pmMiniMap.Image = Minimap.AddStaticResources(surface1.Map, Minimap.TerrainBitmap(surface1.Map, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeDirty() { dirty = true; }
|
void MakeDirty() { dirty = true; }
|
||||||
@@ -390,11 +396,6 @@ namespace OpenRA.Editor
|
|||||||
pb.Show();
|
pb.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSurfaceClicked(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
pmMiniMap.Image = Minimap.AddStaticResources(surface1.Map, Minimap.TerrainBitmap(surface1.Map, true));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void mnuMinimapToPNG_Click(object sender, EventArgs e)
|
private void mnuMinimapToPNG_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ namespace OpenRA.Editor
|
|||||||
{
|
{
|
||||||
base.OnMouseWheel(e);
|
base.OnMouseWheel(e);
|
||||||
|
|
||||||
|
if (Map == null) return;
|
||||||
|
|
||||||
Zoom *= e.Delta > 0 ? 4.0f / 3.0f : .75f;
|
Zoom *= e.Delta > 0 ? 4.0f / 3.0f : .75f;
|
||||||
|
|
||||||
Invalidate();
|
Invalidate();
|
||||||
@@ -114,6 +116,8 @@ namespace OpenRA.Editor
|
|||||||
{
|
{
|
||||||
base.OnMouseMove(e);
|
base.OnMouseMove(e);
|
||||||
|
|
||||||
|
if (Map == null) return;
|
||||||
|
|
||||||
var oldMousePos = MousePos;
|
var oldMousePos = MousePos;
|
||||||
MousePos = new int2(e.Location);
|
MousePos = new int2(e.Location);
|
||||||
|
|
||||||
@@ -332,6 +336,8 @@ namespace OpenRA.Editor
|
|||||||
{
|
{
|
||||||
base.OnMouseDown(e);
|
base.OnMouseDown(e);
|
||||||
|
|
||||||
|
if (Map == null) return;
|
||||||
|
|
||||||
if (!IsPanning)
|
if (!IsPanning)
|
||||||
{
|
{
|
||||||
if (e.Button == MouseButtons.Right) Erase();
|
if (e.Button == MouseButtons.Right) Erase();
|
||||||
|
|||||||
Reference in New Issue
Block a user