X-Git-Url: https://git.ucc.asn.au/?p=progcomp2012.git;a=blobdiff_plain;f=samples%2Fforfax%2Fforfax.cpp;fp=samples%2Fforfax%2Fforfax.cpp;h=6fa0ba33442c0eed150a674aee5616ff16f3536d;hp=e27af9f1c77737bd7d0066115aedcc30f49bf8d6;hb=2ab27eb698cfd57977cc9cc25edcbfbeb3b1b1ee;hpb=f91a915d6f64f9d35e867d26e8ddb9c1b1ab0c1e diff --git a/samples/forfax/forfax.cpp b/samples/forfax/forfax.cpp index e27af9f..6fa0ba3 100644 --- a/samples/forfax/forfax.cpp +++ b/samples/forfax/forfax.cpp @@ -525,7 +525,7 @@ bool Forfax::MakeMove() bool Forfax::InterpretMove() { - int x; int y; string direction; string result; int multiplier = 1; + int x; int y; string direction; string result; int multiplier = 1; int attackerVal = (int)(Piece::BOMB); int defenderVal = (int)(Piece::BOMB); cerr << "Forfax " << strColour << " waiting for movement information...\n"; cin >> x; cin >> y; cin >> direction; cin >> result; @@ -536,6 +536,20 @@ bool Forfax::InterpretMove() s >> multiplier; result.clear(); cin >> result; + + if (cin.peek() != '\n') + { + cerr << "Forfax " << strColour << " reading ranks of pieces\n"; + s.clear(); s.str(result); + s >> attackerVal; + result.clear(); + cin >> result; + s.clear(); s.str(result); + s >> defenderVal; + result.clear(); + + cin >> result; + } } if (cin.get() != '\n') { @@ -544,6 +558,9 @@ bool Forfax::InterpretMove() return false; } + Piece::Type attackerRank = Piece::Type(Piece::BOMB - attackerVal); + Piece::Type defenderRank = Piece::Type(Piece::BOMB - defenderVal); + cerr << "Forfax " << strColour << " interpreting movement result of " << x << " " << y << " " << direction << " " << result << " ...\n";