• R/O
  • SSH

OMP: Commit

Multiplayer platform


Commit MetaInfo

Revision0e10a74a63f41289974f15d557d9a8fb73da4589 (tree)
Time2016-08-31 03:15:51
AuthorFace
CommiterFace

Log Message

OMPClient: fixed fakes after vessel state update

Change Summary

Incremental Difference

diff -r d205c5f09aa8 -r 0e10a74a63f4 Orbitersdk/samples/OMP/OMPClient/OMPClient.cpp
--- a/Orbitersdk/samples/OMP/OMPClient/OMPClient.cpp Tue Feb 16 18:38:26 2016 +0100
+++ b/Orbitersdk/samples/OMP/OMPClient/OMPClient.cpp Tue Aug 30 20:15:51 2016 +0200
@@ -5508,11 +5508,29 @@
55085508 itoa(entry->ID, receiveStateFileName+3, 10);
55095509 FILEHANDLE stateFile=oapiOpenFile(receiveStateFileName, FileAccessMode::FILE_IN, PathRoot::ROOT);
55105510 EnterCriticalSection(&orbiter);
5511- VESSELSTATUS2 status;
5512- status.flag=0;
5513- status.version=2;
5514- entry->vessel->GetStatusEx((void *)&status);
5515- ((VESSEL2*)entry->vessel)->clbkLoadStateEx(stateFile, &status);
5511+ VESSELSTATUS2 status;
5512+ status.flag=0;
5513+ status.version=2;
5514+ entry->vessel->GetStatusEx((void *)&status);
5515+ //Fake thruster deletion
5516+ VECTOR3 direction, location;
5517+ location=_V(0,0,0);
5518+ entry->vessel->GetThrusterDir(entry->thruster, direction);
5519+ double temp=entry->vessel->GetThrusterLevel(entry->thruster)/entry->vessel->GetMass();
5520+ entry->vessel->DelThruster(entry->thruster);
5521+ entry->vessel->DelPropellantResource(entry->fuel);
5522+ //Call load state function
5523+ ((VESSEL2*)entry->vessel)->clbkLoadStateEx(stateFile, &status);
5524+ //Reset touchdown points, kill thruster efficiency and create fake thruster
5525+ entry->vessel->SetTouchdownPoints(touchdown.tp1, touchdown.tp2, touchdown.tp3);
5526+ for(int matchi=entry->vessel->GetThrusterCount()-1;matchi>=0;matchi--)
5527+ entry->vessel->SetThrusterMax0(entry->vessel->GetThrusterHandleByIndex(matchi), 0);
5528+ entry->fuel=entry->vessel->CreatePropellantResource(0.001); //1g fake fuel
5529+ entry->thruster=entry->vessel->CreateThruster(
5530+ location, direction, 1E9,
5531+ entry->fuel, 1E15); //ISP: full thrust for 1g for 1000s
5532+ temp*=entry->vessel->GetMass();
5533+ entry->vessel->SetThrusterLevel(entry->thruster, temp);
55165534 LeaveCriticalSection(&orbiter);
55175535 oapiCloseFile(stateFile, FileAccessMode::FILE_IN);
55185536 DeleteFile(receiveStateFileName);
Show on old repository browser