Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cannon prediction bugs #891

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion rts/Map/Ground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#include "Sim/Misc/GlobalSynced.h"
#include "System/SpringMath.h"

#include "Rendering/GlobalRendering.h"
#include "Sim/Misc/GeometricObjects.h"

#include <cassert>
#include <limits>

Expand Down Expand Up @@ -588,12 +591,27 @@ float CGround::TrajectoryGroundCol(const float3& trajStartPos, const float3& tra
const float3 pos = (trajStartPos + dir * dist) + (alt * dist * dist);

#if 1
if (GetApproximateHeight(pos) > pos.y)
if (GetApproximateHeight(pos) > pos.y) {
if (globalRendering->drawDebugTraceRay) {

#define go geometricObjects

// red line pointing to hitPos
go->SetColor(go->AddLine(pos, trajStartPos, 3, 0, GAME_SPEED), 1.0f, 0.0f, 0.0f, 1.0f);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the #define looks very meek?

Suggested change
go->SetColor(go->AddLine(pos, trajStartPos, 3, 0, GAME_SPEED), 1.0f, 0.0f, 0.0f, 1.0f);
geometricObjects->SetColor(geometricObjects->AddLine(pos, trajStartPos, 3, 0, GAME_SPEED), 1.0f, 0.0f, 0.0f, 1.0f);

// blue lines showing chord checks
// While using this debug, on SlowUpdate Frames, CWeapon::TryTargetHeading will assume the unit chassis rotates to face the target,
// so the tstPos will not be lined up with any part of the unit.
// resulting in two visible debug lines. One from the weaponmuzzle, one from the rotated weaponmuzzle

#undef go
}
return dist;
}
#else
if (GetHeightReal(pos) > pos.y)
return dist;
#endif

}

return -1.0f;
Expand Down