1720 } |
1720 } |
1721 |
1721 |
1722 void HWForm::StartCampaign() |
1722 void HWForm::StartCampaign() |
1723 { |
1723 { |
1724 CreateGame(0, 0, 0); |
1724 CreateGame(0, 0, 0); |
1725 // what if no picture? :D |
|
1726 //QComboBox *combo = ui.pageCampaign->CBMission; |
|
1727 QString camp = ui.pageCampaign->CBCampaign->currentText(); |
1725 QString camp = ui.pageCampaign->CBCampaign->currentText(); |
1728 //unsigned int mNum = combo->count() - combo->currentIndex(); |
|
1729 //QString miss = getCampaignScript(camp, mNum); |
|
1730 QString miss = campaignMissionInfo[ui.pageCampaign->CBMission->currentIndex()].script; |
1726 QString miss = campaignMissionInfo[ui.pageCampaign->CBMission->currentIndex()].script; |
1731 QString campTeam = ui.pageCampaign->CBTeam->currentText(); |
1727 QString campTeam = ui.pageCampaign->CBTeam->currentText(); |
1732 |
1728 |
1733 game->StartCampaign(camp, miss, campTeam); |
1729 game->StartCampaign(camp, miss, campTeam); |
1734 } |
1730 } |
1894 } |
1890 } |
1895 } |
1891 } |
1896 |
1892 |
1897 void HWForm::UpdateCampaignPage(int index) |
1893 void HWForm::UpdateCampaignPage(int index) |
1898 { |
1894 { |
1899 qDebug("UpdateCampaignPage"); |
|
1900 Q_UNUSED(index); |
1895 Q_UNUSED(index); |
1901 HWTeam team(ui.pageCampaign->CBTeam->currentText()); |
1896 HWTeam team(ui.pageCampaign->CBTeam->currentText()); |
1902 ui.pageCampaign->CBMission->clear(); |
|
1903 |
|
1904 QString campaignName = ui.pageCampaign->CBCampaign->currentText(); |
1897 QString campaignName = ui.pageCampaign->CBCampaign->currentText(); |
1905 QString tName = team.name(); |
1898 QString tName = team.name(); |
1906 QStringList missionEntries = getCampMissionList2(campaignName,tName); |
|
1907 |
1899 |
1908 campaignMissionInfo = getCampMissionList3(campaignName,tName); |
1900 campaignMissionInfo = getCampMissionList(campaignName,tName); |
1909 |
|
1910 //unlockedMissionsHash = getUnlockedMissions2(campaignName, tName); |
|
1911 // if the campaign name changes update the campaignMissionDescriptions list |
|
1912 // this will be used later in UpdateCampaignPageMission() to update |
|
1913 // the mission description in the campaign page |
|
1914 campaignMissionDescriptions.clear(); |
|
1915 campaignMissionImages.clear(); |
|
1916 ui.pageCampaign->CBMission->clear(); |
1901 ui.pageCampaign->CBMission->clear(); |
1917 campaignMissionDescriptions = getDescriptions(campaignName,tName); |
1902 |
1918 campaignMissionImages = getImages(campaignName,tName); |
1903 for(int i=0;i<campaignMissionInfo.size();i++) |
1919 for(int i=0;i<missionEntries.size();i++) |
1904 { |
1920 { |
1905 // Maybe not enforce the prefix Mission %1, isn't so nice for the misison with no |
|
1906 // specific order |
1921 ui.pageCampaign->CBMission->addItem(QString("Mission %1: ").arg(campaignMissionInfo.size()-i) + QString(campaignMissionInfo[i].name), QString(campaignMissionInfo[i].name)); |
1907 ui.pageCampaign->CBMission->addItem(QString("Mission %1: ").arg(campaignMissionInfo.size()-i) + QString(campaignMissionInfo[i].name), QString(campaignMissionInfo[i].name)); |
1922 } |
1908 } |
1923 } |
1909 } |
1924 |
1910 |
1925 void HWForm::UpdateCampaignPageMission(int index) |
1911 void HWForm::UpdateCampaignPageMission(int index) |
1926 { |
1912 { |
1927 qDebug("UpdateCampaignPageMission"); |
1913 // update thumbnail and description |
1928 // update thumbnail |
|
1929 QString campaignName = ui.pageCampaign->CBCampaign->currentText(); |
1914 QString campaignName = ui.pageCampaign->CBCampaign->currentText(); |
1930 // update description |
|
1931 // when campaign changes the UpdateCampaignPageMission is triggered with wrong values |
1915 // when campaign changes the UpdateCampaignPageMission is triggered with wrong values |
1932 // this will cause segfault. This check prevents illegal memory reads |
1916 // this will cause segfault. This check prevents illegal memory reads |
1933 qDebug("INDEX IS %d and number of descs is %d",index,campaignMissionDescriptions.count()); |
1917 if(index > -1 && index < campaignMissionInfo.count()) { |
1934 if(index > -1 && index < campaignMissionDescriptions.count()) { |
|
1935 qDebug("INSIDE IF *******"); |
|
1936 ui.pageCampaign->lbltitle->setText("<h2>"+ui.pageCampaign->CBMission->currentText()+"</h2>"); |
1918 ui.pageCampaign->lbltitle->setText("<h2>"+ui.pageCampaign->CBMission->currentText()+"</h2>"); |
1937 ui.pageCampaign->lbldescription->setText(campaignMissionInfo[index].description); |
1919 ui.pageCampaign->lbldescription->setText(campaignMissionInfo[index].description); |
1938 ui.pageCampaign->btnPreview->setIcon(QIcon((":/res/campaign/"+campaignName+"/"+campaignMissionInfo[index].image))); |
1920 ui.pageCampaign->btnPreview->setIcon(QIcon((":/res/campaign/"+campaignName+"/"+campaignMissionInfo[index].image))); |
1939 } |
1921 } |
1940 } |
1922 } |