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

Method CopySDData

roomedit/source/lineedit.cpp:920–1013  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////// TLineDefEditDialog ------------------

Source from the content-addressed store, hash-verified

918// ------------------
919//
920void TLineDefEditDialog::CopySDData (int sdnum, SHORT DestLD,
921 TConfirmLineDefDialogXfer &xfer)
922{
923 assert (sdnum == 0 || sdnum == 1);
924 assert (DestLD >= 0 && DestLD < NumLineDefs);
925
926 // Do not copy if SideDef CheckBox not checked
927 if ( xfer.pSDCheck[sdnum] == FALSE )
928 return;
929
930 LineDef *pDestLineDef = &LineDefs[DestLD];
931
932 // Retreive source and dest. SideDef numbers
933 SHORT SrcSD, DestSD;
934 if ( sdnum == 0 )
935 {
936 SrcSD = CurLineDef.sidedef1;
937 DestSD = pDestLineDef->sidedef1;
938 }
939 else
940 {
941 SrcSD = CurLineDef.sidedef2;
942 DestSD = pDestLineDef->sidedef2;
943 }
944
945 // Do not copy if no SideDef data for the source LineDef
946 // (a warning message was displayed before)
947 if ( SrcSD < 0 )
948 return;
949
950 // Check the destination SideDef
951 if ( DestSD < 0 )
952 {
953 // By default, a new SideDef is created for the destination LineDef
954 if ( Expert ||
955 Confirm ("The LineDef %d doesn't currently have a %s SideDef, so "
956 "it's impossible to copy the SideDef data from the "
957 "LineDef %d. \n\nDo you want to create a NEW %s SideDef "
958 "for the LineDef %d ?"
959 "\n(If not, this LineDef will be skipped.)",
960 DestLD, sdnum == 0 ? "first" : "second",
961 SelLineDefs->objnum,
962 sdnum == 0 ? "first" : "second", DestLD) == TRUE )
963 {
964 // Create new SideDef copied from the source SideDef
965 InsertObject (OBJ_SIDEDEFS, SrcSD, 0, 0);
966
967 // Link it to the destination LineDef
968 DestSD = NumSideDefs - 1;
969 if ( sdnum == 0 ) pDestLineDef->sidedef1 = DestSD;
970 else pDestLineDef->sidedef2 = DestSD;
971 }
972 // Either we created a SideDef copied from the source SideDef,
973 // or we skip the copy of theSideDef. So it's OK to quit
974 return;
975 }
976
977 // Copy selected data members to the Dest. SideDef

Callers

nothing calls this directly

Calls 3

ConfirmFunction · 0.85
InsertObjectFunction · 0.85
TextureToNumberFunction · 0.85

Tested by

no test coverage detected