#pragma once
#include "Jass.h"
#include "myJASSConstants.h"
#include "Game_structures.h"
#include "MapBases.h"

#include "JassApi_functions_extern.h"

extern integer vMapGlobal;
extern char * pMapGlobal;
//player vAIPlayer;
//int vAI;
//unit vMainUnit;

extern char vTest[1000];
extern int vFlagTest;

extern IdDataUnit vDataUnits[MAX_COUNT_UNITS];
extern unsigned short vMapUnits[2][vSizeMap];

extern integer vNLocalPlayer;
extern integer vStartCommands;
extern integer vStartCommandsGo;
extern HTRIGGER hTriggerUnitEntersWorldBoundsRegion;
extern HTRIGGER hTriggerFillMapUnits;

//HRECT hRectMap[vSizeMap];
extern HLOCATION hLocationMap[vSizeMap];
extern HLOCATION hLocationCenterCellMap[vSizeMap];

extern HTEXTTAG vTextTagMap;
extern HTEXTTAG vTextTag;
extern HTEXTTAG vTextTag2[vSizeMap];
extern HTIMER vTimerGame;
extern real vTimeActionFillMapUnits;

extern integer vSetHost;
extern integer vSetHostGo;
extern HPLAYER vHostPlayer;
extern HPLAYERCOLOR vHost;

extern DataGoTo *pFirstDataGoTo;
extern DataGoTo *pLastDataGoTo;

extern HumanPlayer *pHumanPlayerGlobal;
extern VampirePlayer *pVampirePlayerGlobal;

extern integer vCountHumans;
extern integer vCountVampires;
extern integer vCountHumansUser;
extern integer vCountVampiresUser;

extern integer vGameBegin;

extern HTIMER vTimerActionsGame;

extern HTRIGGER hTriggerEndGame;
extern HTRIGGER hTriggerEndGame2;
extern HTRIGGER hTriggerEndGame3;
extern HTRIGGER hTriggerChat;

extern unsigned short vLastUnit;

extern HHASHTABLE vHT;

extern integer vAuthorization;
extern integer vCountAttempts;

extern HREGION hRegionWorldBounds;

extern integer vWin;
extern HTRIGGER hTriggerWinPlayer[MAX_PLAYERS];

extern HRECT vWorldRect;
extern HRECT vManaWellRect;

extern char vIP[100];
extern bool bIP;

extern HTIMER vTimerForFogOfWar;

extern HTRIGGER hTriggerChatAI;

extern integer vEndGame2;

extern HGAMECACHE vSyncCache;
extern HGAMECACHE vSyncCache2;
extern HGAMECACHE vSyncCache3;
extern HGAMECACHE vSyncCache4;

extern HGAMECACHE vAuthorizationCache;

extern sPlayerUser *pPlayerUser;
extern integer vCountPlayersUser;

extern unsigned short vTopShop;
extern unsigned short vRecepts;
extern unsigned short vGate;
extern unsigned short vSven;
extern unsigned short vBansha;
extern unsigned short vManaWell;
extern unsigned short vWellOfLife;
extern unsigned short vBaseOfUnits;

extern sDataVampires * pDataVampires;
extern sDataHumans * pDataHumans;

extern unsigned short vMaxBase;

extern HRECT vBaseZeroRect;

//extern HTRIGGER hTriggerUnitLeaveWorldBoundsRegion;

extern MapBases vMapBases;

extern HRECT vBaseVampires;

extern HHASHTABLE vHT_2;

extern int vNumLog;

extern char vKeyLocalPlayer[3];

extern bool vSync;
extern bool vSync2;
extern bool vSync4;

extern int vCountForLoopGame;

extern sStackActions *vBundle;

extern char vBuf[300];

//extern sDataUnit2 *pCurrentCreateDataUnit;
//extern sDataUnit2 *pLastCreateDataUnit;
//extern sDataUnit2 *pCurrentDeleteDataUnit;
//extern sDataUnit2 *pLastDeleteDataUnit;
//extern sDataUnit2 vDataUnit2[MAX_COUNT_UNITS];
//extern unsigned short vNLastDataUnit2;
extern sActionStackForDelAndCreateUnit vActionStackForDelUnit;
extern sActionStackForDelAndCreateUnit vActionStackForCreateUnit;
extern sActionStackForDelAndCreateUnit vActionStackForCreateedUnit;
extern HTIMER vTimerDataUnit2;

extern StackForUnits vStackForUnits[MAX_COUNT_UNITS];
extern unsigned short vNLastStackForUnits;
extern unsigned short vQUnitsInBase[JASS_NumBase_MAX];

extern sStackChains vStackChains[MAX_COUNT_UNITS];
extern unsigned short vNLastStackChains;

extern bool vStartGameSleep;

extern HMODULE hJassApi;
extern HMODULE hJassApi_2;

//extern bool vSync4_Priority;

extern sDataUnit2 pDataUnit2;

extern HTIMER vTimerPreActionsGame;

extern HTIMER vTimerGameHumans;

extern sParamEndGame vParamEndGame;
extern HANDLE hThreadEndGame;

extern HTIMER vTimerPreBeginGameProcess;

extern TEventRegistrationHandle vEndGameHandle;