- Joined
- Jun 6, 2012
- Messages
- 317
- Reaction score
- 124
- Points
- 43
- Location
- Sydney, Australia, Earth, Sol
- Website
- www.orbithangar.com
hey guys i am trying to code a vessel that has multiple Vessel States. so far i have this:
in my .h:
this works, but i cant save and load the PayloadStatus, only the VesselStatus. i know that i have to add a custom line in clbkSaveState, but i dont know how... if anyone could help, i would be grateful, this is what i have in clbkSaveState so far:
and in clbkLoadStateEx:
but only VesselStatus is saved and loaded, not PayloadStatus...
thanks in advance
in my .h:
Code:
enum VesselStatus {STAT1, STAT2, STAT3} VesselStatus;
enum PayloadStatus {ARMED, RELEASED, ACTIVE} PayloadStatus;
this works, but i cant save and load the PayloadStatus, only the VesselStatus. i know that i have to add a custom line in clbkSaveState, but i dont know how... if anyone could help, i would be grateful, this is what i have in clbkSaveState so far:
Code:
{
int i = 0;
char cbuf[256];
// Write default vessel parameters to scenario file
VESSEL3::clbkSaveState (scn);
sprintf (cbuf, "%i", VesselStatus); oapiWriteScenario_string (scn, "STATE", cbuf);
sprintf (cbuf, "%i", PayloadStatus); oapiWriteScenario_string (scn, "PAYLOAD", cbuf);
}
and in clbkLoadStateEx:
Code:
{
int i = 0;
char *cbuf;
while (oapiReadScenario_nextline (scn, cbuf))
{
// Load Vessel State
if (!_strnicmp( cbuf, "STATE", 5))
{
sscanf(cbuf+5, "%i", &VesselStatus);
}
else if (!_strnicmp( cbuf, "PAYLOAD", 5))
{
sscanf(cbuf+5, "%i", &PayloadStatus);
}
}
but only VesselStatus is saved and loaded, not PayloadStatus...
thanks in advance