From 3a68f935208fd4a2f5c4994cd74f3b4835c04c06 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Sun, 26 Jun 2005 10:35:54 +0000 Subject: [PATCH] some restructuring --- cop/cop.cpp | 34 +++++++++++++++++++++++++++++----- cop/cop.h | 6 ++++++ 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/cop/cop.cpp b/cop/cop.cpp index 7621563..f5a7f3f 100644 --- a/cop/cop.cpp +++ b/cop/cop.cpp @@ -7,25 +7,54 @@ using namespace std; using namespace __gnu_cxx; string Cop::turn(){ + string input; + + sendInformation(); + getInformation(); + + sendPlan(); + getPlans(); + + vote(); + + //Ignore vote + getline(cin,input); + + return _location; +} + +void Cop::sendInformation(){ cout << "inf\\" << endl; cout << "inf/" << endl; +} +void Cop::getInformation(){ string input; //ignore From-inform do{ getline(cin,input); }while(input != "from/"); +} +void Cop::sendPlan(){ cout << "plan\\" << endl; //cout << "plan: " << _name << endl; cout << "plan/" << endl; +} + +void Cop::getPlans(){ + string input; //ignore From-plan do{ getline(cin,input); }while(input != "from/"); + +} + +void Cop::vote(){ cout << "vote\\" << endl; cout << "vote: " << _name << endl; for (hash_map::const_iterator player = _players.begin(); @@ -36,11 +65,6 @@ string Cop::turn(){ } } cout << "vote/" << endl; - - //Ignore vote - getline(cin,input); - - return _location; } int main(){ diff --git a/cop/cop.h b/cop/cop.h index 23533a6..42cb778 100644 --- a/cop/cop.h +++ b/cop/cop.h @@ -8,5 +8,11 @@ class Cop : public Bot { Cop(std::string name):Bot(name,cop_foot){}; std::string turn(); + protected: + void sendInformation(); + void getInformation(); + void sendPlan(); + void getPlans(); + void vote(); }; #endif -- 2.39.2