MCPcopy Create free account
hub / github.com/Meridian59/Meridian59 / SDNew

Method SDNew

roomedit/source/lineedit.cpp:1725–1771  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////// TLineDefEditDialog ------------------ A new SideDef is created

Source from the content-addressed store, hash-verified

1723// ------------------
1724// A new SideDef is created
1725void TLineDefEditDialog::SDNew (int sdnum)
1726{
1727 assert (sdnum == 0 || sdnum == 1);
1728 char str[10];
1729 SHORT sd;
1730
1731 // Create new SideDef
1732 InsertObject (OBJ_SIDEDEFS, -1, 0, 0);
1733
1734 // Fill confirmation data
1735 ConfirmData.pSDCheck[sdnum] = TRUE;
1736 ConfirmData.pSDAboveCheck[sdnum] = FALSE;
1737 ConfirmData.pSDNormalCheck[sdnum] = FALSE;
1738 ConfirmData.pSDBelowCheck[sdnum] = FALSE;
1739 ConfirmData.pSDSectorCheck[sdnum] = FALSE;
1740 ConfirmData.pSDXOfsCheck[sdnum] = FALSE;
1741 ConfirmData.pSDYOfsCheck[sdnum] = FALSE;
1742 ConfirmData.pIDNumCheck[sdnum] = FALSE;
1743 ConfirmData.pSpeedCheck[sdnum] = FALSE;
1744
1745 // Copy SideDef number
1746 sd = NumSideDefs-1;
1747 if ( sdnum == 0 ) CurLineDef.sidedef1 = sd;
1748 else CurLineDef.sidedef2 = sd;
1749
1750 // Setup sector number
1751 SHORT OppSector = GetOppositeSector (SelLineDefs->objnum, sdnum == 0);
1752
1753 // If no opposite sector, choose the last one
1754 if ( OppSector > 0 )
1755 OppSector = NumSectors-1;
1756 SideDefs[sd].sector = OppSector;
1757
1758 // Setup SideDef number control
1759 wsprintf (str, "%d", sd);
1760 pSDEdit[sdnum]->SetText (str);
1761
1762 // Copy SideDef to temporary SideDef struct.
1763 CurSD[sdnum] = SideDefs[sd];
1764
1765 // Replace validators for SideDef number
1766 pSDEdit[0]->SetValidator (new TRangeValidator (-1, NumSideDefs-1));
1767 pSDEdit[1]->SetValidator (new TRangeValidator (-1, NumSideDefs-1));
1768
1769 // Setup SideDef controls
1770 SetSideDef (sdnum);
1771}
1772
1773//////////////////////////////////////////////////////////////////////
1774// TLineDefEditDialog

Callers

nothing calls this directly

Calls 4

InsertObjectFunction · 0.85
GetOppositeSectorFunction · 0.85
SetValidatorMethod · 0.80
SetTextMethod · 0.45

Tested by

no test coverage detected