-
Notifications
You must be signed in to change notification settings - Fork 0
/
COpponentMenu.cpp
86 lines (66 loc) · 2.2 KB
/
COpponentMenu.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "COpponentMenu.h"
#include "CHostJoinMenu.h"
#include "CDifficultyMenu.h"
#include "CColorMenu.h"
#include "CController.h"
#include "CIntelligence.h"
#include "CLocalPlayer.h"
#include "CRemotePlayer.h"
#define OPT_BACK 5
COpponentMenu::COpponentMenu(CAbstractMenuScreen * prPar /* =NULL*/) : CAbstractMenuScreen(prPar){
title = "Vyberte protivnika:";
menuItems[0] = "Singleplayer game";
menuItems[1] = "Local Multiplayer game";
menuItems[2] = "Online multiplayer game";
menuItems[3] = "AI vs. AI";
menuItems[4] = "BACK";
setNumMenuItems();
}
COpponentMenu::~COpponentMenu() {
}
void COpponentMenu::setNextMenu(){
delete nextMenu;
switch(chosenOption){
case(1) :
nextMenu = new CDifficultyMenu(this);
break;
case(2) :
nextMenu = new CColorMenu(this);
break;
case(3) :
nextMenu = new CHostJoinMenu(this);
break;
case(4):
nextMenu = NULL;
break;
case(OPT_BACK) :
nextMenu = prevMenu;
break;
}
}
void COpponentMenu::setStuff(CController* ctrler) {
delete ctrler->getGameSess().player1;
ctrler->getGameSess().player1 = new CLocalPlayer();
switch(chosenOption){
case(1):
delete ctrler->getGameSess().player2;
ctrler->getGameSess().player2 = new CIntelligence();
break;
case(2):
delete ctrler->getGameSess().player2;
ctrler->getGameSess().player2 = new CLocalPlayer();
break;
case(3):
delete ctrler->getGameSess().player2;
break;
case(4):
delete ctrler->getGameSess().player1;
delete ctrler->getGameSess().player2;
ctrler->getGameSess().player1 = new CIntelligence(0);
ctrler->getGameSess().player2 = new CIntelligence(0);
ctrler -> getGameSess().setPlayerColors(WHITE);
ctrler->getGameSess().setGameReady();
break;
}
// cntr-> get game session . opponent = tmpoponent
}