diff --git a/AdventureMapButton.cpp b/AdventureMapButton.cpp index 0639594c5..58c6986eb 100644 --- a/AdventureMapButton.cpp +++ b/AdventureMapButton.cpp @@ -116,7 +116,6 @@ void AdventureMapButton::init(const CFunctionList &Callback, const std:: state=0; hoverTexts = Name; helpBox=HelpBox; - colorChange = playerColoredButton; int est = LOCPLINT->playerID; CDefHandler * temp = CDefHandler::giveDef(defName); temp->notFreeImgs = true; @@ -320,3 +319,10 @@ CSlider::CSlider(int x, int y, int totalw, boost::function Moved, int moveTo(value); } + +void CSlider::block( bool on ) +{ + left.block(on); + right.block(on); + slider.block(on); +} \ No newline at end of file diff --git a/AdventureMapButton.h b/AdventureMapButton.h index ee458bd10..d136897f8 100644 --- a/AdventureMapButton.h +++ b/AdventureMapButton.h @@ -63,6 +63,7 @@ public: void mouseMoved (SDL_MouseMotionEvent & sEvent); void moveRight(); void moveTo(int to); + void block(bool on); void activate(); // makes button active void deactivate(); // makes button inactive (but doesn't delete) void show(SDL_Surface * to = NULL); diff --git a/CCallback.cpp b/CCallback.cpp index 55ed83f2e..83712ebf9 100644 --- a/CCallback.cpp +++ b/CCallback.cpp @@ -28,6 +28,21 @@ #endif extern CSharedCond > mess; +int gcd(int x, int y) +{ + int temp; + if (y > x) + swap(x,y); + while (y != 0) + { + temp = y; + y = x-y; + x = temp; + if (y > x) + swap(x,y); + } + return x; +} HeroMoveDetails::HeroMoveDetails(int3 Src, int3 Dst, CGHeroInstance*Ho) :src(Src),dst(Dst),ho(Ho) { @@ -543,4 +558,30 @@ std::vector < const CGObjectInstance * > CCallback::getVisitableObjs( int3 pos ) BOOST_FOREACH(const CGObjectInstance * obj, gs->map->terrain[pos.x][pos.y][pos.z].visitableObjects) ret.push_back(obj); return ret; +} + +void CCallback::getMarketOffer( int t1, int t2, int &give, int &rec, int mode/*=0*/ ) +{ + if(mode) return; //TODO - support + boost::shared_lock lock(*gs->mx); + //if(gs->resVals[t1] >= gs->resVals[t2]) + float r = gs->resVals[t1], + g = gs->resVals[t2] / gs->getMarketEfficiency(player,mode); + if(r>g) + { + rec = r / g; + give = 1; + } + else + { + give = g / r; + rec = 1; + } +} + +void CCallback::trade( int mode, int id1, int id2, int val1 ) +{ + int p1, p2; + getMarketOffer(id1,id2,p1,p2,mode); + *cl->serv << ui16(511) << ui8(player) << ui32(mode) << ui32(id1) << ui32(id2) << ui32(val1); } \ No newline at end of file diff --git a/CCallback.h b/CCallback.h index b7bd02867..1fc28acf7 100644 --- a/CCallback.h +++ b/CCallback.h @@ -41,6 +41,7 @@ public: virtual void endTurn()=0; virtual void swapGarrisonHero(const CGTownInstance *town)=0; virtual void buyArtifact(const CGHeroInstance *hero, int aid)=0; //used to buy artifacts in towns (including spell book in the guild and war machines in blacksmith) + virtual void trade(int mode, int id1, int id2, int val1)=0; //mode==0: sell val1 units of id1 resource for id2 resiurce //get info virtual bool verifyPath(CPath * path, bool blockSea)=0; @@ -62,6 +63,7 @@ public: virtual const StartInfo * getStartInfo()=0; virtual std::vector < const CGObjectInstance * > getBlockingObjs(int3 pos)=0; virtual std::vector < const CGObjectInstance * > getVisitableObjs(int3 pos)=0; + virtual void getMarketOffer(int t1, int t2, int &give, int &rec, int mode=0)=0; //battle virtual int battleGetBattlefieldType()=0; // 1. sand/shore 2. sand/mesas 3. dirt/birches 4. dirt/hills 5. dirt/pines 6. grass/hills 7. grass/pines 8. lava 9. magic plains 10. snow/mountains 11. snow/trees 12. subterranean 13. swamp/trees 14. fiery fields 15. rock lands 16. magic clouds 17. lucid pools 18. holy ground 19. clover field 20. evil fog 21. "favourable winds" text on magic plains background 22. cursed ground 23. rough 24. ship to ship 25. ship @@ -118,6 +120,7 @@ public: void endTurn(); void swapGarrisonHero(const CGTownInstance *town); void buyArtifact(const CGHeroInstance *hero, int aid); + void trade(int mode, int id1, int id2, int val1); //get info bool verifyPath(CPath * path, bool blockSea); @@ -138,9 +141,10 @@ public: int getMySerial(); const CCreatureSet* getGarrison(const CGObjectInstance *obj); UpgradeInfo getUpgradeInfo(const CArmedInstance *obj, int stackPos); - virtual const StartInfo * getStartInfo(); + const StartInfo * getStartInfo(); std::vector < const CGObjectInstance * > getBlockingObjs(int3 pos); std::vector < const CGObjectInstance * > getVisitableObjs(int3 pos); + void getMarketOffer(int t1, int t2, int &give, int &rec, int mode=0); //battle int battleGetBattlefieldType(); // 1. sand/shore 2. sand/mesas 3. dirt/birches 4. dirt/hills 5. dirt/pines 6. grass/hills 7. grass/pines 8. lava 9. magic plains 10. snow/mountains 11. snow/trees 12. subterranean 13. swamp/trees 14. fiery fields 15. rock lands 16. magic clouds 17. lucid pools 18. holy ground 19. clover field 20. evil fog 21. "favourable winds" text on magic plains background 22. cursed ground 23. rough 24. ship to ship 25. ship diff --git a/CCastleInterface.cpp b/CCastleInterface.cpp index 3271b3cc0..aee87fd6d 100644 --- a/CCastleInterface.cpp +++ b/CCastleInterface.cpp @@ -280,7 +280,7 @@ void CHeroGSlot::show() if(hero) //there is hero blitAt(graphics->portraitLarge[hero->portrait],pos); else if(!upg) //up garrison - blitAt((static_cast(LOCPLINT->curint))->flag->ourImages[(static_cast(LOCPLINT->curint))->town->getOwner()].bitmap,pos); + blitAt(graphics->flags->ourImages[(static_cast(LOCPLINT->curint))->town->getOwner()].bitmap,pos); if(highlight) blitAt(graphics->bigImgs[-1],pos); } @@ -348,7 +348,6 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, bool Activate) cityBg = BitmapHandler::loadBitmap(getBgName(Town->subID)); hall = CDefHandler::giveDef("ITMTL.DEF"); fort = CDefHandler::giveDef("ITMCL.DEF"); - flag = CDefHandler::giveDef("CREST58.DEF"); hBuild = NULL; count=0; town = Town; @@ -436,7 +435,6 @@ CCastleInterface::~CCastleInterface() delete split; delete hall; delete fort; - delete flag; delete garr; delete townlist; delete statusbar; @@ -517,6 +515,13 @@ void CCastleInterface::buildingClicked(int building) case 10: case 11: case 12: case 13: enterHall(); break; + case 14: + { + deactivate(); + CMarketplaceWindow *cmw = new CMarketplaceWindow(0); + cmw->activate(); + break; + } case 16: { const CGHeroInstance *hero = town->visitingHero; diff --git a/CCastleInterface.h b/CCastleInterface.h index b38ed2a2f..f84aca89d 100644 --- a/CCastleInterface.h +++ b/CCastleInterface.h @@ -58,7 +58,7 @@ public: CStatusBar * statusbar; unsigned char animval, count; - CDefHandler *hall,*fort, *flag; + CDefHandler *hall,*fort; CDefEssential* bicons; //150x70 buildings imgs CTownList * townlist; diff --git a/CGameState.cpp b/CGameState.cpp index d9616bb86..ac2c2babe 100644 --- a/CGameState.cpp +++ b/CGameState.cpp @@ -21,6 +21,12 @@ boost::rand48 ran; +#ifdef min +#undef min +#endif +#ifdef max +#undef max +#endif CGObjectInstance * createObject(int id, int subid, int3 pos, int owner) { @@ -931,6 +937,7 @@ void CGameState::init(StartInfo * si, Mapa * map, int Seed) startres.push_back(k); } tis.close(); + tis.clear(); for (std::map::iterator i = players.begin(); i!=players.end(); i++) { (*i).second.resources.resize(RESOURCE_QUANTITY); @@ -938,6 +945,15 @@ void CGameState::init(StartInfo * si, Mapa * map, int Seed) (*i).second.resources[x] = startres[x]; } + tis.open("config/resources.txt"); + tis >> k; + int pom; + for(int i=0;i> pom; + resVals.push_back(pom); + } + /*************************HEROES************************************************/ for (int i=0; iheroes.size();i++) //heroes instances { @@ -1253,6 +1269,18 @@ UpgradeInfo CGameState::getUpgradeInfo(CArmedInstance *obj, int stackPos) return ret; } + +float CGameState::getMarketEfficiency( int player, int mode/*=0*/ ) +{ + boost::shared_lock lock(*mx); + if(mode) return -1; //todo - support other modes + int mcount = 0; + for(int i=0;ibuiltBuildings,14)) + mcount++; + float ret = std::min(((float)mcount+1.0f)/20.0f,0.5f); + return ret; +} int BattleInfo::calculateDmg(const CStack* attacker, const CStack* defender) { int attackDefenseBonus = attacker->creature->attack - defender->creature->defence; diff --git a/CGameState.h b/CGameState.h index 526cdca2d..030a45683 100644 --- a/CGameState.h +++ b/CGameState.h @@ -130,6 +130,7 @@ private: Mapa * map; std::map players; //ID <-> playerstate std::map villages, forts, capitols; //def-info for town graphics + std::vector resVals; boost::shared_mutex *mx; @@ -150,6 +151,7 @@ private: bool battleShootCreatureStack(int ID, int dest); int battleGetStack(int pos); //returns ID of stack at given tile UpgradeInfo getUpgradeInfo(CArmedInstance *obj, int stackPos); + float getMarketEfficiency(int player, int mode=0); public: int getDate(int mode=0) const; //mode=0 - total days in game, mode=1 - day of week, mode=2 - current week, mode=3 - current month diff --git a/CPlayerInterface.cpp b/CPlayerInterface.cpp index 10786b9ab..b13c6d4de 100644 --- a/CPlayerInterface.cpp +++ b/CPlayerInterface.cpp @@ -31,10 +31,12 @@ #include "timeHandler.h" #include #include +#include #include #include #include #include +using namespace boost::assign; using namespace CSDL_Ext; extern TTF_Font * GEOR16; @@ -52,7 +54,6 @@ public: return (*a.first)<(*b.first); } } ocmptwo_cgin ; - void CGarrisonSlot::hover (bool on) { Hoverable::hover(on); @@ -3420,4 +3421,266 @@ CCustomImgComponent::~CCustomImgComponent() { if(free) SDL_FreeSurface(bmp); +} + +CMarketplaceWindow::CTradeableItem::CTradeableItem( int Type, int ID, bool Left) +{ + left = Left; + type = Type; + id = ID; +} + +void CMarketplaceWindow::CTradeableItem::show( SDL_Surface * to/*=NULL*/ ) +{ + SDL_Surface *hlp = getSurface(); + blitAt(hlp,pos.x+19,pos.y+9,to); +} + +void CMarketplaceWindow::CTradeableItem::clickLeft( boost::logic::tribool down ) +{ + CMarketplaceWindow *mw = static_cast(LOCPLINT->curint->subInt); + if(down) + { + if(left) + { + if(mw->hLeft != this) + mw->hLeft = this; + else + return; + } + else + { + if(mw->hRight != this) + mw->hRight = this; + else + return; + } + mw->selectionChanged(left); + } +} + +void CMarketplaceWindow::CTradeableItem::activate() +{ + ClickableL::activate(); +} + +void CMarketplaceWindow::CTradeableItem::deactivate() +{ + ClickableL::deactivate(); +} + +SDL_Surface * CMarketplaceWindow::CTradeableItem::getSurface() +{ + switch(type) + { + case 0: + return graphics->resources32->ourImages[id].bitmap; + case 1: + return graphics->artDefs->ourImages[id].bitmap; + default: + return NULL; + } +} +void initItems( std::vector &i, std::vector &p, int type, int amount, bool left, std::vector *ids/*=NULL*/ ) +{ + i.resize(amount); + for(int j=0;jsize()>j) ? (*ids)[j] : j, left); + i[j]->pos = p[j]; + } +} + +void CMarketplaceWindow::setMode( int mode ) +{ + std::vector lpos, rpos; + clear(); + switch(mode) + { + case 0: + { + SDL_Surface *bg2 = BitmapHandler::loadBitmap("TPMRKRES.bmp"); + SDL_SetColorKey(bg2,SDL_SRCCOLORKEY,SDL_MapRGB(bg2->format,0,255,255)); + graphics->blueToPlayersAdv(bg2,LOCPLINT->playerID); + bg = SDL_ConvertSurface(bg2,screen->format,0); + SDL_FreeSurface(bg2); + lpos += genRect(66,69,39,180), genRect(66,69,122,180), genRect(66,69,204,180), + genRect(66,69,39,259), genRect(66,69,122,259), genRect(66,69,204,259), + genRect(66,69,122,338); + for(int i=0;igeneraltexth->allTexts[158],303,28,GEORXX,tytulowy,bg); //title + printAtMiddle(CGI->generaltexth->allTexts[270],158,148,GEOR13,zwykly,bg); //kingdom res. + printAtMiddle(CGI->generaltexth->allTexts[168],450,148,GEOR13,zwykly,bg); //available for trade + } + } +} + +void CMarketplaceWindow::clear() +{ + for(int i=0;iw/2 - 300; + pos.y = screen->h/2 - 296; + slider = new CSlider(pos.x+231,pos.y+490,137,boost::bind(&CMarketplaceWindow::sliderMoved,this,_1),0,0); + setMode(mode); + hLeft = hRight = NULL; + ok = new AdventureMapButton("","",boost::bind(&CMarketplaceWindow::deactivate,this),pos.x+516,pos.y+520,"IOK6432.DEF"); + ok->callback += boost::bind(&CMarketplaceWindow::clear,this); //clear + ok->callback += boost::bind(vstd::delObj,this); //will delete + ok->callback += boost::bind(&CMainInterface::activate,LOCPLINT->curint); + deal = new AdventureMapButton("","",boost::bind(&CMarketplaceWindow::makeDeal,this),pos.x+307,pos.y+520,"TPMRKB.DEF"); + max = new AdventureMapButton("","",boost::bind(&CMarketplaceWindow::setMax,this),pos.x+229,pos.y+520,"IRCBTNS.DEF"); + + max->block(true); + deal->block(true); +} + +CMarketplaceWindow::~CMarketplaceWindow() +{ + delete slider; +} + +void CMarketplaceWindow::show( SDL_Surface * to/*=NULL*/ ) +{ + blitAt(bg,pos); + if(hRight) + CSDL_Ext::drawBorder(screen,hRight->pos.x-1,hRight->pos.y-1,hRight->pos.w+2,hRight->pos.h+2,int3(255,231,148)); + if(hLeft) + CSDL_Ext::drawBorder(screen,hLeft->pos.x-1,hLeft->pos.y-1,hLeft->pos.w+2,hLeft->pos.h+2,int3(255,231,148)); + ok->show(); + deal->show(); + max->show(); + slider->show(); + for(int i=0;ishow(); + for(int i=0;ishow(); + if(mode==0) + { + char buf[15]; + for(int i=0;icb->getResourceAmount(i),buf,10); + printAtMiddle(buf,left[i]->pos.x+35,left[i]->pos.y+56,GEOR13,zwykly); + } + if(hLeft) //print prices + { + for(int i=0; iid != hLeft->id) + printAtMiddle(rSubs[i],right[i]->pos.x+35,right[i]->pos.y+56,GEOR13,zwykly); + else + printAtMiddle(CGI->generaltexth->allTexts[164],right[i]->pos.x+35,right[i]->pos.y+56,GEOR13,zwykly); + } + } + if(hLeft && hRight && hLeft->id!= hRight->id) + { + blitAt(hLeft->getSurface(),pos.x+142,pos.y+457,screen); + blitAt(hRight->getSurface(),pos.x+430,pos.y+457,screen); + SDL_itoa(slider->value * r1,buf,10); + printAtMiddle(buf,pos.x+158,pos.y+504,GEOR13,zwykly); + SDL_itoa(slider->value * r2,buf,10); + printAtMiddle(buf,pos.x+446,pos.y+504,GEOR13,zwykly); + } + } +} + +void CMarketplaceWindow::activate() +{ + LOCPLINT->objsToBlit += this; + LOCPLINT->curint->subInt = this; + for(int i=0;iactivate(); + for(int i=0;iactivate(); + ok->activate(); + max->activate(); + deal->activate(); + slider->activate(); +} + +void CMarketplaceWindow::deactivate() +{ + LOCPLINT->objsToBlit -= this; + LOCPLINT->curint->subInt = NULL; + for(int i=0;ideactivate(); + for(int i=0;ideactivate(); + ok->deactivate(); + max->deactivate(); + deal->deactivate(); + slider->deactivate(); +} + +void CMarketplaceWindow::setMax() +{ + slider->moveTo(slider->amount); +} + +void CMarketplaceWindow::makeDeal() +{ + LOCPLINT->cb->trade(mode,hLeft->id,hRight->id,slider->value*r1); + slider->moveTo(0); + hLeft = NULL; + selectionChanged(true); +} + +void CMarketplaceWindow::sliderMoved( int to ) +{ + +} + +void CMarketplaceWindow::selectionChanged(bool side) +{ + if(hLeft && hRight && hLeft->id!= hRight->id) + { + LOCPLINT->cb->getMarketOffer(hLeft->id,hRight->id,r1,r2,0); + slider->amount = LOCPLINT->cb->getResourceAmount(hLeft->id) / r1; + slider->moveTo(0); + max->block(false); + deal->block(false); + } + else + { + max->block(true); + deal->block(true); + slider->amount = 0; + slider->moveTo(0); + } + if(side && hLeft) //left selection changed, recalculate offers + { + rSubs.clear(); + rSubs.resize(right.size()); + int h1, h2; + for(int i=0;icb->getMarketOffer(hLeft->id,i,h1,h2,0); + oss << h2; + if(h1!=1) + oss << "/" << h1; + rSubs[i] = oss.str(); + } + } } \ No newline at end of file diff --git a/CPlayerInterface.h b/CPlayerInterface.h index c402a6c91..b164c56e2 100644 --- a/CPlayerInterface.h +++ b/CPlayerInterface.h @@ -592,6 +592,48 @@ public: ~CMinorResDataBar(); }; +class CMarketplaceWindow : public IShowActivable, public CIntObject +{ +public: + class CTradeableItem : public ClickableL + { + public: + int type; //0 - res, 1 - artif big, 2 - artif small, 3 - player flag + int id; + bool left; + CFunctionList callback; + + void activate(); + void deactivate(); + void show(SDL_Surface * to=NULL); + void clickLeft(boost::logic::tribool down); + SDL_Surface *getSurface(); + CTradeableItem(int Type, int ID, bool Left); + }; + + SDL_Surface *bg; + std::vector left, right; + std::vector rSubs; + CTradeableItem *hLeft, *hRight; //highlighted items (NULL if no highlight) + + int mode,//0 - res<->res; 1 - res<->plauer; 2 - buy artifact; 3 - sell artifact + r1, r2; + AdventureMapButton *ok, *max, *deal; + CSlider *slider; + + void activate(); + void deactivate(); + void show(SDL_Surface * to=NULL); + void setMax(); + void sliderMoved(int to); + void makeDeal(); + void selectionChanged(bool side); //true == left + CMarketplaceWindow(int Mode=0); + ~CMarketplaceWindow(); + void setMode(int mode); + void clear(); +}; + extern CPlayerInterface * LOCPLINT; #endif //CPLAYERINTERFACE_H diff --git a/client/Graphics.cpp b/client/Graphics.cpp index 3bbd93b03..6f10a0287 100644 --- a/client/Graphics.cpp +++ b/client/Graphics.cpp @@ -192,6 +192,7 @@ Graphics::Graphics() tasks += GET_DEF(resources32,"RESOURCE.DEF"); tasks += GET_DEF(smi,"CPRSMALL.DEF"); tasks += GET_DEF(smi2,"TWCRPORT.DEF"); + tasks += GET_DEF(flags,"CREST58.DEF"); std::ifstream ifs("config/cr_bgs.txt"); int id; diff --git a/client/Graphics.h b/client/Graphics.h index ce620c715..b584499ab 100644 --- a/client/Graphics.h +++ b/client/Graphics.h @@ -30,6 +30,7 @@ public: CDefHandler * pskillsm; //42x42 CDefHandler * un44; //many things CDefHandler * smallIcons, *resources32; //resources 32x32 + CDefHandler * flags; //creatures std::map smallImgs; //creature ID -> small 32x32 img of creature; //ID=-2 is for blank (black) img; -1 for the border std::map bigImgs; //creature ID -> big 58x64 img of creature; //ID=-2 is for blank (black) img; -1 for the border diff --git a/config/resources.txt b/config/resources.txt new file mode 100644 index 000000000..96803b09e --- /dev/null +++ b/config/resources.txt @@ -0,0 +1,2 @@ +8 +250 500 250 500 500 500 1 0 \ No newline at end of file diff --git a/global.h b/global.h index 7c21ef26e..621d9a749 100644 --- a/global.h +++ b/global.h @@ -16,7 +16,7 @@ typedef boost::int8_t si8; //signed int 8 bits (1 byte) #define THC #endif -#define NAME_VER ("VCMI 0.62") +#define NAME_VER ("VCMI 0.63") #ifdef _WIN32 @@ -141,7 +141,7 @@ namespace vstd return -1; } template - int findPos(const std::vector & c, const T2 &s, Func &f) //Func(T1,T2) must say if these elements matches + int findPos(const std::vector & c, const T2 &s, const Func &f) //Func(T1,T2) must say if these elements matches { for(int i=0;i + void delObj(t1 *a1) + { + delete a1; + } template void assign(t1 &a1, const t2 &a2) { diff --git a/lib/Connection.cpp b/lib/Connection.cpp index 33fc1a5f2..610f3de2e 100644 --- a/lib/Connection.cpp +++ b/lib/Connection.cpp @@ -42,10 +42,48 @@ CConnection::CConnection(std::string host, std::string port, std::string Name, s boost::system::error_code error = asio::error::host_not_found; socket = new tcp::socket(*io_service); tcp::resolver resolver(*io_service); - tcp::resolver::iterator endpoint_iterator = resolver.resolve(tcp::resolver::query(host,port)); - socket->connect(*endpoint_iterator, error); - if (error){ delete socket; throw "Can't establish connection :("; } - init(); + tcp::resolver::iterator end, pom, endpoint_iterator = resolver.resolve(tcp::resolver::query(host,port),error); + if(error) + { + std::cout << "Problem with resolving. " << std::endl << error <connect(*endpoint_iterator, error); + if(!error) + { + init(); + return; + } + else + { + std::cout << "Problem with connecting. " << std::endl; + } + } + + //we shouldn't be here - error handling +connerror1: + if(error) + std::cout << error < > * Socket, diff --git a/map.cpp b/map.cpp index 1133ef31d..fb752bf29 100644 --- a/map.cpp +++ b/map.cpp @@ -477,8 +477,8 @@ void Mapa::initFromBytes(unsigned char * bufor) if(!objects[f]->defInfo) continue; addBlockVisTiles(objects[f]); - } + std::cout<<"\tCalculating blocked/visitable tiles: "<> player >> mode >> id1 >> id2 >> val; + val = std::min(si32(val),gs->players[player].resources[id1]); + double uzysk = (double)gs->resVals[id1] * val * gs->getMarketEfficiency(player); + uzysk /= gs->resVals[id2]; + SetResource sr; + sr.player = player; + sr.resid = id1; + sr.val = gs->players[player].resources[id1] - val; + sendAndApply(&sr); + + sr.resid = id2; + sr.val = gs->players[player].resources[id2] + (int)uzysk; + sendAndApply(&sr); + break; } case 2001: @@ -954,9 +974,11 @@ CGameHandler::~CGameHandler(void) void CGameHandler::init(StartInfo *si, int Seed) { Mapa *map = new Mapa(si->mapname); + std::cout << "Map loaded!" << std::endl; gs = new CGameState(); + std::cout << "Gamestate created!" << std::endl; gs->init(si,map,Seed); - + std::cout << "Gamestate initialized!" << std::endl; /****************************LUA OBJECT SCRIPTS************************************************/ //std::vector * lf = CLuaHandler::searchForScripts("scripts/lua/objects"); //files //for (int i=0; isize(); i++) diff --git a/server/CVCMIServer.cpp b/server/CVCMIServer.cpp index 69ccca83e..25fa223fa 100644 --- a/server/CVCMIServer.cpp +++ b/server/CVCMIServer.cpp @@ -26,6 +26,7 @@ bool end2 = false; CVCMIServer::CVCMIServer() : io(new io_service()), acceptor(new tcp::acceptor(*io, tcp::endpoint(tcp::v4(), 3030))) { + std::cout << "CVCMIServer created!" <accept(*s,error); if (error) { - std::cout<<"Got connection but there is an error " << std::endl; + std::cout<<"Got connection but there is an error " << std::endl << error; return; } + std::cout<<"We've accepted someone... " << std::endl; CConnection *connection = new CConnection(s,NAME,std::cout); std::cout<<"Got connection!" << std::endl; while(!end2)