1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Improved threa-safety, almost finished building structures in towns.

This commit is contained in:
Michał W. Urbańczyk
2008-08-01 11:21:15 +00:00
parent 5c5c80933b
commit e5a064f36b
20 changed files with 202 additions and 52 deletions

View File

@@ -11,6 +11,7 @@
#include "../lib/NetPacks.h"
#include <boost/bind.hpp>
#include <boost/thread.hpp>
#include <boost/foreach.hpp>
#include "../hch/CObjectHandler.h"
#include "../hch/CGeneralTextHandler.h"
#include "../hch/CArtHandler.h"
@@ -190,6 +191,15 @@ void CClient::process(int what)
playerint[iw.player]->showInfoDialog(toString(iw.text),comps);
break;
}
case 104:
{
SetResources sr;
*serv >> sr;
std::cout << "Set amount of resources of player "<<(unsigned)sr.player<<std::endl;
gs->apply(&sr);
playerint[sr.player]->receivedResource(-1,-1);
break;
}
case 501: //hero movement response - we have to notify interfaces and callback
{
TryMoveHero *th = new TryMoveHero; //will be deleted by callback after processing
@@ -235,6 +245,23 @@ void CClient::process(int what)
playerint[gs->map->objects[i->first]->tempOwner]->garrisonChanged(gs->map->objects[i->first]);
break;
}
case 503:
{
SetStrInfo ssi;
*serv >> ssi;
gs->apply(&ssi);
//TODO: notify interfaces
break;
}
case 504:
{
NewStructures ns;
*serv >> ns;
gs->apply(&ns);
BOOST_FOREACH(si32 bid, ns.bid)
playerint[gs->map->objects[ns.tid]->tempOwner]->buildChanged(static_cast<CGTownInstance*>(gs->map->objects[ns.tid]),bid,1);
break;
}
case 1001:
{
SetObjectProperty sop;