return NULL;
}
}
- printf("Unexpected error : User %s not found %d\n",a->getName(),a);
+ printf("Unexpected error : User %s not found\n",a->getName());
return accounts.front();
}
}
}
+ acc->currentCampaign = "";
+ int t;
+ char c;
+ funpackf(tfile, "Bi", &t);
+ for(int i=0;i<t;i++)
+ {
+ funpackf(tfile, "Bb", &c);
+ acc->currentCampaign.append(1,c);
+ }
+
funpackf(tfile, "Bf", &(acc->points));
for(int i=0;i<50;i++)
{
}
}
+ fpackf(tfile, "Bi", a->getCurrentCampaign().size());
+ for(j=0;j<a->getCurrentCampaign().size();j++)
+ {
+ fpackf(tfile, "Bb", a->getCurrentCampaign()[j]);
+ }
+
fpackf(tfile, "Bf", a->points);
for(j=0;j<50;j++)
{
void Game::LoadCampaign() {
if(!accountactive)
return;
+ if(!Mainmenuitems[7]) {
+ ifstream test(ConvertFileName((":Data:Textures:"+accountactive->getCurrentCampaign()+":World.png").c_str()));
+ if(test.good()) {
+ LoadTexture((":Data:Textures:"+accountactive->getCurrentCampaign()+":World.png").c_str(),&Mainmenuitems[7],0,0);
+ } else {
+ LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
+ }
+ }
ifstream ipstream(ConvertFileName((":Data:Campaigns:"+accountactive->getCurrentCampaign()+".txt").c_str()));
ipstream.ignore(256,':');
ipstream >> campaignnumlevels;
LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0);
LoadTexture(":Data:Textures:Eyelid.png",&Mainmenuitems[4],0,1);
//LoadTexture(":Data:Textures:Eye.jpg",&Mainmenuitems[5],0,1);
- LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
+ //~ LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0); // LoadCampaign will take care of that
texdetail=temptexdetail;
FadeLoadingScreen(95);
c=campaigns.begin();
accountactive->setCurrentCampaign(*c);
}
- LoadCampaign();
if(Mainmenuitems[7])
- glDeleteTextures(1,&Mainmenuitems[7]);
- ifstream test(ConvertFileName((":Data:Textures:"+accountactive->getCurrentCampaign()+":World.png").c_str()));
- if(test.good()) {
- LoadTexture((":Data:Textures:"+accountactive->getCurrentCampaign()+":World.png").c_str(),&Mainmenuitems[7],0,0);
- } else {
- LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
- }
+ glDeleteTextures(1,&Mainmenuitems[7]); // we delete the world texture so load campaign will reload it
+ Mainmenuitems[7] = 0;
+ LoadCampaign();
break;
}
break;