mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
changed most of std::cout to tlogX
Alt+F4 quits the game
This commit is contained in:
parent
f97628e67f
commit
ca1dbfe949
@ -301,7 +301,7 @@ void CTerrainRect::clickLeft(tribool down)
|
|||||||
{
|
{
|
||||||
if (currentPath)
|
if (currentPath)
|
||||||
{
|
{
|
||||||
std::cout<<"Warning: Lost path?" << std::endl;
|
tlog2<<"Warning: Lost path?" << std::endl;
|
||||||
delete currentPath;
|
delete currentPath;
|
||||||
currentPath = NULL;
|
currentPath = NULL;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ bool CCallback::upgradeCreature(const CArmedInstance *obj, int stackPos, int new
|
|||||||
}
|
}
|
||||||
void CCallback::endTurn()
|
void CCallback::endTurn()
|
||||||
{
|
{
|
||||||
std::cout << "Player "<<(unsigned)player<<" end his turn."<<std::endl;
|
tlog5 << "Player "<<(unsigned)player<<" end his turn."<<std::endl;
|
||||||
cl->serv->wmx->lock();
|
cl->serv->wmx->lock();
|
||||||
*cl->serv << ui16(100); //report that we ended turn
|
*cl->serv << ui16(100); //report that we ended turn
|
||||||
cl->serv->wmx->unlock();
|
cl->serv->wmx->unlock();
|
||||||
|
@ -52,11 +52,11 @@ CBuildingRect::CBuildingRect(Structure *Str)
|
|||||||
if (border = BitmapHandler::loadBitmap(str->borderName))
|
if (border = BitmapHandler::loadBitmap(str->borderName))
|
||||||
SDL_SetColorKey(border,SDL_SRCCOLORKEY,SDL_MapRGB(border->format,0,255,255));
|
SDL_SetColorKey(border,SDL_SRCCOLORKEY,SDL_MapRGB(border->format,0,255,255));
|
||||||
else
|
else
|
||||||
std::cout << "Warning: no border for "<<Str->ID<<std::endl;
|
tlog2 << "Warning: no border for "<<Str->ID<<std::endl;
|
||||||
if (area = BitmapHandler::loadBitmap(str->areaName))
|
if (area = BitmapHandler::loadBitmap(str->areaName))
|
||||||
;//SDL_SetColorKey(area,SDL_SRCCOLORKEY,SDL_MapRGB(area->format,0,255,255));
|
;//SDL_SetColorKey(area,SDL_SRCCOLORKEY,SDL_MapRGB(area->format,0,255,255));
|
||||||
else
|
else
|
||||||
std::cout << "Warning: no area for "<<Str->ID<<std::endl;
|
tlog2 << "Warning: no area for "<<Str->ID<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
CBuildingRect::~CBuildingRect()
|
CBuildingRect::~CBuildingRect()
|
||||||
@ -460,7 +460,7 @@ void CCastleInterface::splitF()
|
|||||||
}
|
}
|
||||||
void CCastleInterface::buildingClicked(int building)
|
void CCastleInterface::buildingClicked(int building)
|
||||||
{
|
{
|
||||||
std::cout<<"You've clicked on "<<building<<std::endl;
|
tlog5<<"You've clicked on "<<building<<std::endl;
|
||||||
if(building==19 || building==18)
|
if(building==19 || building==18)
|
||||||
{
|
{
|
||||||
building = town->town->hordeLvl[0] + 30;
|
building = town->town->hordeLvl[0] + 30;
|
||||||
@ -547,7 +547,7 @@ void CCastleInterface::buildingClicked(int building)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
std::cout<<"This building isn't handled...\n";
|
tlog4<<"This building isn't handled...\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ CGlobalAI * CAIHandler::getNewAI(CCallback * cb, std::string dllname)
|
|||||||
HINSTANCE dll = LoadLibraryA(dllname.c_str());
|
HINSTANCE dll = LoadLibraryA(dllname.c_str());
|
||||||
if (!dll)
|
if (!dll)
|
||||||
{
|
{
|
||||||
std::cout << "Cannot open AI library ("<<dllname<<"). Throwing..."<<std::endl;
|
tlog1 << "Cannot open AI library ("<<dllname<<"). Throwing..."<<std::endl;
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
throw new std::exception("Cannot open AI library");
|
throw new std::exception("Cannot open AI library");
|
||||||
#endif
|
#endif
|
||||||
@ -49,7 +49,7 @@ CGlobalAI * CAIHandler::getNewAI(CCallback * cb, std::string dllname)
|
|||||||
#if _WIN32
|
#if _WIN32
|
||||||
getName(temp);
|
getName(temp);
|
||||||
#endif
|
#endif
|
||||||
std::cout << "Loaded .dll with AI named " << temp << std::endl;
|
tlog0 << "Loaded .dll with AI named " << temp << std::endl;
|
||||||
delete temp;
|
delete temp;
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
ret = getAI();
|
ret = getAI();
|
||||||
|
@ -75,7 +75,7 @@ CGObjectInstance * createObject(int id, int subid, int3 pos, int owner)
|
|||||||
nobj->ID = id;
|
nobj->ID = id;
|
||||||
nobj->subID = subid;
|
nobj->subID = subid;
|
||||||
if(!nobj->defInfo)
|
if(!nobj->defInfo)
|
||||||
std::cout <<"No def declaration for " <<id <<" "<<subid<<std::endl;
|
tlog3 <<"No def declaration for " <<id <<" "<<subid<<std::endl;
|
||||||
nobj->pos = pos;
|
nobj->pos = pos;
|
||||||
//nobj->state = NULL;//new CLuaObjectScript();
|
//nobj->state = NULL;//new CLuaObjectScript();
|
||||||
nobj->tempOwner = owner;
|
nobj->tempOwner = owner;
|
||||||
@ -602,7 +602,7 @@ int CGameState::pickHero(int owner)
|
|||||||
} while( map->getHero(h) && i<175);
|
} while( map->getHero(h) && i<175);
|
||||||
if(i>174) //probably no free heroes - there's no point in further search, we'll take first free
|
if(i>174) //probably no free heroes - there's no point in further search, we'll take first free
|
||||||
{
|
{
|
||||||
std::cout << "Warning: cannot find free hero - trying to get first available..."<<std::endl;
|
tlog3 << "Warning: cannot find free hero - trying to get first available..."<<std::endl;
|
||||||
for(int j=0; j<HEROES_PER_TYPE * 2 * F_NUMBER; j++)
|
for(int j=0; j<HEROES_PER_TYPE * 2 * F_NUMBER; j++)
|
||||||
if(!map->getHero(j))
|
if(!map->getHero(j))
|
||||||
h=j;
|
h=j;
|
||||||
@ -717,7 +717,7 @@ std::pair<int,int> CGameState::pickObject(CGObjectInstance *obj)
|
|||||||
for(int i=0;i<VLC->objh->cregens.size();i++)
|
for(int i=0;i<VLC->objh->cregens.size();i++)
|
||||||
if(VLC->objh->cregens[i]==cid)
|
if(VLC->objh->cregens[i]==cid)
|
||||||
return std::pair<int,int>(17,i);
|
return std::pair<int,int>(17,i);
|
||||||
std::cout << "Cannot find a dwelling for creature "<<cid <<std::endl;
|
tlog3 << "Cannot find a dwelling for creature "<<cid <<std::endl;
|
||||||
return std::pair<int,int>(17,0);
|
return std::pair<int,int>(17,0);
|
||||||
}
|
}
|
||||||
case 217:
|
case 217:
|
||||||
@ -754,7 +754,7 @@ std::pair<int,int> CGameState::pickObject(CGObjectInstance *obj)
|
|||||||
for(int i=0;i<VLC->objh->cregens.size();i++)
|
for(int i=0;i<VLC->objh->cregens.size();i++)
|
||||||
if(VLC->objh->cregens[i]==cid)
|
if(VLC->objh->cregens[i]==cid)
|
||||||
return std::pair<int,int>(17,i);
|
return std::pair<int,int>(17,i);
|
||||||
std::cout << "Cannot find a dwelling for creature "<<cid <<std::endl;
|
tlog3 << "Cannot find a dwelling for creature "<<cid <<std::endl;
|
||||||
return std::pair<int,int>(17,0);
|
return std::pair<int,int>(17,0);
|
||||||
}
|
}
|
||||||
case 218:
|
case 218:
|
||||||
@ -765,7 +765,7 @@ std::pair<int,int> CGameState::pickObject(CGObjectInstance *obj)
|
|||||||
for(int i=0;i<VLC->objh->cregens.size();i++)
|
for(int i=0;i<VLC->objh->cregens.size();i++)
|
||||||
if(VLC->objh->cregens[i]==cid)
|
if(VLC->objh->cregens[i]==cid)
|
||||||
return std::pair<int,int>(17,i);
|
return std::pair<int,int>(17,i);
|
||||||
std::cout << "Cannot find a dwelling for creature "<<cid <<std::endl;
|
tlog3 << "Cannot find a dwelling for creature "<<cid <<std::endl;
|
||||||
return std::pair<int,int>(17,0);
|
return std::pair<int,int>(17,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -791,7 +791,7 @@ void CGameState::randomizeObject(CGObjectInstance *cur)
|
|||||||
else if(ran.first==34)//special code for hero
|
else if(ran.first==34)//special code for hero
|
||||||
{
|
{
|
||||||
CGHeroInstance *h = dynamic_cast<CGHeroInstance *>(cur);
|
CGHeroInstance *h = dynamic_cast<CGHeroInstance *>(cur);
|
||||||
if(!h) {std::cout<<"Wrong random hero at "<<cur->pos<<std::endl; return;}
|
if(!h) {tlog2<<"Wrong random hero at "<<cur->pos<<std::endl; return;}
|
||||||
cur->ID = ran.first;
|
cur->ID = ran.first;
|
||||||
h->portrait = cur->subID = ran.second;
|
h->portrait = cur->subID = ran.second;
|
||||||
h->type = VLC->heroh->heroes[ran.second];
|
h->type = VLC->heroh->heroes[ran.second];
|
||||||
@ -801,7 +801,7 @@ void CGameState::randomizeObject(CGObjectInstance *cur)
|
|||||||
else if(ran.first==98)//special code for town
|
else if(ran.first==98)//special code for town
|
||||||
{
|
{
|
||||||
CGTownInstance *t = dynamic_cast<CGTownInstance*>(cur);
|
CGTownInstance *t = dynamic_cast<CGTownInstance*>(cur);
|
||||||
if(!t) {std::cout<<"Wrong random town at "<<cur->pos<<std::endl; return;}
|
if(!t) {tlog2<<"Wrong random town at "<<cur->pos<<std::endl; return;}
|
||||||
cur->ID = ran.first;
|
cur->ID = ran.first;
|
||||||
cur->subID = ran.second;
|
cur->subID = ran.second;
|
||||||
t->town = &VLC->townh->towns[ran.second];
|
t->town = &VLC->townh->towns[ran.second];
|
||||||
@ -820,7 +820,7 @@ void CGameState::randomizeObject(CGObjectInstance *cur)
|
|||||||
map->defs.insert(cur->defInfo = VLC->dobjinfo->gobjs[ran.first][ran.second]);
|
map->defs.insert(cur->defInfo = VLC->dobjinfo->gobjs[ran.first][ran.second]);
|
||||||
if(!cur->defInfo)
|
if(!cur->defInfo)
|
||||||
{
|
{
|
||||||
std::cout<<"*BIG* WARNING: Missing def declaration for "<<cur->ID<<" "<<cur->subID<<std::endl;
|
tlog1<<"*BIG* WARNING: Missing def declaration for "<<cur->ID<<" "<<cur->subID<<std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1099,7 +1099,7 @@ void CGameState::init(StartInfo * si, Mapa * map, int Seed)
|
|||||||
{
|
{
|
||||||
if(!k->second.heroes.size())
|
if(!k->second.heroes.size())
|
||||||
{
|
{
|
||||||
std::cout << "Cannot give starting artifact - no heroes!" << std::endl;
|
tlog5 << "Cannot give starting artifact - no heroes!" << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CArtifact *toGive;
|
CArtifact *toGive;
|
||||||
|
@ -81,8 +81,8 @@ void CGarrisonSlot::hover (bool on)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Warning - shouldn't be - highlighted void slot "<<owner->highlighted<<std::endl;
|
tlog2 << "Warning - shouldn't be - highlighted void slot "<<owner->highlighted<<std::endl;
|
||||||
std::cout << "Highlighted set to NULL"<<std::endl;
|
tlog2 << "Highlighted set to NULL"<<std::endl;
|
||||||
owner->highlighted = NULL;
|
owner->highlighted = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1721,6 +1721,14 @@ void CPlayerInterface::handleKeyDown(SDL_Event *sEvent)
|
|||||||
LOCPLINT->adventureInt->scrollingDown = true;
|
LOCPLINT->adventureInt->scrollingDown = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case (SDLK_F4):
|
||||||
|
{
|
||||||
|
if(sEvent->key.keysym.mod & KMOD_LALT) //Alt+F4
|
||||||
|
{
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
//case (SDLK_q):
|
//case (SDLK_q):
|
||||||
// {
|
// {
|
||||||
// exit(0);
|
// exit(0);
|
||||||
|
@ -1875,6 +1875,10 @@ StartInfo CPreGame::runLoop()
|
|||||||
{
|
{
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
if(sEvent.key.keysym.sym==SDLK_F4 && (sEvent.key.keysym.mod & KMOD_LALT)) //Alt+F4
|
||||||
|
{
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
/*if (state==EState::newGame)
|
/*if (state==EState::newGame)
|
||||||
{
|
{
|
||||||
switch (sEvent.key.keysym.sym)
|
switch (sEvent.key.keysym.sym)
|
||||||
|
@ -277,7 +277,7 @@ SDL_Surface * BitmapHandler::loadBitmap(std::string fname, bool setKey)
|
|||||||
Entry *e = bitmaph->entries.znajdz(fname);
|
Entry *e = bitmaph->entries.znajdz(fname);
|
||||||
if(!e)
|
if(!e)
|
||||||
{
|
{
|
||||||
std::cout<<"File "<<fname<<" not found"<<std::endl;
|
tlog2<<"File "<<fname<<" not found"<<std::endl;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if(e->offset<0)
|
if(e->offset<0)
|
||||||
@ -339,7 +339,7 @@ SDL_Surface * BitmapHandler::loadBitmap(std::string fname, bool setKey)
|
|||||||
int res=bitmaph->infs2(pcd,e->size,e->realSize,pcx);
|
int res=bitmaph->infs2(pcd,e->size,e->realSize,pcx);
|
||||||
if(res!=0)
|
if(res!=0)
|
||||||
{
|
{
|
||||||
std::cout<<"an error "<<res<<" occured while extracting file "<<fname<<std::endl;
|
tlog2<<"an error "<<res<<" occured while extracting file "<<fname<<std::endl;
|
||||||
}
|
}
|
||||||
delete [] pcd;
|
delete [] pcd;
|
||||||
}
|
}
|
||||||
|
@ -99,9 +99,9 @@ void CTownHandler::loadNames()
|
|||||||
if((i2=(i->second.find(buildingID=atoi(s.c_str()))))!=(i->second.end()))
|
if((i2=(i->second.find(buildingID=atoi(s.c_str()))))!=(i->second.end()))
|
||||||
i2->second->pos.z=itr++;
|
i2->second->pos.z=itr++;
|
||||||
else
|
else
|
||||||
std::cout << "Warning1: No building "<<buildingID<<" in the castle "<<castleID<<std::endl;
|
tlog3 << "Warning1: No building "<<buildingID<<" in the castle "<<castleID<<std::endl;
|
||||||
else
|
else
|
||||||
std::cout << "Warning1: Castle "<<castleID<<" not defined."<<std::endl;
|
tlog3 << "Warning1: Castle "<<castleID<<" not defined."<<std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
of.close();
|
of.close();
|
||||||
@ -124,9 +124,9 @@ void CTownHandler::loadNames()
|
|||||||
i2->second->areaName = area;
|
i2->second->areaName = area;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
std::cout << "Warning2: No building "<<id<<" in the castle "<<town<<std::endl;
|
tlog3 << "Warning2: No building "<<id<<" in the castle "<<town<<std::endl;
|
||||||
else
|
else
|
||||||
std::cout << "Warning2: Castle "<<town<<" not defined."<<std::endl;
|
tlog3 << "Warning2: Castle "<<town<<" not defined."<<std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
of.close();
|
of.close();
|
||||||
@ -138,7 +138,7 @@ void CTownHandler::loadNames()
|
|||||||
of >> format;
|
of >> format;
|
||||||
if(format!=1)
|
if(format!=1)
|
||||||
{
|
{
|
||||||
std::cout << "Unhandled format of buildings4.txt \n";
|
tlog1 << "Unhandled format of buildings4.txt \n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -180,9 +180,9 @@ void CTownHandler::loadNames()
|
|||||||
if((i2=(i->second.find(buildingID)))!=(i->second.end()))
|
if((i2=(i->second.find(buildingID)))!=(i->second.end()))
|
||||||
i2->second->group = itr;
|
i2->second->group = itr;
|
||||||
else
|
else
|
||||||
std::cout << "Warning3: No building "<<buildingID<<" in the castle "<<castleID<<std::endl;
|
tlog3 << "Warning3: No building "<<buildingID<<" in the castle "<<castleID<<std::endl;
|
||||||
else
|
else
|
||||||
std::cout << "Warning3: Castle "<<castleID<<" not defined."<<std::endl;
|
tlog3 << "Warning3: Castle "<<castleID<<" not defined."<<std::endl;
|
||||||
}
|
}
|
||||||
else //set group for selected building in ALL castles
|
else //set group for selected building in ALL castles
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ CConnection::CConnection(std::string host, std::string port, std::string Name, s
|
|||||||
connerror1:
|
connerror1:
|
||||||
tlog1 << "Something went wrong... checking for error info" << std::endl;
|
tlog1 << "Something went wrong... checking for error info" << std::endl;
|
||||||
if(error)
|
if(error)
|
||||||
std::cout << error <<std::endl;
|
tlog1 << error <<std::endl;
|
||||||
else
|
else
|
||||||
tlog1 << "No error info. " << std::endl;
|
tlog1 << "No error info. " << std::endl;
|
||||||
delete io_service;
|
delete io_service;
|
||||||
@ -107,7 +107,7 @@ CConnection::CConnection(boost::asio::basic_socket_acceptor<boost::asio::ip::tcp
|
|||||||
acceptor->accept(*socket,error);
|
acceptor->accept(*socket,error);
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
std::cout << "Error on accepting: " << std::endl << error << std::endl;
|
tlog1 << "Error on accepting: " << std::endl << error << std::endl;
|
||||||
delete socket;
|
delete socket;
|
||||||
throw "Can't establish connection :(";
|
throw "Can't establish connection :(";
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ public:
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void loadPointer(T &data)
|
void loadPointer(T &data)
|
||||||
{
|
{
|
||||||
std::cout<<"Allocating memory for pointer!"<<std::endl;
|
tlog5<<"Allocating memory for pointer!"<<std::endl;
|
||||||
typedef typename boost::remove_pointer<T>::type npT;
|
typedef typename boost::remove_pointer<T>::type npT;
|
||||||
data = new npT;
|
data = new npT;
|
||||||
*this >> *data;
|
*this >> *data;
|
||||||
|
2
map.cpp
2
map.cpp
@ -44,7 +44,7 @@ std::set<si32> convertBuildings(const std::set<si32> h3m, int castleID)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout<<"Conversion warning: unknown building "<<*i<<" in castle "<<castleID<<std::endl;
|
tlog3<<"Conversion warning: unknown building "<<*i<<" in castle "<<castleID<<std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ void CGameHandler::changePrimSkill(int ID, int which, int val, bool abs)
|
|||||||
if(hero->exp >= VLC->heroh->reqExp(hero->level+1)) //new level
|
if(hero->exp >= VLC->heroh->reqExp(hero->level+1)) //new level
|
||||||
{
|
{
|
||||||
//give prim skill
|
//give prim skill
|
||||||
std::cout << hero->name <<" got level "<<hero->level<<std::endl;
|
tlog5 << hero->name <<" got level "<<hero->level<<std::endl;
|
||||||
int r = rand()%100, pom=0, x=0;
|
int r = rand()%100, pom=0, x=0;
|
||||||
int std::pair<int,int>::*g = (hero->level>9) ? (&std::pair<int,int>::second) : (&std::pair<int,int>::first);
|
int std::pair<int,int>::*g = (hero->level>9) ? (&std::pair<int,int>::second) : (&std::pair<int,int>::first);
|
||||||
for(;x<PRIMARY_SKILLS;x++)
|
for(;x<PRIMARY_SKILLS;x++)
|
||||||
@ -193,7 +193,7 @@ void CGameHandler::changePrimSkill(int ID, int which, int val, bool abs)
|
|||||||
if(r<pom)
|
if(r<pom)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
std::cout << "Bohater dostaje umiejetnosc pierwszorzedna " << x << " (wynik losowania "<<r<<")"<<std::endl;
|
tlog5 << "Bohater dostaje umiejetnosc pierwszorzedna " << x << " (wynik losowania "<<r<<")"<<std::endl;
|
||||||
SetPrimSkill sps;
|
SetPrimSkill sps;
|
||||||
sps.id = ID;
|
sps.id = ID;
|
||||||
sps.which = x;
|
sps.which = x;
|
||||||
@ -750,7 +750,7 @@ upgend:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Warning, wrong garrison swap command for " << tid << std::endl;
|
tlog3 << "Warning, wrong garrison swap command for " << tid << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1028,11 +1028,11 @@ CGameHandler::~CGameHandler(void)
|
|||||||
void CGameHandler::init(StartInfo *si, int Seed)
|
void CGameHandler::init(StartInfo *si, int Seed)
|
||||||
{
|
{
|
||||||
Mapa *map = new Mapa(si->mapname);
|
Mapa *map = new Mapa(si->mapname);
|
||||||
std::cout << "Map loaded!" << std::endl;
|
tlog0 << "Map loaded!" << std::endl;
|
||||||
gs = new CGameState();
|
gs = new CGameState();
|
||||||
std::cout << "Gamestate created!" << std::endl;
|
tlog0 << "Gamestate created!" << std::endl;
|
||||||
gs->init(si,map,Seed);
|
gs->init(si,map,Seed);
|
||||||
std::cout << "Gamestate initialized!" << std::endl;
|
tlog0 << "Gamestate initialized!" << std::endl;
|
||||||
/****************************LUA OBJECT SCRIPTS************************************************/
|
/****************************LUA OBJECT SCRIPTS************************************************/
|
||||||
//std::vector<std::string> * lf = CLuaHandler::searchForScripts("scripts/lua/objects"); //files
|
//std::vector<std::string> * lf = CLuaHandler::searchForScripts("scripts/lua/objects"); //files
|
||||||
//for (int i=0; i<lf->size(); i++)
|
//for (int i=0; i<lf->size(); i++)
|
||||||
|
@ -33,7 +33,7 @@ void vaccept(tcp::acceptor *ac, tcp::socket *s, boost::system::error_code *error
|
|||||||
CVCMIServer::CVCMIServer()
|
CVCMIServer::CVCMIServer()
|
||||||
: io(new io_service()), acceptor(new tcp::acceptor(*io, tcp::endpoint(tcp::v4(), port)))
|
: io(new io_service()), acceptor(new tcp::acceptor(*io, tcp::endpoint(tcp::v4(), port)))
|
||||||
{
|
{
|
||||||
std::cout << "CVCMIServer created!" <<std::endl;
|
tlog4 << "CVCMIServer created!" <<std::endl;
|
||||||
}
|
}
|
||||||
CVCMIServer::~CVCMIServer()
|
CVCMIServer::~CVCMIServer()
|
||||||
{
|
{
|
||||||
@ -83,7 +83,7 @@ void CVCMIServer::newGame(CConnection *c)
|
|||||||
acceptor->accept(*s,error);
|
acceptor->accept(*s,error);
|
||||||
if(error) //retry
|
if(error) //retry
|
||||||
{
|
{
|
||||||
std::cout<<"Cannot establish connection - retrying..." << std::endl;
|
tlog3<<"Cannot establish connection - retrying..." << std::endl;
|
||||||
i--;
|
i--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ void CVCMIServer::start()
|
|||||||
}
|
}
|
||||||
|
|
||||||
boost::system::error_code error;
|
boost::system::error_code error;
|
||||||
std::cout<<"Listening for connections at port " << acceptor->local_endpoint().port() << std::endl;
|
tlog0<<"Listening for connections at port " << acceptor->local_endpoint().port() << std::endl;
|
||||||
tcp::socket * s = new tcp::socket(acceptor->io_service());
|
tcp::socket * s = new tcp::socket(acceptor->io_service());
|
||||||
boost::thread acc(boost::bind(vaccept,acceptor,s,&error));
|
boost::thread acc(boost::bind(vaccept,acceptor,s,&error));
|
||||||
sr->setToTrueAndNotify();
|
sr->setToTrueAndNotify();
|
||||||
@ -121,12 +121,12 @@ void CVCMIServer::start()
|
|||||||
acc.join();
|
acc.join();
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
std::cout<<"Got connection but there is an error " << std::endl << error;
|
tlog2<<"Got connection but there is an error " << std::endl << error;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::cout<<"We've accepted someone... " << std::endl;
|
tlog0<<"We've accepted someone... " << std::endl;
|
||||||
CConnection *connection = new CConnection(s,NAME,std::cout);
|
CConnection *connection = new CConnection(s,NAME,std::cout);
|
||||||
std::cout<<"Got connection!" << std::endl;
|
tlog0<<"Got connection!" << std::endl;
|
||||||
while(!end2)
|
while(!end2)
|
||||||
{
|
{
|
||||||
uint8_t mode;
|
uint8_t mode;
|
||||||
@ -165,7 +165,7 @@ int main(int argc, char** argv)
|
|||||||
port = _ttoi(argv[1]);
|
port = _ttoi(argv[1]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
std::cout << "Port " << port << " will be used." << std::endl;
|
tlog0 << "Port " << port << " will be used." << std::endl;
|
||||||
CLodHandler h3bmp;
|
CLodHandler h3bmp;
|
||||||
h3bmp.init("Data" PATHSEPARATOR "H3bitmap.lod","Data");
|
h3bmp.init("Data" PATHSEPARATOR "H3bitmap.lod","Data");
|
||||||
initDLL(&h3bmp,console,logfile);
|
initDLL(&h3bmp,console,logfile);
|
||||||
|
Loading…
Reference in New Issue
Block a user