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

Made ExternMFD to Work #66

Merged
merged 3 commits into from
Aug 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Orbitersdk/include/GraphicsAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ class OAPIFUNC GraphicsClient: public Module {
* object for which the message was created.
* \sa RegisterVisObject, UnregisterVisObject, visevent
*/
virtual int clbkVisEvent (OBJHANDLE hObj, VISHANDLE vis, DWORD msg, UINT context);
virtual int clbkVisEvent (OBJHANDLE hObj, VISHANDLE vis, DWORD msg, DWORD_PTR context);

/**
* \brief Return a mesh handle for a visual, defined by its index
Expand Down
7 changes: 1 addition & 6 deletions Orbitersdk/include/MFDAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,7 @@ class OAPIFUNC ExternMFD {
* identifiers are in the range 0 ... MAXMFD-1, the ExternMFD class simply
* uses its own instance pointer (UINT)this to create an identifier.
*/
#ifdef _WIN64
size_t
#else
UINT
#endif
Id() const;
UINT_PTR Id() const;

/**
* \brief Returns a flag indicating active/passive MFD state.
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void Body::UnregisterVisual ()
hVis = NULL;
}

void Body::BroadcastVisMsg (DWORD msg, UINT content)
void Body::BroadcastVisMsg (DWORD msg, DWORD_PTR content)
{
oapi::GraphicsClient *gc;
if (hVis && (gc = g_pOrbiter->GetGraphicsClient())) {
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Body {

virtual const void *GetParam (DWORD paramtype) const { return 0; }

void BroadcastVisMsg (DWORD msg, UINT content);
void BroadcastVisMsg (DWORD msg, DWORD_PTR content);
// send a message to all existing visuals

inline double Size() const { return size; }
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/GraphicsAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void GraphicsClient::UnregisterVisObject (OBJHANDLE hObj)

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

int GraphicsClient::clbkVisEvent (OBJHANDLE hObj, VISHANDLE vis, DWORD msg, UINT context)
int GraphicsClient::clbkVisEvent (OBJHANDLE hObj, VISHANDLE vis, DWORD msg, DWORD_PTR context)
{
return 0;
}
Expand Down
17 changes: 3 additions & 14 deletions Src/Orbiter/MFDAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,9 @@ ExternMFD::~ExternMFD ()
if (instr) delete instr;
}

#ifdef _WIN64
size_t
#else
UINT
#endif
ExternMFD::Id () const
UINT_PTR ExternMFD::Id () const
{
return (
#ifdef _WIN64
size_t
#else
UINT
#endif
)this;
return (UINT_PTR)this;
}

bool ExternMFD::Active () const
Expand Down Expand Up @@ -130,7 +119,7 @@ bool ExternMFD::SetMode (int mode)
spec.bt_dy = btdy;
Instrument *newinstr = 0;
if (mode != MFD_NONE) {
newinstr = Instrument::Create (mode, g_pane, Id(), spec, (Vessel*)hVessel);
newinstr = Instrument::Create (mode, g_pane, (INT_PTR)Id(), spec, (Vessel*)hVessel);
if (!newinstr) return false;
}
if (instr) {
Expand Down
6 changes: 3 additions & 3 deletions Src/Orbiter/Mfd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct Instrument::DrawResource Instrument::draw[MAXDEFCOL][2] = {0};
// ******************************************************************

Instrument *Instrument::Create (int type, Pane *_pane,
int _id, const Spec &spec, Vessel *_vessel, bool restore)
INT_PTR _id, const Spec &spec, Vessel *_vessel, bool restore)
{
DWORD i;

Expand Down Expand Up @@ -98,7 +98,7 @@ Instrument *Instrument::Create (int type, Pane *_pane,
}

Instrument *Instrument::Create (ifstream &ifs, Pane *_pane,
int _id, const Spec &spec, Vessel *_vessel)
INT_PTR _id, const Spec &spec, Vessel *_vessel)
{
static char *mfdstr[MAXMFD] = {"Left","Right","3","4","5","6","7","8","9","10","11","12"};
Instrument *instr = 0;
Expand Down Expand Up @@ -467,7 +467,7 @@ bool Instrument::IsDisabledMode (int id)
return false;
}

Instrument::Instrument (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel, bool defer_alloc)
Instrument::Instrument (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel, bool defer_alloc)
{
pane = _pane;
gc = g_pOrbiter->GetGraphicsClient();
Expand Down
8 changes: 4 additions & 4 deletions Src/Orbiter/Mfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Instrument {
DWORD flag; // bit flags
};

Instrument (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel, bool defer_alloc=false);
Instrument (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel, bool defer_alloc=false);
virtual ~Instrument ();
virtual void RestoreDeviceObjects (LPDIRECT3D7 d3d, LPDIRECT3DDEVICE7 dev) {}
virtual int Type () const = 0; // mode id
Expand Down Expand Up @@ -139,12 +139,12 @@ class Instrument {
// ******************************************************************

static Instrument *Create (int type, Pane *_pane,
int _id, const Spec &spec, Vessel *_vessel, bool restore = true);
INT_PTR _id, const Spec &spec, Vessel *_vessel, bool restore = true);
// create instrument of the required type
// if restore==true then parameters are restored from static saved

static Instrument *Create (std::ifstream &ifs, Pane *_pane,
int _id, const Spec &spec, Vessel *_vessel);
INT_PTR _id, const Spec &spec, Vessel *_vessel);
// create instrument from stream

static void RegisterBuiltinModes ();
Expand Down Expand Up @@ -213,7 +213,7 @@ class Instrument {
protected:
Pane *pane; // pointer to pane
oapi::GraphicsClient *gc; // graphics client, if available
int id; // instrument id
INT_PTR id; // instrument id
bool BufKey (char key, double repdelay = 0.5);
void SetBuf (char key);
int IW, IH; // instrument dimensions
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdAlign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static const Body *last_target = 0;

struct Instrument_OPlaneAlign::SavePrm Instrument_OPlaneAlign::saveprm = {0,0,0,0.0,0.0,false};

Instrument_OPlaneAlign::Instrument_OPlaneAlign (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel, bool restore)
Instrument_OPlaneAlign::Instrument_OPlaneAlign (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel, bool restore)
: Instrument (_pane, _id, spec, _vessel)
{
shpel = new Elements(); TRACENEW
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdAlign.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class Instrument_OPlaneAlign: public Instrument {
public:
Instrument_OPlaneAlign (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel, bool restore);
Instrument_OPlaneAlign (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel, bool restore);
virtual ~Instrument_OPlaneAlign();
int Type () const { return MFD_OPLANEALIGN; }
char ModeSelKey () const { return 'A'; }
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdComms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern TimeData td;
// class Instrument_Comms
// navigation radio manipulation

Instrument_Comms::Instrument_Comms (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel)
Instrument_Comms::Instrument_Comms (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel)
: Instrument (_pane, _id, spec, _vessel)
{
sel = 0;
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdComms.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class Instrument_Comms: public Instrument {
public:
Instrument_Comms (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel);
Instrument_Comms (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel);
virtual ~Instrument_Comms ();
int Type () const { return MFD_COMMS; }
char ModeSelKey () const { return 'C'; }
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdDocking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct Instrument_Docking::SavePrm Instrument_Docking::saveprm = {
0,Instrument_Docking::NAV,0,0,-1
};

Instrument_Docking::Instrument_Docking (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel, bool restore)
Instrument_Docking::Instrument_Docking (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel, bool restore)
: Instrument (_pane, _id, spec, _vessel)
{
int i;
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdDocking.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class Instrument_Docking: public Instrument {
public:
Instrument_Docking (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel, bool restore);
Instrument_Docking (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel, bool restore);
virtual ~Instrument_Docking ();
int Type () const { return MFD_DOCKING; }
char ModeSelKey () const { return 'D'; }
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdHsi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ using namespace std;

struct Instrument_HSI::SavePrm Instrument_HSI::saveprm = {0, {{0,0}, {0,0}}};

Instrument_HSI::Instrument_HSI (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel)
Instrument_HSI::Instrument_HSI (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel)
: Instrument (_pane, _id, spec, _vessel)
{
int i;
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdHsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class Instrument_HSI: public Instrument {
public:
Instrument_HSI (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel);
Instrument_HSI (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel);
~Instrument_HSI();
int Type () const { return MFD_HSI; }
char ModeSelKey () const { return 'H'; }
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdLanding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct Instrument_Landing::SavePrm Instrument_Landing::saveprm = {
0, 0
};

Instrument_Landing::Instrument_Landing (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel, bool restore)
Instrument_Landing::Instrument_Landing (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel, bool restore)
: Instrument (_pane, _id, spec, _vessel)
{
nv = 0;
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdLanding.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class Instrument_Landing: public Instrument {
public:
Instrument_Landing (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel, bool restore);
Instrument_Landing (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel, bool restore);
virtual ~Instrument_Landing();
int Type () const { return MFD_LANDING; }
char ModeSelKey () const { return 'L'; }
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DWORD dispflag_default = DISP_GRIDLINE | DISP_COASTLINE | DISP_CONTOURS | DISP_H
// =======================================================================
// class Instrument_Map

Instrument_Map::Instrument_Map (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel)
Instrument_Map::Instrument_Map (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel)
: Instrument (_pane, _id, spec, _vessel)
{
strcpy (title, "Map: ");
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class Instrument_Map: public Instrument {
public:
Instrument_Map (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel);
Instrument_Map (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel);
~Instrument_Map();
int Type () const { return MFD_MAP; }
char ModeSelKey () const { return 'M'; }
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdMap_old.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extern Select *g_select;

struct Instrument_MapOld::SavePrm Instrument_MapOld::saveprm = {0,0,0,0,false,true};

Instrument_MapOld::Instrument_MapOld (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel)
Instrument_MapOld::Instrument_MapOld (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel)
: Instrument (_pane, _id, spec, _vessel)
{
map = bgmap = 0;
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdMap_old.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class Instrument_MapOld: public Instrument {
public:
Instrument_MapOld (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel);
Instrument_MapOld (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel);
~Instrument_MapOld();
int Type () const { return MFD_MAP; }
char ModeSelKey () const { return 'M'; }
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdOrbit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct Instrument_Orbit::SavePrm Instrument_Orbit::saveprm = {
Instrument_Orbit::DISP_BOTH
};

Instrument_Orbit::Instrument_Orbit (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel)
Instrument_Orbit::Instrument_Orbit (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel)
: Instrument (_pane, _id, spec, _vessel)
{
projmode = saveprm.projmode;
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdOrbit.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Instrument_Orbit: public Instrument {
enum FrameMode { FRM_ECL, FRM_EQU };
enum DistMode { DIST_RAD, DIST_ALT };
enum DisplayMode { DISP_LIST, DISP_GRAPH, DISP_BOTH };
Instrument_Orbit (Pane *_pane, int id, const Spec &spec, Vessel *_vessel);
Instrument_Orbit (Pane *_pane, INT_PTR id, const Spec &spec, Vessel *_vessel);
virtual ~Instrument_Orbit ();
int Type () const { return MFD_ORBIT; }
char ModeSelKey () const { return 'O'; }
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extern Pane *g_pane;
COLORREF Instrument_Surface::tapelabelcol[2] = {0xFFFFFF,0x60A0FF}; // make configurable
struct Instrument_Surface::SavePrm Instrument_Surface::saveprm = { 1 };

Instrument_Surface::Instrument_Surface (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel)
Instrument_Surface::Instrument_Surface (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel)
: Instrument (_pane, _id, spec, _vessel)
{
sp = 0;
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdSurface.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class Instrument_Surface: public Instrument {
public:
Instrument_Surface (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel);
Instrument_Surface (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel);
~Instrument_Surface();
int Type () const { return MFD_SURFACE; }
char ModeSelKey () const { return 'S'; }
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdSync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static char *modestr[7] = {

struct Instrument_OSync::SavePrm Instrument_OSync::saveprm = {0, 0, Instrument_OSync::MODE_INTERSECT1, 0.0, 5};

Instrument_OSync::Instrument_OSync (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel, bool restore)
Instrument_OSync::Instrument_OSync (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel, bool restore)
: Instrument (_pane, _id, spec, _vessel)
{
mode = MODE_INTERSECT1;
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdSync.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class Instrument_OSync: public Instrument {
friend class Pane;
public:
Instrument_OSync (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel, bool restore);
Instrument_OSync (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel, bool restore);
virtual ~Instrument_OSync ();
int Type () const { return MFD_OSYNC; }
char ModeSelKey () const { return 'Y'; }
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdTransfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extern Select *g_select;

struct Instrument_Transfer::SavePrm Instrument_Transfer::saveprm = {0,0,0,0,0.0,0.0,false,false};

Instrument_Transfer::Instrument_Transfer (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel)
Instrument_Transfer::Instrument_Transfer (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel)
: Instrument (_pane, _id, spec, _vessel)
{
if (_vessel == saveprm.usr) {
Expand Down
2 changes: 1 addition & 1 deletion Src/Orbiter/MfdTransfer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class Instrument_Transfer: public Instrument {
public:
Instrument_Transfer (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel);
Instrument_Transfer (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel);
virtual ~Instrument_Transfer ();
int Type() const { return MFD_TRANSFER; }
char ModeSelKey () const { return 'X'; }
Expand Down
4 changes: 2 additions & 2 deletions Src/Orbiter/MfdUser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extern char DBG_MSG[256];
// class Instrument_User
// user-defined MFD mode (implemented in module)

Instrument_User::Instrument_User (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel,
Instrument_User::Instrument_User (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel,
int _type, const MFDMODE &mode)
: Instrument (_pane, _id, spec, _vessel, true)
{
Expand All @@ -60,7 +60,7 @@ Instrument_User::Instrument_User (Pane *_pane, int _id, const Spec &spec, Vessel
mfd->RecallStatus();
}

Instrument_User::Instrument_User (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel)
Instrument_User::Instrument_User (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel)
: Instrument (_pane, _id, spec, _vessel, true)
{
type = MFD_USERTYPE; // generic
Expand Down
4 changes: 2 additions & 2 deletions Src/Orbiter/MfdUser.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

class Instrument_User: public Instrument {
public:
Instrument_User (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel,
Instrument_User (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel,
int _type, const MFDMODE &mode);
Instrument_User (Pane *_pane, int _id, const Spec &spec, Vessel *_vessel);
Instrument_User (Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel);
virtual ~Instrument_User();
int Type() const { return type; }
char ModeSelKey () const { return selkey; }
Expand Down
Loading