Hello. I'm trying to get info from game, but when I do this I have wrong values in packet. What I do wrong? There is my code:
#include "cinsim.h" //Headers for CInsim library #include <iostream> //Basic C++ streams, needed for console output
CInsim insim; //CInsim object, handles the communication with LFS
int main() { int retVal = 0; struct IS_VER verPack; //LFS can tell us info about it's version and InSim version, store that info in this struct.
//Try to connect to LFS retVal = insim.init("192.168.0.213", //LFS will run on local machine (word)33334, //InSim will accept connection on port 33334 "Example app", //Short name for our app, will appear in LFS "", //No admin password &verPack, //Pointer to IS_VERSION packet '!', //InSim command character ISF_MCI, //We're writing a local InSim app 1000, //Receive updates every 1000 msecs 33334); //UDP Port
//Could we connect to LFS? if(retVal < 0) //We could not { //Tell the user and exit std::cerr << "Error connecting to LFS!" << std::endl; return -1; }
//All OK, report version of LFS and InSim std::cout << "Connected to LFS " << verPack.Version << ", InSim ver. " << verPack.InSimVer << std::endl << std::endl;
//Now enter the main loop which will receive packets from LFS int recvErr = 0; int packetType = 0; bool canRun = true; //Run the loop as long as this is true