#ifndef _empire
#define _empire

#include <time.h>
#include <string>
#include <vector>
#include <fstream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <allegro.h>
	#ifdef ALLEGRO_WINDOWS
		#include <winalleg.h>
	#endif
#include <fmod.h>
#include <OpenLayer.hpp>
#include <jpgalleg.h>
using namespace std;
using namespace ol;
#include "structs.h"
#include "ai_types.h"
#include "button.h"
#include "units.h"
#include "player.h"
#include "map.h"
#include "minimap.h"
#include "ranges.h"
#include "ai_path.h"
#include "ai.h"
#include "particle.h"
#include "gameoptions.h"
#include "sound.h"
#include "draw.h"
#include "listbox.h"
#include "fileselect.h"

// Building types
#define CITY    0
#define BASE    1
#define AIRPORT 2
#define PORT    3
#define HQ      9

#define QUIT      -1
#define MENU       0
#define LOGIC      1
#define MAPEDIT    2
#define PLAYEREDIT 3
#define GAMEOVER   4
#define GAMEINTRO  5
#define MISSION    6
#define CAMPAIGN   7
#define TRANSITION 8

#define MENU_FIRST          10
#define MENU_LOAD           11
#define MENU_OPTIONS        12
#define MENU_GAME_OPTIONS   13
#define MENU_GAME_LOAD      14
#define MENU_INGAME_OPTIONS 15

// Mouse types
#define MOUSE_NORMAL 0
#define MOUSE_TARGET 1

//#define LMOUSE 0
//#define LTILE 1

// Player controller types
#define HUMAN 0
#define AI    1

// Attack types
#define RANGED 0
#define DIRECT 1

// AI types
#define LAND   0
#define AIR    1
#define SEA    2
#define CUSTOM 3

#define BLACK makecol(0, 0, 0)
#define GREY makecol(128, 128, 128)
#define LGREY makecol(192, 192, 192)
#define DGREY makecol(64, 64, 64)
#define VDGREY makecol(32, 32, 32)
#define RED makecol(255, 0, 0)
#define GREEN makecol(0, 255, 0)
#define DGREEN makecol(0, 150, 0)
#define BLUE makecol(0, 0, 255)
#define YELLOW makecol(255, 255, 0)
#define DYELLOW makecol(150, 150, 0)
#define WHITE makecol(255, 255, 255)
#define ORANGE makecol(255, 128, 0)
#define BROWN makecol(150, 100, 50)
#define DBROWN makecol(100, 70, 40)
#define TRANS makecol(255, 0, 255)

#define RIGHT 1
#define DOWN  2
#define UP    3
#define LEFT  4

// Unit types
#define ANTI_AIR  0
#define APC       1
#define ARTILLERY 2
#define B_COPTER  3
#define B_SHIP    4
#define BOMBER    5
#define CRUISER   6
#define FIGHTER   7
#define INFANTRY  8
#define LANDER    9
#define MD_TANK   10
#define MECH      11
#define MISSILES  12
#define RECON     13
#define ROCKETS   14
#define SUB       15
#define T_COPTER  16
#define TANK      17

// Movement types
#define M_INFANTRY 0
#define M_TIRES    1
#define M_TREAD    2
#define M_AIR      3
#define M_MECH     4
#define M_SEA      5
#define M_LANDER   6

void play_sound(int soundtype);
extern int mouse_clicked();
extern int mouse_rclicked();
extern void draw_mouse();
extern void play_song(string path);
extern void empdebug(string text);

extern _globalsettings global;
extern _logic_variables var;

extern Bitmap *transition;

extern bitmapdat land, river, sea, shoal, buildings, special;
extern bitmapdat mouse;
extern bitmapdat glb;
extern bitmapdat explode1;
extern bitmapdat units[4][18];
extern vector<animtiles> animated_tiles;
extern vector<string> maplist;

extern TextRenderer normal;
extern TextRenderer big;

extern _player player[4];
extern _character *currentcharacter[4];
extern _character *loadedcharacter[4];
extern vector<_character *> character;
extern vector<Bitmap *> avatars;
extern void save_map_and_players(ofstream *savefile);

extern volatile int counter;

extern _map worldmap;
extern _tile tile;
extern _minimap minimap;
extern _ingameoptions gameoptions;
extern FMOD_SOUND *musicfile;
extern FMOD_SYSTEM *fmodmain;

extern int pturn;
extern int mouse_type;
extern int first_mission_character;
extern string title_music;

#endif
