QTfrontend/hwform.cpp
branchspacecampaign
changeset 9290 478aa681e702
parent 9288 180cab35c9c1
child 9292 187ce630dddc
equal deleted inserted replaced
9288:180cab35c9c1 9290:478aa681e702
  1725 	// what if no picture? :D
  1725 	// what if no picture? :D
  1726     //QComboBox *combo = ui.pageCampaign->CBMission;
  1726     //QComboBox *combo = ui.pageCampaign->CBMission;
  1727     QString camp = ui.pageCampaign->CBCampaign->currentText();
  1727     QString camp = ui.pageCampaign->CBCampaign->currentText();
  1728     //unsigned int mNum = combo->count() - combo->currentIndex();
  1728     //unsigned int mNum = combo->count() - combo->currentIndex();
  1729     //QString miss = getCampaignScript(camp, mNum);
  1729     //QString miss = getCampaignScript(camp, mNum);
  1730     QString miss = campaignMissionImages[ui.pageCampaign->CBMission->currentIndex()].replace(QString(".png"),QString(".lua"));
  1730     QString miss = campaignMissionInfo[ui.pageCampaign->CBMission->currentIndex()].script;
  1731     QString campTeam = ui.pageCampaign->CBTeam->currentText();
  1731     QString campTeam = ui.pageCampaign->CBTeam->currentText();
  1732 
  1732 
  1733     game->StartCampaign(camp, miss, campTeam);
  1733     game->StartCampaign(camp, miss, campTeam);
  1734 }
  1734 }
  1735 
  1735 
  1902     ui.pageCampaign->CBMission->clear();
  1902     ui.pageCampaign->CBMission->clear();
  1903 
  1903 
  1904     QString campaignName = ui.pageCampaign->CBCampaign->currentText();
  1904     QString campaignName = ui.pageCampaign->CBCampaign->currentText();
  1905     QString tName = team.name();
  1905     QString tName = team.name();
  1906     QStringList missionEntries = getCampMissionList2(campaignName,tName);
  1906     QStringList missionEntries = getCampMissionList2(campaignName,tName);
       
  1907     
       
  1908     campaignMissionInfo = getCampMissionList3(campaignName,tName);
  1907 
  1909 
  1908 	//unlockedMissionsHash = getUnlockedMissions2(campaignName, tName);
  1910 	//unlockedMissionsHash = getUnlockedMissions2(campaignName, tName);
  1909     // if the campaign name changes update the campaignMissionDescriptions list
  1911     // if the campaign name changes update the campaignMissionDescriptions list
  1910     // this will be used later in UpdateCampaignPageMission() to update
  1912     // this will be used later in UpdateCampaignPageMission() to update
  1911     // the mission description in the campaign page
  1913     // the mission description in the campaign page
  1914 	ui.pageCampaign->CBMission->clear();
  1916 	ui.pageCampaign->CBMission->clear();
  1915     campaignMissionDescriptions = getDescriptions(campaignName,tName);
  1917     campaignMissionDescriptions = getDescriptions(campaignName,tName);
  1916     campaignMissionImages = getImages(campaignName,tName);
  1918     campaignMissionImages = getImages(campaignName,tName);
  1917     for(int i=0;i<missionEntries.size();i++)
  1919     for(int i=0;i<missionEntries.size();i++)
  1918     {
  1920     {
  1919         ui.pageCampaign->CBMission->addItem(QString("Mission %1: ").arg(missionEntries.size()-i) + QString(missionEntries[i]), QString(missionEntries[i]));
  1921         ui.pageCampaign->CBMission->addItem(QString("Mission %1: ").arg(campaignMissionInfo.size()-i) + QString(campaignMissionInfo[i].name), QString(campaignMissionInfo[i].name));
  1920 	}
  1922 	}
  1921 }
  1923 }
  1922 
  1924 
  1923 void HWForm::UpdateCampaignPageMission(int index)
  1925 void HWForm::UpdateCampaignPageMission(int index)
  1924 {
  1926 {
  1930     // this will cause segfault. This check prevents illegal memory reads    
  1932     // this will cause segfault. This check prevents illegal memory reads    
  1931     qDebug("INDEX IS %d and number of descs is %d",index,campaignMissionDescriptions.count());
  1933     qDebug("INDEX IS %d and number of descs is %d",index,campaignMissionDescriptions.count());
  1932     if(index > -1 && index < campaignMissionDescriptions.count()) {
  1934     if(index > -1 && index < campaignMissionDescriptions.count()) {
  1933 		qDebug("INSIDE IF *******");
  1935 		qDebug("INSIDE IF *******");
  1934         ui.pageCampaign->lbltitle->setText("<h2>"+ui.pageCampaign->CBMission->currentText()+"</h2>");
  1936         ui.pageCampaign->lbltitle->setText("<h2>"+ui.pageCampaign->CBMission->currentText()+"</h2>");
  1935         ui.pageCampaign->lbldescription->setText(campaignMissionDescriptions[index]);
  1937         ui.pageCampaign->lbldescription->setText(campaignMissionInfo[index].description);
  1936     ui.pageCampaign->btnPreview->setIcon(QIcon((":/res/campaign/"+campaignName+"/"+campaignMissionImages[index])));
  1938 		ui.pageCampaign->btnPreview->setIcon(QIcon((":/res/campaign/"+campaignName+"/"+campaignMissionInfo[index].image)));
  1937     }
  1939     }
  1938 }
  1940 }
  1939 
  1941 
  1940 void HWForm::UpdateCampaignPageProgress(int index)
  1942 void HWForm::UpdateCampaignPageProgress(int index)
  1941 {
  1943 {