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

Method CmSearchJump

roomedit/source/editcli.cpp:2775–2811  ·  view source on GitHub ↗

//////////////////////////////////////////////////////////////// TEditorClient ------------- Ask for an object number, center the map around this object and select it as CurObject. NOTE: Calls Invalidate, because of GoToObject, which changes OrigX and OrigY

Source from the content-addressed store, hash-verified

2773// and OrigY
2774//
2775void TEditorClient::CmSearchJump ()
2776{
2777 // Ignore if "insert object" mode
2778 if ( InsertingObject )
2779 return;
2780
2781 SET_HELP_CONTEXT(Jump_to_object);
2782
2783 char Prompt[80];
2784 char Title[40];
2785 char InputText[7];
2786
2787 // Init. input dialog parameters
2788 TRangeValidator *pvalid = new TRangeValidator (0, GetMaxObjectNum(EditMode));
2789
2790 wsprintf (Prompt, "Enter an %s number between %d and %d",
2791 GetObjectTypeName (EditMode),
2792 0, GetMaxObjectNum(EditMode));
2793 wsprintf (Title, "Jump to a %s number",
2794 GetObjectTypeName (EditMode));
2795 wsprintf (InputText, "%d", CurObject);
2796
2797 // Execute input dialog
2798 if ( TInputDialog(this, Title, Prompt,
2799 InputText, 6, 0, pvalid).Execute() == IDOK )
2800 {
2801 SHORT NewObject = (SHORT)atoi (InputText);
2802
2803 // True because of TRangeValidator
2804 assert (NewObject >= 0 && NewObject <= GetMaxObjectNum (EditMode));
2805
2806 CurObject = NewObject;
2807 GoToObject (EditMode, CurObject);
2808 RefreshWindows();
2809 }
2810 RESTORE_HELP_CONTEXT();
2811}
2812
2813
2814/////////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 4

GetMaxObjectNumFunction · 0.85
GetObjectTypeNameFunction · 0.85
GoToObjectFunction · 0.85
ExecuteMethod · 0.45

Tested by

no test coverage detected