mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
A patch from Gesh fixing and #819 and removing reduntant #ifdefs (DLLHandler is win-only anyway).
This commit is contained in:
parent
6ef44bde5a
commit
750995f7f9
@ -111,6 +111,7 @@ CHeroWindow::CHeroWindow(const CGHeroInstance *hero)
|
||||
ourBar = new CGStatusBar(7, 559, "ADROLLVR.bmp", 660); // new CStatusBar(pos.x+72, pos.y+567, "ADROLLVR.bmp", 660);
|
||||
|
||||
quitButton = new AdventureMapButton(CGI->generaltexth->heroscrn[17], std::string(),boost::bind(&CHeroWindow::quit,this), 609, 516, "hsbtns.def", SDLK_RETURN);
|
||||
quitButton->assignedKeys.insert(SDLK_ESCAPE);
|
||||
dismissButton = new AdventureMapButton(std::string(), CGI->generaltexth->heroscrn[28], boost::bind(&CHeroWindow::dismissCurrent,this), 454, 429, "hsbtns2.def", SDLK_d);
|
||||
questlogButton = new AdventureMapButton(CGI->generaltexth->heroscrn[0], std::string(), boost::bind(&CHeroWindow::questlog,this), 314, 429, "hsbtns4.def", SDLK_q);
|
||||
|
||||
|
@ -27,12 +27,10 @@ static bool keyDown()
|
||||
|
||||
void checkForError(bool throwing = true)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
int error = GetLastError();
|
||||
if(!error)
|
||||
return;
|
||||
|
||||
|
||||
tlog1 << "Error " << error << " encountered!\n";
|
||||
std::string msg;
|
||||
char* pTemp = NULL;
|
||||
@ -44,7 +42,6 @@ void checkForError(bool throwing = true)
|
||||
pTemp = NULL;
|
||||
if(throwing)
|
||||
throw msg;
|
||||
#endif
|
||||
}
|
||||
|
||||
void blitBuffer(char *buffer, int x, int y, int w, int h, SDL_Surface *dst)
|
||||
@ -62,22 +59,18 @@ void blitBuffer(char *buffer, int x, int y, int w, int h, SDL_Surface *dst)
|
||||
void DLLHandler::Instantiate(const char *filename)
|
||||
{
|
||||
name = filename;
|
||||
#ifdef _WIN32
|
||||
dll = LoadLibraryA(filename);
|
||||
if(!dll)
|
||||
{
|
||||
tlog1 << "Failed loading " << filename << std::endl;
|
||||
checkForError(true);
|
||||
}
|
||||
#else
|
||||
dll = dlopen(filename,RTLD_LOCAL | RTLD_LAZY);
|
||||
#endif
|
||||
}
|
||||
|
||||
void *DLLHandler::FindAddress(const char *symbol)
|
||||
{
|
||||
void *ret;
|
||||
#ifdef _WIN32
|
||||
|
||||
if(!dll)
|
||||
{
|
||||
tlog1 << "Cannot look for " << symbol << " because DLL hasn't been appropriately loaded!\n";
|
||||
@ -89,9 +82,6 @@ void *DLLHandler::FindAddress(const char *symbol)
|
||||
tlog1 << "Failed to find " << symbol << " in " << name << std::endl;
|
||||
checkForError();
|
||||
}
|
||||
#else
|
||||
ret = (void *)dlsym(dll, symbol);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -99,15 +89,11 @@ DLLHandler::~DLLHandler()
|
||||
{
|
||||
if(dll)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if(!FreeLibrary(dll))
|
||||
{
|
||||
tlog1 << "Failed to free " << name << std::endl;
|
||||
checkForError();
|
||||
}
|
||||
#else
|
||||
dlclose(dll);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user