Skip to content

Commit

Permalink
Fixed issue #328 and improved real-time debugging.
Browse files Browse the repository at this point in the history
  • Loading branch information
jarmonik committed Jan 4, 2024
1 parent 0d0bdf9 commit 6a8fa99
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 1 deletion.
8 changes: 8 additions & 0 deletions OVP/D3D9Client/D3D9Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,14 @@ void D3D9Client::clbkDestroyRenderWindow (bool fastclose)

}

// ==============================================================

void D3D9Client::clbkDebugString(const char* str)
{
D3D9DebugLog("%s", str);
}


// ==============================================================

void D3D9Client::PushSketchpad(SURFHANDLE surf, D3D9Pad *pSkp) const
Expand Down
2 changes: 2 additions & 0 deletions OVP/D3D9Client/D3D9Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ class D3D9Client : public GraphicsClient
*/
void clbkOptionChanged(DWORD cat, DWORD item);

void clbkDebugString(const char* str);

/**
* \brief Texture request
*
Expand Down
6 changes: 6 additions & 0 deletions Orbitersdk/include/GraphicsAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,12 @@ class OAPIFUNC GraphicsClient: public Module {
*/
virtual void clbkOptionChanged(DWORD cat, DWORD item) {}

/**
* \brief Print multiple debug strings onto a screen, will be cleared when printed on screen.
* \param str Text string to print
*/
virtual void clbkDebugString(const char *str) {}

/**
* \brief Texture request
*
Expand Down
7 changes: 7 additions & 0 deletions Orbitersdk/include/OrbiterAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -2446,6 +2446,13 @@ OAPIFUNC void oapiRegisterModule (oapi::Module *module);
OAPIFUNC char *oapiDebugString ();


/**
* \brief Print multiple debug strings onto a screen, will be cleared when printed on screen.
* \param str Text string to print
*/
OAPIFUNC void oapiDebugString(const char*);


// ======================================================================
/**
* \defgroup ObjectAccess Object access functions
Expand Down
8 changes: 8 additions & 0 deletions Src/Orbiter/OrbiterAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2500,6 +2500,14 @@ DLLEXPORT char *oapiDebugString ()
return DBG_MSG;
}

DLLEXPORT void oapiDebugString(const char* str)
{
#ifndef INLINEGRAPHICS
oapi::GraphicsClient* gc = g_pOrbiter->GetGraphicsClient();
if (gc) gc->clbkDebugString(str);
#endif // !INLINEGRAPHICS
}

DLLEXPORT double oapiRand ()
{
static double irmax = 1.0/(double)RAND_MAX;
Expand Down
3 changes: 2 additions & 1 deletion Src/Orbiter/Vessel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4834,8 +4834,9 @@ void Vessel::UpdatePassive ()
proxybody = prnt->proxybody;
proxyplanet = prnt->proxyplanet;
fstatus = prnt->fstatus;

if (proxybody) UpdateSurfParams();
if (fstatus != FLIGHTSTATUS_LANDED) {
if (proxybody) UpdateSurfParams();
bSurfaceContact = false;
}
UpdateMass(); // register fuel consumption
Expand Down

0 comments on commit 6a8fa99

Please sign in to comment.