2012-06-01 19:53:14 +00:00
2009-04-19 18:07:22 +00:00
#region = = = = = = = = = = = = = = = = = = Copyright ( c ) 2007 Pascal vd Heiden
/ *
* Copyright ( c ) 2007 Pascal vd Heiden , www . codeimp . com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* /
#endregion
#region = = = = = = = = = = = = = = = = = = Namespaces
using CodeImp.DoomBuilder.Map ;
using CodeImp.DoomBuilder.Rendering ;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
2012-06-01 19:53:14 +00:00
public class ResultStuckThingInThing : ErrorResult
2009-04-19 18:07:22 +00:00
{
#region = = = = = = = = = = = = = = = = = = Variables
2014-08-11 10:30:52 +00:00
private Thing thing1 ;
private Thing thing2 ; //mxd
2012-06-01 19:53:14 +00:00
2009-04-19 18:07:22 +00:00
#endregion
2012-06-01 19:53:14 +00:00
2009-04-19 18:07:22 +00:00
#region = = = = = = = = = = = = = = = = = = Properties
public override int Buttons { get { return 1 ; } }
public override string Button1Text { get { return "Delete Thing" ; } }
#endregion
2012-06-01 19:53:14 +00:00
2009-04-19 18:07:22 +00:00
#region = = = = = = = = = = = = = = = = = = Constructor / Destructor
2012-06-01 19:53:14 +00:00
2009-04-19 18:07:22 +00:00
// Constructor
2014-08-11 10:30:52 +00:00
public ResultStuckThingInThing ( Thing t1 , Thing t2 )
2009-04-19 18:07:22 +00:00
{
// Initialize
2014-08-11 10:30:52 +00:00
this . thing1 = t1 ;
this . thing2 = t2 ; //mxd
this . viewobjects . Add ( t1 ) ;
2012-06-01 19:53:14 +00:00
this . description = "This thing is stuck in another thing. Both will likely not be able to move around." ;
2009-04-19 18:07:22 +00:00
}
2012-06-01 19:53:14 +00:00
2009-04-19 18:07:22 +00:00
#endregion
2012-06-01 19:53:14 +00:00
2009-04-19 18:07:22 +00:00
#region = = = = = = = = = = = = = = = = = = Methods
2012-06-01 19:53:14 +00:00
2009-04-19 18:07:22 +00:00
// This must return the string that is displayed in the listbox
public override string ToString ( )
{
2014-08-11 10:30:52 +00:00
return "Thing " + thing1 . Index + " (" + General . Map . Data . GetThingInfo ( thing1 . Type ) . Title + ") is stuck in thing " + thing2 . Index + " (" + General . Map . Data . GetThingInfo ( thing2 . Type ) . Title + ") at " + thing1 . Position . x + ", " + thing1 . Position . y ;
2009-04-19 18:07:22 +00:00
}
// Rendering
public override void RenderOverlaySelection ( IRenderer2D renderer )
{
2014-08-11 10:30:52 +00:00
renderer . RenderThing ( thing1 , renderer . DetermineThingColor ( thing1 ) , 1.0f ) ;
2009-04-19 18:07:22 +00:00
}
// This removes the thing
2013-06-04 14:43:26 +00:00
public override bool Button1Click ( bool batchMode )
2009-04-19 18:07:22 +00:00
{
2013-06-04 14:43:26 +00:00
if ( ! batchMode ) General . Map . UndoRedo . CreateUndo ( "Delete thing" ) ;
2014-08-11 10:30:52 +00:00
thing1 . Dispose ( ) ;
2009-04-19 18:07:22 +00:00
General . Map . IsChanged = true ;
General . Map . ThingsFilter . Update ( ) ;
return true ;
}
2012-06-01 19:53:14 +00:00
2009-04-19 18:07:22 +00:00
#endregion
}
}