1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
* fixed invisible hero problem reported by Steven Aus
* version bumped to 0.69
This commit is contained in:
Michał W. Urbańczyk 2009-01-30 21:28:02 +00:00
parent 8523fcbb43
commit 8868105fac
7 changed files with 41 additions and 24 deletions

View File

@ -152,7 +152,7 @@ int main(int argc, char** argv)
CConnection *c=NULL;
//wait until server is ready
tlog0<<"Waiting for server... ";
CClient::waitForServer();
cl.waitForServer();
tlog0 << tmh.getDif()<<std::endl;
while(!c)
{

View File

@ -1658,16 +1658,19 @@ void CPreGame::initNewMenu()
ourNewMenu->lLoadGame.w=ourNewMenu->loadGame->ourImages[0].bitmap->w;
ourNewMenu->lLoadGame.x=568;
ourNewMenu->lLoadGame.y=120;
ourNewMenu->fLoadGame = NULL;
//campaign
ourNewMenu->lHighScores.h=ourNewMenu->highScores->ourImages[0].bitmap->h;
ourNewMenu->lHighScores.w=ourNewMenu->highScores->ourImages[0].bitmap->w;
ourNewMenu->lHighScores.x=541;
ourNewMenu->lHighScores.y=233;
ourNewMenu->fHighScores = NULL;
//tutorial
ourNewMenu->lCredits.h=ourNewMenu->credits->ourImages[0].bitmap->h;
ourNewMenu->lCredits.w=ourNewMenu->credits->ourImages[0].bitmap->w;
ourNewMenu->lCredits.x=545;
ourNewMenu->lCredits.y=358;
ourNewMenu->fCredits = NULL;
//back
ourNewMenu->lQuit.h=ourNewMenu->quit->ourImages[0].bitmap->h;
ourNewMenu->lQuit.w=ourNewMenu->quit->ourImages[0].bitmap->w;
@ -1730,11 +1733,13 @@ void CPreGame::initMainMenu()
ourMainMenu->lHighScores.w=ourMainMenu->highScores->ourImages[0].bitmap->w;
ourMainMenu->lHighScores.x=524;
ourMainMenu->lHighScores.y=251;
ourMainMenu->fHighScores = NULL;
//credits
ourMainMenu->lCredits.h=ourMainMenu->credits->ourImages[0].bitmap->h;
ourMainMenu->lCredits.w=ourMainMenu->credits->ourImages[0].bitmap->w;
ourMainMenu->lCredits.x=557;
ourMainMenu->lCredits.y=359;
ourMainMenu->fCredits = NULL;
//quit
ourMainMenu->lQuit.h=ourMainMenu->quit->ourImages[0].bitmap->h;
ourMainMenu->lQuit.w=ourMainMenu->quit->ourImages[0].bitmap->w;

View File

@ -28,22 +28,27 @@
CSharedCond<std::set<IPack*> > mess(new std::set<IPack*>);
extern std::string NAME;
namespace intpr = boost::interprocess;
SharedMem sm;
CClient::CClient(void)
void CClient::init()
{
IObjectInterface::cb = this;
serv = NULL;
gs = NULL;
cb = NULL;
shared = new SharedMem();
}
CClient::CClient(void)
{
init();
}
CClient::CClient(CConnection *con, StartInfo *si)
{
IObjectInterface::cb = this;
init();
newGame(con,si);
}
CClient::~CClient(void)
{
delete shared;
}
void CClient::process(int what)
{
@ -779,12 +784,9 @@ void CClient::runServer(const char * portc)
void CClient::waitForServer()
{
intpr::scoped_lock<intpr::interprocess_mutex> slock(shared->sr->mutex);
while(!shared->sr->ready)
{
intpr::scoped_lock<intpr::interprocess_mutex> slock(sm.sr->mutex);
while(!sm.sr->ready)
{
sm.sr->cond.wait(slock);
}
shared->sr->cond.wait(slock);
}
intpr::shared_memory_object::remove("vcmi_memory");
}
}

View File

@ -10,6 +10,7 @@ class CGameState;
class CGameInterface;
class CConnection;
class CCallback;
struct SharedMem;
class CClient;
void processCommand(const std::string &message, CClient *&client);
namespace boost
@ -43,6 +44,7 @@ class CClient : public IGameCallback
CCallback *cb;
std::map<ui8,CGameInterface *> playerint;
CConnection *serv;
SharedMem *shared;
void waitForMoveAndSend(int color);
public:
@ -50,6 +52,7 @@ public:
CClient(CConnection *con, StartInfo *si);
~CClient(void);
void init();
void close();
void newGame(CConnection *con, StartInfo *si); //con - connection to server
void save(const std::string & fname);
@ -88,7 +91,7 @@ public:
static void runServer(const char * portc);
static void waitForServer();
void waitForServer();
};
#endif // __CLIENT_H__

View File

@ -19,7 +19,7 @@ typedef boost::int8_t si8; //signed int 8 bits (1 byte)
#define THC
#endif
#define NAME_VER ("VCMI 0.68b")
#define NAME_VER ("VCMI 0.69")
#define CONSOLE_LOGGING_LEVEL 5
#define FILE_LOGGING_LEVEL 6

View File

@ -36,4 +36,8 @@ struct SharedMem
smo.truncate(sizeof(ServerReady));
sr = new(mr.get_address())ServerReady();
};
~SharedMem()
{
boost::interprocess::shared_memory_object::remove("vcmi_memory");
}
};

View File

@ -408,18 +408,21 @@ void processDef (CGDefInfo* def)
{
if(def->id == 26)
return;
if(def->name.size())
if(!def->handler) //if object has already set handler (eg. heroes) it should not be overwritten
{
def->handler = CDefHandler::giveDef(def->name);
if(def->name.size())
{
def->handler = CDefHandler::giveDef(def->name);
}
else
{
tlog2 << "No def name for " << def->id << " " << def->subid << std::endl;
def->handler = NULL;
return;
}
def->width = def->handler->ourImages[0].bitmap->w/32;
def->height = def->handler->ourImages[0].bitmap->h/32;
}
else
{
tlog2 << "No def name for " << def->id << " " << def->subid << std::endl;
def->handler = NULL;
return;
}
def->width = def->handler->ourImages[0].bitmap->w/32;
def->height = def->handler->ourImages[0].bitmap->h/32;
CGDefInfo* pom = CGI->dobjinfo->gobjs[def->id][def->subid];
if(pom && def->id!=98)
{