Skip to content

Commit 8daa601

Browse files
committed
Attempt at printf debugging to find that crash bug...
1 parent 5b0c96d commit 8daa601

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

vSMR/InsetWindow.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ RECT CInsetWindow::DrawToolbarButton(CDC * dc, const char* letter, CRect TopBar,
164164

165165
void CInsetWindow::render(HDC hDC, CSMRRadar * radar_screen, Graphics* gdi, POINT mouseLocation, multimap<CBString, CBString> DistanceTools)
166166
{
167+
Logger::info("InsetWindow Render");
167168
CDC dc;
168169
dc.Attach(hDC);
169170

@@ -186,12 +187,14 @@ void CInsetWindow::render(HDC hDC, CSMRRadar * radar_screen, Graphics* gdi, POIN
186187
refPt.x += m_Offset.x;
187188
refPt.y += m_Offset.y;
188189

190+
Logger::info("InsetWindow 190");
189191
// Here we draw all runways for the airport
190192
for (CSectorElement rwy = radar_screen->GetPlugIn()->SectorFileElementSelectFirst(SECTOR_ELEMENT_RUNWAY);
191193
rwy.IsValid();
192194
rwy = radar_screen->GetPlugIn()->SectorFileElementSelectNext(rwy, SECTOR_ELEMENT_RUNWAY))
193195
{
194196

197+
Logger::info("InsetWindow 197");
195198
if (StartsWith(icao, rwy.GetAirportName()))
196199
{
197200
CPen RunwayPen(PS_SOLID, 1, radar_screen->CurrentConfig->getConfigColorRef(radar_screen->CurrentConfig->getActiveProfile()["approach_insets"]["runway_color"]));
@@ -213,6 +216,7 @@ void CInsetWindow::render(HDC hDC, CSMRRadar * radar_screen, Graphics* gdi, POIN
213216

214217
}
215218

219+
Logger::info("InsetWindow 219");
216220
if (rwy.IsElementActive(false, 0) || rwy.IsElementActive(false, 1))
217221
{
218222
CPosition Threshold, OtherEnd;
@@ -268,9 +272,10 @@ void CInsetWindow::render(HDC hDC, CSMRRadar * radar_screen, Graphics* gdi, POIN
268272
}
269273

270274
// Aircrafts
275+
Logger::info("InsetWindow 274");
271276
radar_screen->DrawTargets(gdi, &dc, this);
272277
radar_screen->DrawTags(gdi, this);
273-
278+
Logger::info("InsetWindow 277");
274279

275280
/*
276281
CRadarTarget rt;

vSMR/SMRRadar.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ void CSMRRadar::OnAsrContentToBeSaved()
467467

468468
void CSMRRadar::ReloadActiveRunways()
469469
{
470+
Logger::info("SMRRadar 470");
470471
CSectorElement rwy;
471472
for (rwy = GetPlugIn()->SectorFileElementSelectFirst(SECTOR_ELEMENT_RUNWAY); rwy.IsValid(); rwy = GetPlugIn()->SectorFileElementSelectNext(rwy, SECTOR_ELEMENT_RUNWAY)) {
472473
if (StartsWith(ActiveAirport, rwy.GetAirportName())) {
@@ -489,6 +490,7 @@ void CSMRRadar::ReloadActiveRunways()
489490
}
490491
}
491492
}
493+
Logger::info("SMRRadar 493");
492494
}
493495

494496
void CSMRRadar::OnMoveScreenObject(int ObjectType, const char * sObjectId, POINT Pt, RECT Area, bool Released)
@@ -1935,6 +1937,7 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
19351937
graphics.SetPageUnit(UnitPixel);
19361938
graphics.SetSmoothingMode(SmoothingModeAntiAlias);
19371939

1940+
Logger::info("SMRRadar 1938");
19381941
AirportPositions.clear();
19391942
for (CSectorElement apt = GetPlugIn()->SectorFileElementSelectFirst(SECTOR_ELEMENT_AIRPORT);
19401943
apt.IsValid();
@@ -1944,6 +1947,7 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
19441947
AirportPositions[apt.GetName()] = Pos;
19451948
}
19461949

1950+
Logger::info("SMRRadar 1948");
19471951
if (QDMSelectEnabled || QDMenabled) {
19481952
CRect R(GetRadarArea());
19491953
R.top += 20;
@@ -1953,6 +1957,7 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
19531957
AddScreenObject(DRAWING_BACKGROUND_CLICK, "", R, false, "");
19541958
}
19551959

1960+
Logger::info("SMRRadar 1958");
19561961
for (auto runway : RimcasInstance->Runways) {
19571962
if (runway.closed) { // if runway is closed
19581963

@@ -1974,21 +1979,25 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
19741979
}
19751980
}
19761981

1982+
Logger::info("SMRRadar 1979");
19771983
RimcasInstance->OnRefreshBegin(isLVP);
19781984

19791985
// ---------------
19801986
// Drawing targets
19811987
// ---------------
1988+
Logger::info("SMRRadar 1986");
19821989
DrawTargets(&graphics, &dc, nullptr);
19831990

19841991
// ---------------
19851992
// RIMCAS
19861993
// ---------------
1994+
Logger::info("SMRRadar 1992");
19871995
RimcasInstance->OnRefreshEnd(this, CurrentConfig->getActiveProfile()["rimcas"]["rimcas_stage_two_speed_threshold"].GetInt());
19881996

19891997
// --------------
19901998
// Drawing Tags
19911999
// --------------
2000+
Logger::info("SMRRadar 1998");
19922001
DrawTags(&graphics, nullptr);
19932002

19942003
// --------------
@@ -1998,6 +2007,7 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
19982007
TagDeconflict();
19992008
}
20002009

2010+
Logger::info("SMRRadar 2008");
20012011
RimcasInstance->AcOnRunway.clear();
20022012
ColorAC.clear();
20032013
tagAreas.clear();
@@ -2010,6 +2020,7 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
20102020
// --------------
20112021
// Drawing IAW
20122022
// --------------
2023+
Logger::info("SMRRadar 2021");
20132024
int oldDC = SaveDC(dc);
20142025

20152026
Logger::info("RIMCAS Loop");
@@ -2023,6 +2034,7 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
20232034
if (TimePopupAreas.find(rwy.name) == TimePopupAreas.end())
20242035
TimePopupAreas[rwy.name] = { 300, 300, 380, 380 };
20252036

2037+
Logger::info("SMRRadar 2037");
20262038
CRect baseRect = TimePopupAreas[rwy.name];
20272039
baseRect.NormalizeRect();
20282040
POINT center = baseRect.CenterPoint();
@@ -2043,6 +2055,7 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
20432055
arcOuterEnd.x = center.x;
20442056
arcOuterEnd.y = outerRect.bottom;
20452057

2058+
Logger::info("SMRRadar 2058");
20462059
for (const auto &aircraft : RimcasInstance->IAWQueue[rwy.name]) {
20472060

20482061
double arcAngle = aircraft.time / 90 * M_PI; // [0-180sec] -> [0-2Pi]
@@ -2103,6 +2116,7 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
21032116
}
21042117

21052118
AddScreenObject(RIMCAS_IAW, rwy.name, baseRect, true, "");
2119+
Logger::info("SMRRadar 2119");
21062120
}
21072121

21082122
RestoreDC(dc, oldDC);
@@ -2283,6 +2297,7 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)
22832297
//---------------------------------
22842298
// Drawing distance tools
22852299
//---------------------------------
2300+
Logger::info("SMRRadar 2295");
22862301
DrawDistanceTools(&graphics, &dc, nullptr);
22872302

22882303
//---------------------------------
@@ -2542,6 +2557,7 @@ void CSMRRadar::DrawTags(Graphics* graphics, CInsetWindow* insetWindow)
25422557
CFlightPlan fp = GetPlugIn()->FlightPlanSelect(rt.GetCallsign());
25432558
int reportedGs = rt.GetPosition().GetReportedGS();
25442559

2560+
Logger::info("SMRRadar 2552");
25452561
// Filtering the targets
25462562
if (insetWindow == nullptr && !ShouldDraw(rt))
25472563
continue;
@@ -2558,6 +2574,7 @@ void CSMRRadar::DrawTags(Graphics* graphics, CInsetWindow* insetWindow)
25582574
//if (std::find(ReleasedTracks.begin(), ReleasedTracks.end(), rt.GetSystemID()) != ReleasedTracks.end())
25592575
//isAcDisplayed = false;
25602576

2577+
Logger::info("SMRRadar 2569");
25612578
// Getting the tag center/offset
25622579
POINT acPosPix;
25632580
POINT TagCenter;
@@ -2596,7 +2613,7 @@ void CSMRRadar::DrawTags(Graphics* graphics, CInsetWindow* insetWindow)
25962613
TagCenter.y = long(acPosPix.y + float(length * sin(DegToRad(insetWindow->m_TagAngles[rt.GetCallsign()]))));
25972614
}
25982615

2599-
2616+
Logger::info("SMRRadar 2608");
26002617
TagTypes TagType = TagTypes::Departure;
26012618
TagTypes ColorTagType = TagTypes::Departure;
26022619

@@ -2623,6 +2640,7 @@ void CSMRRadar::DrawTags(Graphics* graphics, CInsetWindow* insetWindow)
26232640
ColorTagType = TagTypes::Uncorrelated;
26242641
}
26252642

2643+
Logger::info("SMRRadar 2635");
26262644
map<CBString, TagItem> TagMap = GenerateTagData(rt, fp, this, ActiveAirport);
26272645

26282646
StringFormat* stformat = new Gdiplus::StringFormat();
@@ -2671,7 +2689,7 @@ void CSMRRadar::DrawTags(Graphics* graphics, CInsetWindow* insetWindow)
26712689
if (!LabelLines.IsArray())
26722690
continue;
26732691

2674-
2692+
Logger::info("SMRRadar 2684");
26752693
REAL TagWidth = 0, TagHeight = 0;
26762694
REAL TAG_PADDING_LEFT = 0;// (REAL)(currentFontSize / 4.0);
26772695
REAL TAG_PADDING_RIGHT = 0;// TAG_PADDING_LEFT;
@@ -2757,6 +2775,7 @@ void CSMRRadar::DrawTags(Graphics* graphics, CInsetWindow* insetWindow)
27572775
// ---------------------
27582776
// Drawing the tag
27592777
// ---------------------
2778+
Logger::info("SMRRadar 2770");
27602779
CRect TagBackgroundRect((int)(TagCenter.x - (TagWidth / 2.0)), (int)(TagCenter.y - (TagHeight / 2.0)), (int)(TagCenter.x + (TagWidth / 2.0)), (int)(TagCenter.y + (TagHeight / 2.0)));
27612780

27622781
// We only draw if the tag is:
@@ -2778,6 +2797,7 @@ void CSMRRadar::DrawTags(Graphics* graphics, CInsetWindow* insetWindow)
27782797
}
27792798
}
27802799

2800+
Logger::info("SMRRadar 2792");
27812801
if (shouldDraw) {
27822802
SolidBrush TagBackgroundBrush(TagBackgroundColor);
27832803
graphics->FillRectangle(&TagBackgroundBrush, CopyRect(TagBackgroundRect));

vSMR/vSMR.vcxproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,11 @@
103103
<AdditionalIncludeDirectories>..\lib\include</AdditionalIncludeDirectories>
104104
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
105105
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
106+
<DebugInformationFormat>None</DebugInformationFormat>
106107
</ClCompile>
107108
<Link>
108109
<SubSystem>Windows</SubSystem>
109-
<GenerateDebugInformation>true</GenerateDebugInformation>
110+
<GenerateDebugInformation>false</GenerateDebugInformation>
110111
<EnableCOMDATFolding>true</EnableCOMDATFolding>
111112
<OptimizeReferences>true</OptimizeReferences>
112113
<ModuleDefinitionFile>.\vSMR.def</ModuleDefinitionFile>

0 commit comments

Comments
 (0)