X11 build fixups

- fixed -Werror=misleading-indentation warning
- fixed -Werror=nonnull-compare warning on xll and QT builds
- PNG_LIBPNG_VER backward compatibily changes
- giflib backward compatibily changes
- resolved some undefs for X11 build
- silenced some small compile warnings in JGE Makefile
- added -DTIXML_USE_STL to remaining build types (PSP had it added)
- fixed x11 Boost incompatibility issue part of #548
- reworked PrecompiledHeader.h platforms used
This commit is contained in:
Rolzad73
2017-01-28 04:19:46 -05:00
parent e3dc78b28e
commit 85f66a8fec
19 changed files with 174 additions and 101 deletions

View File

@@ -32,6 +32,7 @@ HGE_OBJS = src/hge/hgecolor.o src/hge/hgeparticle.o \
CXXFLAGS = -W -Wall -Werror -Wno-unused CXXFLAGS = -W -Wall -Werror -Wno-unused
CXXFLAGS += -DTIXML_USE_STL CXXFLAGS += -DTIXML_USE_STL
CXXFLAGS += -Wno-deprecated-declarations -Wno-sign-compare
ifdef DEBUG ifdef DEBUG
CXXFLAGS += -ggdb3 CXXFLAGS += -ggdb3
@@ -82,7 +83,7 @@ ifeq ($(TARGET_ARCHITECTURE),linux)
OBJS = $(GENERIC_OBJS) $(LINUX_OBJS) OBJS = $(GENERIC_OBJS) $(LINUX_OBJS)
TARGET_LIB = libjge.a TARGET_LIB = libjge.a
TARGET_HGE = libhgetools.a TARGET_HGE = libhgetools.a
INCDIR = $(shell freetype-config --cflags 2> /dev/null) -I/usr/X11/include -I../Boost -Isrc/zipFS -Iinclude/ INCDIR = $(shell freetype-config --cflags 2> /dev/null) -I/usr/X11/include -I/usr/include/boost -Isrc/zipFS -Iinclude/
CXXFLAGS += -DLINUX $(FMOD) CXXFLAGS += -DLINUX $(FMOD)
CXXFLAGS += $(INCDIR) CXXFLAGS += $(INCDIR)
LIBDIR = lib/linux LIBDIR = lib/linux

BIN
JGE/lib/linux/libhgetools.a Normal file

Binary file not shown.

BIN
JGE/lib/linux/libjge.a Normal file

Binary file not shown.

View File

@@ -16,9 +16,14 @@ User folder is the only one that is really needed to guarantee both read and wri
The content that users should not be touching. The content that users should not be touching.
*/ */
#ifndef PSP #if defined (ANDROID)
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#endif //PSP #endif //ANDROID
#if defined (LINUX)
#include "../../projects/mtg/include/PrecompiledHeader.h"
#endif //LINUX
#ifdef WIN32 #ifdef WIN32
#pragma warning(disable : 4786) #pragma warning(disable : 4786)

View File

@@ -249,6 +249,7 @@ u32 JGE::BindKey(LocalKeySym sym, JButton button)
u32 JGE::UnbindKey(LocalKeySym sym, JButton button) u32 JGE::UnbindKey(LocalKeySym sym, JButton button)
{ {
for (keycodes_it it = keyBinds.begin(); it != keyBinds.end(); ) for (keycodes_it it = keyBinds.begin(); it != keyBinds.end(); )
{
if (sym == it->first && button == it->second) if (sym == it->first && button == it->second)
{ {
keycodes_it er = it; keycodes_it er = it;
@@ -256,7 +257,8 @@ u32 JGE::UnbindKey(LocalKeySym sym, JButton button)
keyBinds.erase(er); keyBinds.erase(er);
} }
else ++it; else ++it;
return keyBinds.size(); }
return keyBinds.size();
} }
u32 JGE::UnbindKey(LocalKeySym sym) u32 JGE::UnbindKey(LocalKeySym sym)

View File

@@ -185,9 +185,9 @@ static const int doubleBufferAttributes[] = {
GLX_RED_SIZE, 1, /* the maximum number of bits per component */ GLX_RED_SIZE, 1, /* the maximum number of bits per component */
GLX_GREEN_SIZE, 1, GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1, GLX_BLUE_SIZE, 1,
None 0L /* None */
}; };
static Bool WaitForNotify(Display *dpy, XEvent *event, XPointer arg) static int WaitForNotify(Display *dpy, XEvent *event, XPointer arg)
{ {
return (event->type == MapNotify) && (event->xmap.window == (Window) arg); return (event->type == MapNotify) && (event->xmap.window == (Window) arg);
} }
@@ -387,13 +387,13 @@ int main(int argc, char* argv[])
if (XCheckWindowEvent(gXDisplay, gXWindow, KeyPressMask | KeyReleaseMask | StructureNotifyMask, &event)) if (XCheckWindowEvent(gXDisplay, gXWindow, KeyPressMask | KeyReleaseMask | StructureNotifyMask, &event))
switch (event.type) switch (event.type)
{ {
case KeyPress: case 2: /* KeyPress */
{ {
const KeySym sym = XKeycodeToKeysym(gXDisplay, event.xkey.keycode, 1); const KeySym sym = XKeycodeToKeysym(gXDisplay, event.xkey.keycode, 1);
g_engine->HoldKey_NoRepeat(sym); g_engine->HoldKey_NoRepeat(sym);
} }
break; break;
case KeyRelease: case 3: /* KeyRelease */
g_engine->ReleaseKey(XKeycodeToKeysym(gXDisplay, event.xkey.keycode, 1)); g_engine->ReleaseKey(XKeycodeToKeysym(gXDisplay, event.xkey.keycode, 1));
break; break;
case ConfigureNotify: case ConfigureNotify:

View File

@@ -1804,7 +1804,7 @@ static void PNGCustomReadDataFn(png_structp png_ptr, png_bytep data, png_size_t
{ {
png_size_t check; png_size_t check;
JFileSystem *fileSystem = (JFileSystem*)png_ptr->io_ptr; JFileSystem *fileSystem = (JFileSystem*)png_get_io_ptr(png_ptr);
check = fileSystem->ReadFile(data, length); check = fileSystem->ReadFile(data, length);
@@ -1887,7 +1887,7 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char *filename, int mode
//fclose(fp); //fclose(fp);
fileSystem->CloseFile(); fileSystem->CloseFile();
png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL); png_destroy_read_struct(&png_ptr, NULL, NULL);
return JGE_ERR_PNG; return JGE_ERR_PNG;
} }
@@ -1896,11 +1896,15 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char *filename, int mode
png_set_sig_bytes(png_ptr, sig_read); png_set_sig_bytes(png_ptr, sig_read);
png_read_info(png_ptr, info_ptr); png_read_info(png_ptr, info_ptr);
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, int_p_NULL, int_p_NULL); png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL);
png_set_strip_16(png_ptr); png_set_strip_16(png_ptr);
png_set_packing(png_ptr); png_set_packing(png_ptr);
if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png_ptr); if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png_ptr);
#if PNG_LIBPNG_VER >= 10400
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr);
#else
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr); if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr);
#endif
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr); if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER); png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
@@ -1910,7 +1914,7 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char *filename, int mode
//fclose(fp); //fclose(fp);
fileSystem->CloseFile(); fileSystem->CloseFile();
png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL); png_destroy_read_struct(&png_ptr, NULL, NULL);
return JGE_ERR_MALLOC_FAILED; return JGE_ERR_MALLOC_FAILED;
} }
@@ -1932,7 +1936,7 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char *filename, int mode
for (y = 0; y < (int)height; y++) for (y = 0; y < (int)height; y++)
{ {
png_read_row(png_ptr, (BYTE*) line, png_bytep_NULL); png_read_row(png_ptr, (BYTE*) line, NULL);
for (x = 0; x < (int)width; x++) for (x = 0; x < (int)width; x++)
{ {
DWORD color32 = line[x]; DWORD color32 = line[x];
@@ -1955,7 +1959,7 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char *filename, int mode
free (line); free (line);
png_read_end(png_ptr, info_ptr); png_read_end(png_ptr, info_ptr);
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL); png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
fileSystem->CloseFile(); fileSystem->CloseFile();
@@ -1998,8 +2002,15 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
GifFileType *GifFileIn = NULL; GifFileType *GifFileIn = NULL;
ColorMapObject *palette; ColorMapObject *palette;
int ExtCode; int ExtCode;
#if GIFLIB_MAJOR >= 5
if ((GifFileIn = DGifOpen(handle, readFunc, NULL)) == NULL)
return 1;
#else
if ((GifFileIn = DGifOpen(handle, readFunc)) == NULL) if ((GifFileIn = DGifOpen(handle, readFunc)) == NULL)
return 1; return 1;
#endif
*bgcolor = 0; *bgcolor = 0;
textureInfo.mWidth = 0; textureInfo.mWidth = 0;
textureInfo.mHeight = 0; textureInfo.mHeight = 0;
@@ -2008,7 +2019,11 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
do { do {
if (DGifGetRecordType(GifFileIn, &RecordType) == GIF_ERROR) if (DGifGetRecordType(GifFileIn, &RecordType) == GIF_ERROR)
{ {
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn); DGifCloseFile(GifFileIn);
#endif
return 1; return 1;
} }
@@ -2017,12 +2032,20 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
{ {
if (DGifGetImageDesc(GifFileIn) == GIF_ERROR) if (DGifGetImageDesc(GifFileIn) == GIF_ERROR)
{ {
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn); DGifCloseFile(GifFileIn);
#endif
return 1; return 1;
} }
if((palette = (GifFileIn->SColorMap != NULL) ? GifFileIn->SColorMap : GifFileIn->Image.ColorMap) == NULL) if((palette = (GifFileIn->SColorMap != NULL) ? GifFileIn->SColorMap : GifFileIn->Image.ColorMap) == NULL)
{ {
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn); DGifCloseFile(GifFileIn);
#endif
return 1; return 1;
} }
textureInfo.mWidth = GifFileIn->Image.Width; textureInfo.mWidth = GifFileIn->Image.Width;
@@ -2030,7 +2053,11 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
*bgcolor = gif_color32(GifFileIn->SBackGroundColor); *bgcolor = gif_color32(GifFileIn->SBackGroundColor);
if((LineIn = (GifRowType) malloc(GifFileIn->Image.Width * sizeof(GifPixelType))) == NULL) if((LineIn = (GifRowType) malloc(GifFileIn->Image.Width * sizeof(GifPixelType))) == NULL)
{ {
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn); DGifCloseFile(GifFileIn);
#endif
return 1; return 1;
} }
textureInfo.mTexWidth = getNextPower2(GifFileIn->Image.Width); textureInfo.mTexWidth = getNextPower2(GifFileIn->Image.Width);
@@ -2040,7 +2067,11 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
if((p32 = (DWORD *)malloc(sizeof(PIXEL_TYPE) * textureInfo.mTexWidth * textureInfo.mTexHeight)) == NULL) if((p32 = (DWORD *)malloc(sizeof(PIXEL_TYPE) * textureInfo.mTexWidth * textureInfo.mTexHeight)) == NULL)
{ {
free((void *)LineIn); free((void *)LineIn);
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn); DGifCloseFile(GifFileIn);
#endif
return 1; return 1;
} }
DWORD * curr = p32; DWORD * curr = p32;
@@ -2052,7 +2083,11 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
{ {
free((void *)p32); free((void *)p32);
free((void *)LineIn); free((void *)LineIn);
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn); DGifCloseFile(GifFileIn);
#endif
return 1; return 1;
} }
for (GifWord j = 0; j < GifFileIn->Image.Width; j ++) for (GifWord j = 0; j < GifFileIn->Image.Width; j ++)
@@ -2081,7 +2116,11 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
} }
if(LineIn != NULL) if(LineIn != NULL)
free((void *)LineIn); free((void *)LineIn);
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn); DGifCloseFile(GifFileIn);
#endif
return 1; return 1;
} }
while (Extension != NULL) { while (Extension != NULL) {
@@ -2094,7 +2133,11 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
} }
if(LineIn != NULL) if(LineIn != NULL)
free((void *)LineIn); free((void *)LineIn);
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn); DGifCloseFile(GifFileIn);
#endif
return 1; return 1;
} }
} }
@@ -2109,7 +2152,11 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
if(LineIn != NULL) if(LineIn != NULL)
free((void *)LineIn); free((void *)LineIn);
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn); DGifCloseFile(GifFileIn);
#endif
return 0; return 0;
} }

View File

@@ -631,8 +631,8 @@ streamoff filesystem::CentralDirZipped(std::istream & File, std::streamoff begin
std::streamoff eof = begin + size; std::streamoff eof = begin + size;
// Look for the "end of central dir" header. Start minimum 22 bytes before end. // Look for the "end of central dir" header. Start minimum 22 bytes before end.
if (! File.seekg(eof - 22, ios::beg)) if (! File.seekg(eof - 22, ios::beg))
return -1; return -1;
streamoff EndPos; streamoff EndPos;
streamoff StartPos = File.tellg(); streamoff StartPos = File.tellg();

View File

@@ -258,8 +258,8 @@ inline void izfstream::open(const char * FilePath, filesystem * pFS) {
if (pFS) if (pFS)
m_pFS = pFS; m_pFS = pFS;
if (m_pFS != NULL) if (m_pFS != NULL)
m_pFS->Open(* this, FilePath); m_pFS->Open(* this, FilePath);
} }
inline void izfstream::close() { inline void izfstream::close() {

View File

@@ -76,8 +76,8 @@ bool zbuffer::use(std::streamoff Offset, std::streamoff Size)
return false; return false;
//Don't use a buffer already used; //Don't use a buffer already used;
if (m_Used) if (m_Used)
return false; return false;
// adjust file position // adjust file position
if (! m_ZipFile.seekg(Offset, ios::beg)) if (! m_ZipFile.seekg(Offset, ios::beg))

View File

@@ -59,7 +59,6 @@ endif
ifeq ($(TARGET_ARCHITECTURE),psp) ifeq ($(TARGET_ARCHITECTURE),psp)
DEFAULT_RULE = 3xx DEFAULT_RULE = 3xx
TARGET_ARCHITECTURE = psp
PSP_FW_VERSION=371 PSP_FW_VERSION=371
BUILD_PRX = 1 BUILD_PRX = 1
SIGN_PRX = 1 SIGN_PRX = 1
@@ -74,19 +73,33 @@ PSP_EBOOT_PIC1 = pic1.png
INCDIR = ../../JGE/include ../../JGE/src/zipFS ../../JGE/include/psp ../../JGE/include/psp/freetype2 ../../JGE/src ../../projects/mtg/include ../../Boost INCDIR = ../../JGE/include ../../JGE/src/zipFS ../../JGE/include/psp ../../JGE/include/psp/freetype2 ../../JGE/src ../../projects/mtg/include ../../Boost
LIBDIR = ../../JGE/lib/psp LIBDIR = ../../JGE/lib/psp
CFLAGS = -O2 -G0 -DPSPFW3XX -DDEVHOOK -DUSE_PRECOMPILED_HEADERS=1 -DPSP -DTIXML_USE_STL CFLAGS = -O2 -G0 -DPSPFW3XX -DDEVHOOK -DUSE_PRECOMPILED_HEADERS=1 -DPSP -DTIXML_USE_STL
endif
ifeq ($(MAKECMDGOALS),x11)
OBJS += objs/TestSuiteAI.o
INCDIR = -I../../JGE/include -I../../JGE/src -I/usr/X11/include -I../../projects/mtg/include -I/usr/include/boost -I../../JGE/src/zipFS
LIBDIR = -L../../JGE/lib/linux -L../../JGE -L/usr/X11/lib
LIBS = -ljge -lfreetype -ljpeg -lgif -lpng -lz -lm -lstdc++ -lhgetools -lGL -lGLU -lX11 -lpthread $(FMOD)
CFLAGS = $(INCDIR) -DLINUX -DUSE_PRECOMPILED_HEADERS=1 -DTIXML_USE_STL
ASFLAGS = $(CXXFLAGS)
all: $(DEFAULT_RULE)
else else
OBJS += objs/TestSuiteAI.o OBJS += objs/TestSuiteAI.o
INCDIR = -I../../JGE/include -I../../JGE/src -I/usr/X11/include -I../../projects/mtg/include -I../../Boost -I../../JGE/src/zipFS INCDIR = -I../../JGE/include -I../../JGE/src -I/usr/X11/include -I../../projects/mtg/include -I../../Boost -I../../JGE/src/zipFS
LIBDIR = -L../../JGE/lib/linux -L../../JGE -L/usr/X11/lib -L../../Boost/lib LIBDIR = -L../../JGE/lib/linux -L../../JGE -L/usr/X11/lib -L../../Boost/lib
LIBS = -ljge -lfreetype -ljpeg -lgif -lpng -lz -lm -lstdc++ -lhgetools -lGL -lGLU -lX11 -lboost_thread $(FMOD) LIBS = -ljge -lfreetype -ljpeg -lgif -lpng -lz -lm -lstdc++ -lhgetools -lGL -lGLU -lX11 -lboost_thread $(FMOD)
CFLAGS = $(INCDIR) -DLINUX -DUSE_PRECOMPILED_HEADERS=1 CFLAGS = $(INCDIR) -DLINUX -DUSE_PRECOMPILED_HEADERS=1
ASFLAGS = $(CXXFLAGS) ASFLAGS = $(CXXFLAGS)
all: $(DEFAULT_RULE) all: $(DEFAULT_RULE)
endif endif
CFLAGS := -Wall -W -Werror -Wno-unused $(CFLAGS) CFLAGS := -Wall -W -Werror -Wno-unused -Wno-deprecated-declarations -Wno-nonnull-compare $(CFLAGS)
CXXFLAGS += $(CFLAGS) CXXFLAGS += $(CFLAGS)
# -fno-exceptions # -fno-exceptions
@@ -110,8 +123,6 @@ debug: all
else else
$(TARGET): Makefile.$(TARGET_ARCHITECTURE) $(OBJS) ../../JGE/lib/linux/libjge.a $(TARGET): Makefile.$(TARGET_ARCHITECTURE) $(OBJS) ../../JGE/lib/linux/libjge.a
$(CXX) -o $(TARGET) $(OBJS) $(LIBS) $(LIBDIR) $(CXX) -o $(TARGET) $(OBJS) $(LIBS) $(LIBDIR)

View File

@@ -6636,7 +6636,7 @@ public:
else else
source->removeptbonus(PowerModifier * (nbOpponents - MaxOpponent),ToughnessModifier * (nbOpponents - MaxOpponent)); source->removeptbonus(PowerModifier * (nbOpponents - MaxOpponent),ToughnessModifier * (nbOpponents - MaxOpponent));
nbOpponents = 0; nbOpponents = 0;
} }
} }
return 1; return 1;
@@ -6659,8 +6659,8 @@ public:
int receiveEvent(WEvent * event) int receiveEvent(WEvent * event)
{ {
WEventZoneChange * enters = dynamic_cast<WEventZoneChange *> (event); WEventZoneChange * enters = dynamic_cast<WEventZoneChange *> (event);
if (enters && enters->to == enters->card->controller()->game->inPlay) if (enters && enters->to == enters->card->controller()->game->inPlay) {
if(enters->from != enters->card->controller()->game->inPlay && enters->from != enters->card->controller()->opponent()->game->inPlay) //cards changing from inplay to inplay don't re-enter battlefield if(enters->from != enters->card->controller()->game->inPlay && enters->from != enters->card->controller()->opponent()->game->inPlay) { //cards changing from inplay to inplay don't re-enter battlefield
if(enters->card->controller() == source->controller() && enters->card->isCreature()) if(enters->card->controller() == source->controller() && enters->card->isCreature())
{ {
if(enters->card != source && (enters->card->power > source->power || enters->card->toughness > source->toughness)) if(enters->card != source && (enters->card->power > source->power || enters->card->toughness > source->toughness))
@@ -6668,7 +6668,9 @@ public:
source->counters->addCounter(1,1); source->counters->addCounter(1,1);
} }
} }
return 1; }
}
return 1;
} }
AEvolveAbility * clone() const AEvolveAbility * clone() const

View File

@@ -7974,78 +7974,78 @@ int AACastCard::resolveSpell()
if (_target->isLand()) if (_target->isLand())
putinplay = true; putinplay = true;
Spell * spell = NULL; Spell * spell = NULL;
MTGCardInstance * copy = NULL; MTGCardInstance * copy = NULL;
if ((normal || asNormalMadness)||(!_target->hasType(Subtypes::TYPE_INSTANT) && !_target->hasType(Subtypes::TYPE_SORCERY))) if ((normal || asNormalMadness)||(!_target->hasType(Subtypes::TYPE_INSTANT) && !_target->hasType(Subtypes::TYPE_SORCERY)))
{
if (putinplay && (_target->hasType(Subtypes::TYPE_ARTIFACT)||_target->hasType(Subtypes::TYPE_CREATURE)||_target->hasType(Subtypes::TYPE_ENCHANTMENT)||_target->hasType(Subtypes::TYPE_PLANESWALKER)))
copy =_target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->battlefield,noEvent);
else
copy =_target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->stack,noEvent);
copy->changeController(source->controller(),true);
if(asNormalMadness)
copy->MadnessPlay = true;
}
else
{
if (putinplay && (_target->hasType(Subtypes::TYPE_ARTIFACT)||_target->hasType(Subtypes::TYPE_CREATURE)||_target->hasType(Subtypes::TYPE_ENCHANTMENT)||_target->hasType(Subtypes::TYPE_PLANESWALKER)))
copy =_target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->battlefield,noEvent);
else
copy =_target->controller()->game->putInZone(_target, _target->currentZone, _target->controller()->game->stack,noEvent);
copy->changeController(source->controller(),true);
}
if (game->targetChooser)
{
game->targetChooser->Owner = source->controller();
if(putinplay)
{ {
if (putinplay && (_target->hasType(Subtypes::TYPE_ARTIFACT)||_target->hasType(Subtypes::TYPE_CREATURE)||_target->hasType(Subtypes::TYPE_ENCHANTMENT)||_target->hasType(Subtypes::TYPE_PLANESWALKER))) spell = NEW Spell(game, 0,copy,game->targetChooser,NULL, 1);
copy =_target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->battlefield,noEvent); spell->resolve();
else }
copy =_target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->stack,noEvent); else
copy->changeController(source->controller(),true); spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, NULL, 1, 0);
if(asNormalMadness) game->targetChooser = NULL;
copy->MadnessPlay = true; }
else
{
if(putinplay)
{
spell = NEW Spell(game, 0,copy,NULL,NULL, 1);
spell->resolve();
}
else
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, NULL, 1, 0);
}
if (copy->has(Constants::STORM))
{
int storm = _target->controller()->game->stack->seenThisTurn("*", Constants::CAST_ALL) + source->controller()->opponent()->game->stack->seenThisTurn("*", Constants::CAST_ALL);
for (int i = storm; i > 1; i--)
{
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, 0, 1, 1);
}
}
if (!copy->has(Constants::STORM))
{
copy->X = _target->X;
copy->castX = copy->X;
}
if(andAbility)
{
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = copy;
if(andAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
} }
else else
{ {
if (putinplay && (_target->hasType(Subtypes::TYPE_ARTIFACT)||_target->hasType(Subtypes::TYPE_CREATURE)||_target->hasType(Subtypes::TYPE_ENCHANTMENT)||_target->hasType(Subtypes::TYPE_PLANESWALKER))) andAbilityClone->addToGame();
copy =_target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->battlefield,noEvent);
else
copy =_target->controller()->game->putInZone(_target, _target->currentZone, _target->controller()->game->stack,noEvent);
copy->changeController(source->controller(),true);
}
if (game->targetChooser)
{
game->targetChooser->Owner = source->controller();
if(putinplay)
{
spell = NEW Spell(game, 0,copy,game->targetChooser,NULL, 1);
spell->resolve();
}
else
spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, NULL, 1, 0);
game->targetChooser = NULL;
}
else
{
if(putinplay)
{
spell = NEW Spell(game, 0,copy,NULL,NULL, 1);
spell->resolve();
}
else
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, NULL, 1, 0);
}
if (copy->has(Constants::STORM))
{
int storm = _target->controller()->game->stack->seenThisTurn("*", Constants::CAST_ALL) + source->controller()->opponent()->game->stack->seenThisTurn("*", Constants::CAST_ALL);
for (int i = storm; i > 1; i--)
{
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, 0, 1, 1);
}
}
if (!copy->has(Constants::STORM))
{
copy->X = _target->X;
copy->castX = copy->X;
}
if(andAbility)
{
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = copy;
if(andAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
} }
}
this->forceDestroy = true; this->forceDestroy = true;
processed = true; processed = true;

View File

@@ -45,7 +45,7 @@ CardPrimitive::CardPrimitive(CardPrimitive * source)
for (size_t i = 0; i < source->types.size(); ++i) for (size_t i = 0; i < source->types.size(); ++i)
types.push_back(source->types[i]); types.push_back(source->types[i]);
colors = source->colors; colors = source->colors;
manaCost.copy(source->getManaCost()); manaCost.copy(source->getManaCost());
//reducedCost.copy(source->getReducedManaCost()); //reducedCost.copy(source->getReducedManaCost());
//increasedCost.copy(source->getIncreasedManaCost()); //increasedCost.copy(source->getIncreasedManaCost());

View File

@@ -305,8 +305,8 @@ void GuiMana::Render()
for (vector<ManaIcon*>::iterator it = manas.begin(); it != manas.end(); ++it) for (vector<ManaIcon*>::iterator it = manas.begin(); it != manas.end(); ++it)
(*it)->Render(); (*it)->Render();
if (OptionManaDisplay::DYNAMIC != options[Options::MANADISPLAY].number && OptionManaDisplay::NOSTARSDYNAMIC != options[Options::MANADISPLAY].number ) if (OptionManaDisplay::DYNAMIC != options[Options::MANADISPLAY].number && OptionManaDisplay::NOSTARSDYNAMIC != options[Options::MANADISPLAY].number )
RenderStatic(); RenderStatic();
} }
bool remove_dead(ManaIcon* m) bool remove_dead(ManaIcon* m)

View File

@@ -5371,7 +5371,7 @@ int ActivatedAbility::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
case OPPONENT_TURN_ONLY: case OPPONENT_TURN_ONLY:
if (player == game->currentPlayer) if (player == game->currentPlayer)
return 0; return 0;
break; break;
case AS_SORCERY: case AS_SORCERY:
if (player != game->currentPlayer) if (player != game->currentPlayer)
return 0; return 0;
@@ -5543,7 +5543,7 @@ int ActivatedAbility::activateAbility()
ExtraCost * tapper = dynamic_cast<TapCost*>(cost->extraCosts->costs[i]); ExtraCost * tapper = dynamic_cast<TapCost*>(cost->extraCosts->costs[i]);
if(tapper) if(tapper)
needsTapping = 1; needsTapping = 1;
wasTappedForMana = true; wasTappedForMana = true;
} }
} }
else if(amp||femp) else if(amp||femp)

View File

@@ -2316,7 +2316,7 @@ int MTGBlockRule::reactToClick(MTGCardInstance * card)
if(lured && currentOpponent && !currentOpponent->has(Constants::LURE)) if(lured && currentOpponent && !currentOpponent->has(Constants::LURE))
currentOpponent = game->currentPlayer->game->inPlay->getNextLurer(currentOpponent); currentOpponent = game->currentPlayer->game->inPlay->getNextLurer(currentOpponent);
canDefend = card->toggleDefenser(currentOpponent); canDefend = card->toggleDefenser(currentOpponent);
DebugTrace("Defenser Toggle: " << card->getName() << endl DebugTrace("Defenser Toggle: " << card->getName() << endl
<< "- canDefend: " << (canDefend == 0) << endl << "- canDefend: " << (canDefend == 0) << endl

View File

@@ -43,6 +43,10 @@ public:
mCurrentCard(0) mCurrentCard(0)
{ {
} }
virtual ~CardZone()
{
}
/* /*
** **

View File

@@ -9,6 +9,7 @@ unix:!*macx*:QMAKE_CXXFLAGS += -Wno-unused-but-set-variable
unix|*macx*:QMAKE_CXXFLAGS += -Wno-unused-value unix|*macx*:QMAKE_CXXFLAGS += -Wno-unused-value
unix:!*macx*:QMAKE_CXXFLAGS += -Wno-unused-local-typedefs unix:!*macx*:QMAKE_CXXFLAGS += -Wno-unused-local-typedefs
unix:!*macx*:!maemo5:!symbian:QMAKE_CXXFLAGS += -Werror unix:!*macx*:!maemo5:!symbian:QMAKE_CXXFLAGS += -Werror
unix|macx:QMAKE_CXXFLAGS += -Wno-nonnull-compare
windows:DEFINES += _CRT_SECURE_NO_WARNINGS windows:DEFINES += _CRT_SECURE_NO_WARNINGS
windows|winrt:DEFINES += NOMINMAX windows|winrt:DEFINES += NOMINMAX