Game Development Community

Var. Not Storing

by Robert Fritzen · in Technical Issues · 04/20/2011 (2:19 pm) · 1 replies

*EDIT* Changed the thread, I found out what that annoying access violation was.

But now, I'm stuck with a very unusual problem

class PGDStore {

private:
   string encEXP;
   string encOFF;

public:
   void addCurrentEXP(const F32 add, string GUID);
   void promoteOFF(string encrypted);
   string getEXP();
   string getOFF();

   string packageStoreForUpload(CryptoPP::Integer e, CryptoPP::Integer n);
   void checkData();

   static void create();
   static void destroy();

   PGDStore();
   ~PGDStore();
};

extern PGDStore *pgdrankstore;

void PGDStore::addCurrentEXP(const F32 add, string GUID) {
   
   std::string exp, out;
   std::string bleh = getEXP();
   //std::string bleh = "0";

   /**
   if(PGD_CONTAINER_DEBUG) {
	   Con::printf("Adding This Number: %fnGUID: %snCurrent EXP Data: %s", add, GUID, bleh);
   }
   **/

   if(bleh.compare("0") != 0) {
      if(PGD_CONTAINER_DEBUG) {
		 Con::printf("NOT ZERO");
	  }
      pgdCry.AESDecrypt(GUID, bleh, exp, 1000);
   }
   else {
      if(PGD_CONTAINER_DEBUG) {
		 Con::printf("ZERO");
	  }
      exp = "0";
   }
   const F32 final = dAtof(exp.c_str()) + add;

   char buff[256];
   //dSprintf(buff, 64, "%f", final);
   dSprintf(buff, sizeof(buff), "%f", final);  
   pgdCry.AESEncrypt(GUID, string(buff), out, 1000);
   encEXP.assign(out);

   /**
   if(PGD_CONTAINER_DEBUG) {
	  Con::printf("Buffer: %snAdded Final: %fnEncrypted Output: %s", buff, final, out);
   }
   **/
}

encEXP, the class variable, is ignoring the command to assign the new data to it...

#1
04/22/2011 (12:50 pm)
More problems....

I ran a test output on the initialization of the structure, and it gave me some output that is now raising a red flag.

*** Rank Storage Container Initialized PGDStore::PGDStore()
*** TEST � â��7���ºe x@, 
*Rank Storage Container Initialized.

PGDStore::PGDStore() {
   encEXP = "0";
   encOFF = "0";

   if(PGD_CONTAINER_DEBUG) {
      Con::printf("*** Rank Storage Container Initialized PGDStore::PGDStore()");
	  Con::printf("*** TEST %s, %s", encEXP, encOFF);
   }
}

*EDIT*

Apparently the problem either lies in my class definition, or it has something to do with the engine, I just ran this outside of the engine and it functions 100% correctly.