Fixed unwanted middle textures when drawing new sectors

Fixed a bug with the linedef arguments for unknown linedef actions (crashed on the linedef info panel)
This commit is contained in:
codeimp 2009-03-15 14:22:05 +00:00
parent 334c51cacc
commit 42c2940ed1
3 changed files with 19 additions and 4 deletions

View file

@ -101,6 +101,9 @@ namespace CodeImp.DoomBuilder.Config
this.isgeneralized = isgeneralized;
this.isknown = isknown;
this.title = title;
this.args = new ArgumentInfo[Linedef.NUM_ARGS];
for(int i = 0; i < Linedef.NUM_ARGS; i++)
this.args[i] = new ArgumentInfo(i);
}
#endregion

View file

@ -458,7 +458,6 @@ namespace CodeImp.DoomBuilder.Geometry
Sector newsector = General.Map.Map.CreateSector();
Sector sourcesector = null;
SidedefSettings sourceside = new SidedefSettings();
bool removeuselessmiddle;
bool foundsidedefaults = false;
// Check if any of the sides already has a sidedef
@ -560,7 +559,7 @@ namespace CodeImp.DoomBuilder.Geometry
{
// We may only remove a useless middle texture when
// the line was previously singlesided
removeuselessmiddle = (ls.Line.Back == null) || (ls.Line.Front == null);
bool removeuselessmiddle = (ls.Line.Back == null) || (ls.Line.Front == null);
if(ls.Front)
{
@ -610,6 +609,9 @@ namespace CodeImp.DoomBuilder.Geometry
General.Map.Map.CreateSidedef(ls.Line, true, original.Sector);
ApplyDefaultsToSidedef(ls.Line.Front, sourceside);
ls.Line.ApplySidedFlags();
// We must remove the (now useless) middle texture on the other side
if(ls.Line.Back != null) ls.Line.Back.RemoveUnneededTextures(true, true);
}
// Added 23-9-08, can we do this or will it break things?
else
@ -626,6 +628,9 @@ namespace CodeImp.DoomBuilder.Geometry
General.Map.Map.CreateSidedef(ls.Line, false, original.Sector);
ApplyDefaultsToSidedef(ls.Line.Back, sourceside);
ls.Line.ApplySidedFlags();
// We must remove the (now useless) middle texture on the other side
if(ls.Line.Front != null) ls.Line.Front.RemoveUnneededTextures(true, true);
}
// Added 23-9-08, can we do this or will it break things?
else

View file

@ -270,11 +270,18 @@ namespace CodeImp.DoomBuilder.Map
// This removes textures that are not required
public void RemoveUnneededTextures(bool removemiddle)
{
RemoveUnneededTextures(removemiddle, false);
}
// This removes textures that are not required
public void RemoveUnneededTextures(bool removemiddle, bool force)
{
// Check if the line or sectors have no action or tags because
// if they do, any texture on this side could be needed
if((linedef.Tag <= 0) && (linedef.Action == 0) && (sector.Tag <= 0) &&
((Other == null) || (Other.sector.Tag <= 0)))
if(((linedef.Tag <= 0) && (linedef.Action == 0) && (sector.Tag <= 0) &&
((Other == null) || (Other.sector.Tag <= 0))) ||
force)
{
if(!HighRequired())
{