00001 #ifndef DEKLARACJE
00002 #define DEKLARACJE
00003 #include "Wyjatki.h"
00004 #include <string>
00005 #include <sstream>
00006 #include <iostream>
00010 enum POLE { GRACZ_1=-1, PUSTE=0, GRACZ_2=1};
00011
00015 typedef bool bool_;
00016
00020 typedef POLE TURA;
00021
00025 struct WSPOLRZEDNE_PLANSZY
00026 {
00027
00028 static int maxX;
00029 static int maxY;
00030
00031
00032 int x;
00033 int y;
00034 WSPOLRZEDNE_PLANSZY operator+(int v){return WSPOLRZEDNE_PLANSZY(x+v,y+v);};
00035 WSPOLRZEDNE_PLANSZY operator-(int v){return WSPOLRZEDNE_PLANSZY(x-v,y-v);};
00036 WSPOLRZEDNE_PLANSZY(){WSPOLRZEDNE_PLANSZY(0,0);};
00037 WSPOLRZEDNE_PLANSZY(int x, int y):x(x),y(y){if (x<0||y<0) throw WyjatekBlednyArgument("blad wspolrzednych planszy"+ToString());};
00038 std::string ToString() {std::ostringstream ss; ss<<x<<" ; "<<y; return ss.str();};
00039 };
00040
00044 struct WSPOLRZEDNE_EKRANOWE
00045 {
00046
00047 static int maxX;
00048 static int maxY;
00049
00050
00051 int x;
00052 int y;
00053 WSPOLRZEDNE_EKRANOWE(){WSPOLRZEDNE_EKRANOWE(0,0);};
00054 WSPOLRZEDNE_EKRANOWE(int x, int y):x(x),y(y){if (x<0||y<0) throw WyjatekBlednyArgument("blad wspolrzednych ekranowych"+ToString());};
00055 std::string ToString() {std::ostringstream ss; ss<<x<<" ; "<<y; return ss.str();};
00056 };
00060 struct RUCH
00061 {
00062 RUCH(WSPOLRZEDNE_PLANSZY zrodlo, WSPOLRZEDNE_PLANSZY cel):zrodlo(zrodlo), cel(cel){;};
00063 RUCH():zrodlo(WSPOLRZEDNE_PLANSZY(0,0)), cel(WSPOLRZEDNE_PLANSZY(0,0)){;};
00064 WSPOLRZEDNE_PLANSZY zrodlo;
00065 WSPOLRZEDNE_PLANSZY cel;
00066 bool_ operator==(const RUCH & r){ if(r.zrodlo.x==zrodlo.x&&r.zrodlo.y==zrodlo.y&&r.cel.x==cel.x&&r.cel.y==cel.y) return true; else return false;};
00067 void operator=(const RUCH & r){ zrodlo.x=r.zrodlo.x;zrodlo.y=r.zrodlo.y;cel.x=r.cel.x;cel.y=r.cel.y;};
00068 std::string ToString(){std::ostringstream ss; ss <<zrodlo.x<<":"<<zrodlo.y<<" -> "<<cel.x<<":"<<cel.y; return ss.str();};
00069 friend std::ostream& operator<<(std::ostream & o, RUCH r){o<<"Ruch " <<r.zrodlo.x<<":"<<r.zrodlo.y<<" -> "<<r.cel.x<<":"<<r.cel.y<<std::endl;return o;};
00070 };
00074 enum STAN {KONIEC=0, MENU=1, MENUGRA=2, PAUZA=3, GRA=4, POMOC=5, WYGRANA1=6, WYGRANA2=7, USTAWIANIE=8};
00078 enum TYP {HvH=0, HvC=1, CvH=2, CvC=3};
00079 #endif
00080