2013-04-11 11:26:57 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
2012-08-29 10:09:02 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes.ErrorChecks {
|
|
|
|
|
public class ResultUnknownThing : ErrorResult {
|
|
|
|
|
public override int Buttons { get { return 1; } }
|
|
|
|
|
public override string Button1Text { get { return "Delete Thing"; } }
|
|
|
|
|
|
|
|
|
|
private Thing thing;
|
|
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
|
public ResultUnknownThing(Thing t) {
|
|
|
|
|
// Initialize
|
|
|
|
|
this.thing = t;
|
|
|
|
|
this.viewobjects.Add(t);
|
|
|
|
|
this.description = "This thing has unknown type (eg. it's not defined in DECORATE or current game configuration).";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This must return the string that is displayed in the listbox
|
|
|
|
|
public override string ToString() {
|
|
|
|
|
return "Thing " + General.Map.Data.GetThingInfo(thing.Type).Index + " at " + thing.Position.x + ", " + thing.Position.y + " has unknown type.";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Rendering
|
|
|
|
|
public override void RenderOverlaySelection(IRenderer2D renderer) {
|
|
|
|
|
renderer.RenderThing(thing, renderer.DetermineThingColor(thing), 1.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This removes the thing
|
2013-06-04 14:43:26 +00:00
|
|
|
|
public override bool Button1Click(bool batchMode) {
|
|
|
|
|
if(!batchMode) General.Map.UndoRedo.CreateUndo("Delete thing");
|
2012-08-29 10:09:02 +00:00
|
|
|
|
thing.Dispose();
|
|
|
|
|
General.Map.IsChanged = true;
|
|
|
|
|
General.Map.ThingsFilter.Update();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|