36 #include "campaign.h" |
36 #include "campaign.h" |
37 |
37 |
38 #include <QTextStream> |
38 #include <QTextStream> |
39 #include "ThemeModel.h" |
39 #include "ThemeModel.h" |
40 |
40 |
|
41 // last game info |
|
42 QList<QVariant> lastGameStartArgs = QList<QVariant>(); |
|
43 GameType lastGameType = gtNone; |
|
44 GameCFGWidget * lastGameCfg = NULL; |
|
45 QString lastGameAmmo = NULL; |
|
46 TeamSelWidget * lastGameTeamSel = NULL; |
|
47 |
41 QString training, campaign, campaignScript, campaignTeam; // TODO: Cleaner solution? |
48 QString training, campaign, campaignScript, campaignTeam; // TODO: Cleaner solution? |
42 |
49 |
43 HWGame::HWGame(GameUIConfig * config, GameCFGWidget * gamecfg, QString ammo, TeamSelWidget* pTeamSelWidget) : |
50 HWGame::HWGame(GameUIConfig * config, GameCFGWidget * gamecfg, QString ammo, TeamSelWidget* pTeamSelWidget) : |
44 TCPBase(true, 0), |
51 TCPBase(true, 0), |
45 ammostr(ammo), |
52 ammostr(ammo), |
46 m_pTeamSelWidget(pTeamSelWidget) |
53 m_pTeamSelWidget(pTeamSelWidget) |
47 { |
54 { |
48 this->config = config; |
55 this->config = config; |
49 this->gamecfg = gamecfg; |
56 this->gamecfg = gamecfg; |
50 netSuspend = false; |
57 netSuspend = false; |
|
58 |
|
59 lastGameCfg = gamecfg; |
|
60 lastGameAmmo = ammo; |
|
61 lastGameTeamSel = pTeamSelWidget; |
51 } |
62 } |
52 |
63 |
53 HWGame::~HWGame() |
64 HWGame::~HWGame() |
54 { |
65 { |
55 SetGameState(gsDestroyed); |
66 SetGameState(gsDestroyed); |
433 SetGameState(gsStarted); |
445 SetGameState(gsStarted); |
434 } |
446 } |
435 |
447 |
436 void HWGame::StartLocal() |
448 void HWGame::StartLocal() |
437 { |
449 { |
|
450 lastGameStartArgs.clear(); |
|
451 lastGameType = gtLocal; |
|
452 |
438 gameType = gtLocal; |
453 gameType = gtLocal; |
439 demo.clear(); |
454 demo.clear(); |
440 Start(false); |
455 Start(false); |
441 SetGameState(gsStarted); |
456 SetGameState(gsStarted); |
442 } |
457 } |
443 |
458 |
444 void HWGame::StartQuick() |
459 void HWGame::StartQuick() |
445 { |
460 { |
|
461 lastGameStartArgs.clear(); |
|
462 lastGameType = gtQLocal; |
|
463 |
446 gameType = gtQLocal; |
464 gameType = gtQLocal; |
447 demo.clear(); |
465 demo.clear(); |
448 Start(false); |
466 Start(false); |
449 SetGameState(gsStarted); |
467 SetGameState(gsStarted); |
450 } |
468 } |
451 |
469 |
452 void HWGame::StartTraining(const QString & file) |
470 void HWGame::StartTraining(const QString & file) |
453 { |
471 { |
|
472 lastGameStartArgs.clear(); |
|
473 lastGameStartArgs.append(file); |
|
474 lastGameType = gtTraining; |
|
475 |
454 gameType = gtTraining; |
476 gameType = gtTraining; |
455 training = "Missions/Training/" + file + ".lua"; |
477 training = "Missions/Training/" + file + ".lua"; |
456 demo.clear(); |
478 demo.clear(); |
457 Start(false); |
479 Start(false); |
458 SetGameState(gsStarted); |
480 SetGameState(gsStarted); |
459 } |
481 } |
460 |
482 |
461 void HWGame::StartCampaign(const QString & camp, const QString & campScript, const QString & campTeam) |
483 void HWGame::StartCampaign(const QString & camp, const QString & campScript, const QString & campTeam) |
462 { |
484 { |
|
485 lastGameStartArgs.clear(); |
|
486 lastGameStartArgs.append(camp); |
|
487 lastGameStartArgs.append(campScript); |
|
488 lastGameStartArgs.append(campTeam); |
|
489 lastGameType = gtCampaign; |
|
490 |
463 gameType = gtCampaign; |
491 gameType = gtCampaign; |
464 campaign = camp; |
492 campaign = camp; |
465 campaignScript = "Missions/Campaign/" + camp + "/" + campScript; |
493 campaignScript = "Missions/Campaign/" + camp + "/" + campScript; |
466 campaignTeam = campTeam; |
494 campaignTeam = campTeam; |
467 demo.clear(); |
495 demo.clear(); |