Skip to content

Commit fb98622

Browse files
committed
comments
1 parent 8f81b8d commit fb98622

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

monopoly.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ bool jailedaction(int &sel, player &p, int &diceRolls, bool &ok){
757757
}
758758
}
759759
}
760-
760+
//the whole function for the menue point financial menue with alle steps
761761
bool financial_menue(player &p){
762762
int sel;
763763
displayGameBoard();
@@ -771,12 +771,14 @@ bool financial_menue(player &p){
771771
std::cin>>sel;
772772
switch (sel) {
773773
case 1:{
774+
//checks if player owns tiles and searches for all unmortaged cards that can be mortaged
774775
if(!p.ownedStreets.empty()){
775776
for(int i : p.ownedStreets){
776777
if(!gameBoard[i].isMortgaged && gameBoard[i].upgradeStage == 0){
777778
filteredTileListPlayer.push_back(gameBoard[i]);
778779
}
779780
}
781+
//loop for selecting cards that should be mortaged
780782
do{
781783
displayGameBoard();
782784
if(!filteredTileListPlayer.empty()){
@@ -809,12 +811,14 @@ bool financial_menue(player &p){
809811
break;
810812
}
811813
case 2:{
814+
//checks if player owns tiles and searches for all mortaged cards
812815
if(p.ownedStreets.size()){
813816
for(int i : p.ownedStreets){
814817
if(gameBoard[i].isMortgaged){
815818
filteredTileListPlayer.push_back(gameBoard[i]);
816819
}
817820
}
821+
//loop for selecting cards that should be unmortaged
818822
do{
819823
displayGameBoard();
820824
if(!filteredTileListPlayer.empty()){
@@ -864,7 +868,7 @@ bool financial_menue(player &p){
864868
}
865869
return false;
866870
}
867-
871+
//the whole function for the menue point building menue with alle steps
868872
bool building_menue(player &p){
869873
int sel;
870874
displayGameBoard();
@@ -878,6 +882,7 @@ bool building_menue(player &p){
878882
std::cin>>sel;
879883
switch (sel) {
880884
case 1:{
885+
//checks if the player ownes streets and checks if he has a monopoly and checks the upgrading status, then puts these tiles in a filtered list
881886
if(!p.ownedStreets.empty()){
882887
for(int i : p.ownedStreets){
883888
if(ownsMonopoly(gameBoard[i])){
@@ -886,6 +891,7 @@ bool building_menue(player &p){
886891
}
887892
}
888893
}
894+
//loop for the upgrading menue
889895
if(!filteredTileListPlayer.empty()){
890896
std::sort(filteredTileListPlayer.begin(),filteredTileListPlayer.end());
891897
do{
@@ -930,6 +936,7 @@ bool building_menue(player &p){
930936
}
931937
break;
932938
}case 2:{
939+
//checks if the player ownes streets and checks if he has a monopoly and checks the upgrading status, then puts these tiles in a filtered list
933940
if(!p.ownedStreets.empty()){
934941
for(int i : p.ownedStreets){
935942
if(ownsMonopoly(gameBoard[i])){
@@ -938,6 +945,7 @@ bool building_menue(player &p){
938945
}
939946
}
940947
}
948+
//loop tor the downgrading menue
941949
if(!filteredTileListPlayer.empty()){
942950
std::sort(filteredTileListPlayer.begin(),filteredTileListPlayer.end());
943951
do{
@@ -989,7 +997,7 @@ bool building_menue(player &p){
989997
}
990998
return false;
991999
}
992-
1000+
//the whole function for the menue point traiding menue with alle steps
9931001
bool trading_menue(player &p){
9941002
int sel;
9951003
std::vector<int> otherplayers;
@@ -1013,7 +1021,7 @@ bool trading_menue(player &p){
10131021
int amount2;
10141022
std::vector<int> tiles1;
10151023
std::vector<int>tiles2;
1016-
1024+
//choosing the amount of money to give to selected player
10171025
displayGameBoard();
10181026
std::cout<<colorCodes[p.color].first << p.symbol << " " << p.name << RESET_COLOR <<" You have " <<p.money<<"$ in your account.\n"
10191027
<<"How Much money do you want to give " << colorCodes[players[otherplayers[sel]].color].first << players[otherplayers[sel]].symbol << " " << players[otherplayers[sel]].name << RESET_COLOR << "?" <<std::endl;
@@ -1028,7 +1036,7 @@ bool trading_menue(player &p){
10281036
clearInputBuffer();
10291037
}
10301038
}
1031-
1039+
//displaying and choosing all possible tiles that can be traded from current player
10321040
if(!p.ownedStreets.empty()){
10331041
int tilesel;
10341042
do{
@@ -1057,7 +1065,7 @@ bool trading_menue(player &p){
10571065
std::cin.get();
10581066
clearInputBuffer();
10591067
}
1060-
1068+
//choosing the amount of money from selected player
10611069
displayGameBoard();
10621070
std::cout<<colorCodes[players[otherplayers[sel]].color].first << players[otherplayers[sel]].symbol << " " << players[otherplayers[sel]].name << RESET_COLOR <<" has " <<players[otherplayers[sel]].money<<"$ in their account.\n"
10631071
<<"How Much money do you want from " << colorCodes[players[otherplayers[sel]].color].first << players[otherplayers[sel]].symbol << " " << players[otherplayers[sel]].name << RESET_COLOR << "?" <<std::endl;
@@ -1072,7 +1080,7 @@ bool trading_menue(player &p){
10721080
clearInputBuffer();
10731081
}
10741082
}
1075-
1083+
//displaying and choosing all possible tiles that can be traded from selected player
10761084
displayGameBoard();
10771085
if(!players[otherplayers[sel]].ownedStreets.empty()){
10781086
int tilesel;
@@ -1101,7 +1109,7 @@ bool trading_menue(player &p){
11011109
std::cin.get();
11021110
clearInputBuffer();
11031111
}
1104-
1112+
//displays the trade offer and waits for a desicion
11051113
int desicion;
11061114
do{
11071115
displayGameBoard();

0 commit comments

Comments
 (0)