#ifndef ONERROR_DEF
 #define ONERROR_DEF


//------------------------- ERROR Module ------------------------//
//						  v 05 . 03 .  2007						 //
//																 //
//								MT								 //
//---------------------------------------------------------------//


//---------------------- Incudes 
#include "stdlib.h"
#include <string.h>
#include "stdio.h"
//====================== Includes



// ---------------- CError -------------- //
 class CError {
		int number;
		char *last_error_text;

	public : 
		CError() { last_error_text = (char*) malloc(sizeof(char)); number = -1; };
		~CError() { free(last_error_text); };
		CError(char *s, int num) { OnError(s, num); };

		void OnError(char *s, int num);
		void OnQuietError(int num);
		int get_number() {int res = number; number = 0; return res; };
 };


//----------------- Errors Defines -----------------
  // Socket errors 
#define ERROR_SOCKET_CREATE "~Error: Cann't create socket.", -2
#define ERROR_SOCKET_WRONG_IP "~Error: Wrong remote IP or PORT.", -3
#define ERROR_SOCKET_OPEN_HOST "~Error: Cann't open remote host.", -4
#define ERROR_SOCKET_CONNECTION_FAULT "~Error: Connection fault.", -5
#define ERROR_SOCKET_LENGTH_ERROR "~Error: Lenght in ReadAferWait_Int incorrect.", -6


 // Main.cpp 
#define ERROR_MAIN_WITHOUT_PARAMETERS "~Error: Program was started without parameters.\n Please, use this form: main <host> <gamer_name> [number_to_wait] .\n", -100
#define ERROR_MAIN_LONG_GAMER_NAME "~Error: Gamer name is so long. \n It must be not more 255 symbols. \n", -101
#define ERROR_MAIN_WAIT_NUMBER "~Error: To wait number is to low. \n", -102

 // Others 
#define ERROR_INCORRECT_INPUT "~Error: Incorrect input", -1000

 // Quiet Errors Numbers
#define ERROR_SOCKET_QUIET_NOT_FIND_S -5000
//==================================================

#endif
