1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

- possibly fixed #966 and #958

- fixed crash on shutdown 
- fixed compile issue #973
This commit is contained in:
Ivan Savenko 2012-05-25 11:49:56 +00:00
parent 3c43e03d4e
commit 49495c9caf
8 changed files with 21 additions and 29 deletions

View File

@ -633,13 +633,13 @@ void CBattleInterface::show(SDL_Surface * to)
}
}
//patch by ench0
const CStack * const shere = curInt->cb->battleGetStackByPos(b, false);
// display the movement shadow of the stack at b (i.e. stack under mouse)
if(shere && shere->alive())
// activeStack == NULL means it is opponent's turn...
if(activeStack)
{
// activeStack == NULL means it is opponent's turn...
if (activeStack && shere != activeStack)
// display the movement shadow of the stack at b (i.e. stack under mouse)
const CStack * const shere = curInt->cb->battleGetStackByPos(b, false);
if (shere && shere != activeStack && shere->alive())
{
std::vector<BattleHex> v = curInt->cb->battleGetAvailableHexes(shere, true );
BOOST_FOREACH (BattleHex hex, v)
@ -892,12 +892,6 @@ void CBattleInterface::show(SDL_Surface * to)
bWait->showAll(to);
bDefence->showAll(to);
//showing window with result of battle
if(resWindow)
{
resWindow->show(to);
}
//showing in-game console
LOCPLINT->cingconsole->show(to);

View File

@ -65,7 +65,7 @@ CMinimap::CMinimap()
pos.h=ADVOPT.minimapW;
pos.w=ADVOPT.minimapH;
temps = CSDL_Ext::createSurfaceWithBpp<3>(pos.w,pos.h);
temps = CSDL_Ext::createSurfaceWithBpp<4>(pos.w,pos.h);
aiShield = new CPicture("AISHIELD.bmp");
const JsonNode config(GameConstants::DATA_DIR + "/config/minimap.json");
@ -228,7 +228,7 @@ void CMinimapSurfacesRef::initFoW(int level)
int3 pp( ((i*mapSizes.x)/mw), ((j*mapSizes.y)/mh), d );
if ( !LOCPLINT->cb->isVisible(pp) )
{
CSDL_Ext::SDL_PutPixelWithoutRefresh(pt,i,j,0,0,0,0);
CSDL_Ext::SDL_PutPixelWithoutRefresh(pt,i,j,0,0,0);
}
}
}
@ -457,7 +457,7 @@ void CMinimap::hideTile(const int3 &pos)
for (int jj=0; jj<ho; jj++)
{
if ((pos.x*wo+ii<this->pos.w) && (pos.y*ho+jj<this->pos.h))
CSDL_Ext::SDL_PutPixelWithoutRefresh(FoW[pos.z],pos.x*wo+ii,pos.y*ho+jj,0,0,0,255);
CSDL_Ext::SDL_PutPixelWithoutRefresh(FoW[pos.z],pos.x*wo+ii,pos.y*ho+jj,0,0,0);
}
}
}

View File

@ -70,7 +70,6 @@ SDL_Surface *screen = NULL, //main screen surface
*screenBuf = screen; //points to screen (if only advmapint is present) or screen2 (else) - should be used when updating controls which are not regularly redrawed
static boost::thread *mainGUIThread;
VCMIDirs GVCMIDirs;
std::queue<SDL_Event*> events;
boost::mutex eventsM;

View File

@ -697,7 +697,7 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay)
else
filePath = GameConstants::DATA_DIR + "/Data/video/" + fname;
#if LIBAVFORMAT_VERSION_MAJOR < 53
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 0, 0)
int avfopen = av_open_input_file(&format, filePath.c_str(), NULL, 0, NULL);
#else
int avfopen = avformat_open_input(&format, filePath.c_str(), NULL, NULL);
@ -708,7 +708,7 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay)
return false;
}
// Retrieve stream information
#if LIBAVCODEC_VERSION_MAJOR < 53
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 17, 0)
if (av_find_stream_info(format) < 0)
#else
if (avformat_find_stream_info(format, NULL) < 0)
@ -719,7 +719,7 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay)
stream = -1;
for(ui32 i=0; i<format->nb_streams; i++)
{
#if LIBAVCODEC_VERSION_MAJOR < 53
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 0, 0)
if (format->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO)
#else
if (format->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO)
@ -747,7 +747,7 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay)
}
// Open codec
#if LIBAVCODEC_VERSION_MAJOR < 53
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 17, 0)
if ( avcodec_open(codecContext, codec) < 0 )
#else
if ( avcodec_open2(codecContext, codec, NULL) < 0 )
@ -846,12 +846,7 @@ bool CVideoPlayer::nextFrame()
if (packet.stream_index == stream)
{
// Decode video frame
#ifdef WITH_AVCODEC_DECODE_VIDEO2
avcodec_decode_video2(codecContext, frame, &frameFinished, &packet);
#else
avcodec_decode_video(codecContext, frame, &frameFinished,
packet.data, packet.size);
#endif
// Did we get a video frame?
if (frameFinished)
@ -975,7 +970,7 @@ void CVideoPlayer::close()
if (format)
{
#if LIBAVCODEC_VERSION_MAJOR < 53
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 17, 0)
av_close_input_file(format);
format = NULL;
#else

View File

@ -786,9 +786,11 @@ std::set<CStack*> BattleInfo::getAttackedCreatures(const CSpell * s, int skillLe
BOOST_FOREACH (auto stack, stacks)
{
if (stack->isValidTarget())
BOOST_FOREACH (auto hex, stack->getHexes())
{
possibleHexes.insert (hex);
BOOST_FOREACH (auto hex, stack->getHexes())
{
possibleHexes.insert (hex);
}
}
}
BattleHex lightningHex = destinationTile;

View File

@ -8,7 +8,7 @@
#undef max
#endif
VCMIDirs GVCMIDirs;
extern VCMIDirs GVCMIDirs;
/*
* CLodHandler.cpp, part of VCMI engine

View File

@ -14,6 +14,7 @@
#include "CGeneralTextHandler.h"
#include "IGameEventsReceiver.h"
#include "CStopWatch.h"
#include "VCMIDirs.h"
/*
* VCMI_Lib.cpp, part of VCMI engine
@ -31,6 +32,8 @@ DLL_LINKAGE CLodHandler *bitmaph = NULL,
*spriteh = NULL,
*bitmaph_ab = NULL;
VCMIDirs GVCMIDirs;
DLL_LINKAGE void initDLL(CConsoleHandler *Console, std::ostream *Logfile)
{

View File

@ -33,7 +33,6 @@ using namespace boost::asio::ip;
namespace intpr = boost::interprocess;
bool end2 = false;
int port = 3030;
VCMIDirs GVCMIDirs;
/*
* CVCMIServer.cpp, part of VCMI engine