Merge remote-tracking branch 'refs/remotes/WagicProject/master'

This commit is contained in:
Anthony Calosa
2017-01-29 10:29:10 +08:00
22 changed files with 183 additions and 104 deletions
+1 -1
View File
@@ -64,4 +64,4 @@ after_success:
- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l core.zip -r Wagic-core.zip -b $TRAVIS_BRANCH - python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l core.zip -r Wagic-core.zip -b $TRAVIS_BRANCH
- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/Android/bin/Wagic-debug.apk -r Wagic-android.apk -b $TRAVIS_BRANCH - python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/Android/bin/Wagic-debug.apk -r Wagic-android.apk -b $TRAVIS_BRANCH
- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/psprelease.zip -r Wagic-psp.zip -b $TRAVIS_BRANCH - python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/psprelease.zip -r Wagic-psp.zip -b $TRAVIS_BRANCH
- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l qt-gui-build/wagic -r Wagic-linux-QT -b $TRAVIS_BRANCH - python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l qt-gui-build/linuxqtrelease.zip -r Wagic-linux-QT.zip -b $TRAVIS_BRANCH
+2 -1
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
Binary file not shown.
Binary file not shown.
+7 -2
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)
+3 -1
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)
+4 -4
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:
+53 -6
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;
} }
+2 -2
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();
+2 -2
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() {
+2 -2
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))
@@ -1232,7 +1232,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
return true; return true;
} else if (event.getAction() == KeyEvent.ACTION_UP) } else if (event.getAction() == KeyEvent.ACTION_UP)
{ {
// Log.d(TAG, "key up: " + keyCode); // Log.d(TAG, "key up: " + keyCode);
SDLActivity.onNativeKeyUp(keyCode); SDLActivity.onNativeKeyUp(keyCode);
return true; return true;
} }
@@ -1309,3 +1309,4 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
} }
} }
} }
+19 -5
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,36 @@ 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
else else
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 -Wno-nonnull-compare
ASFLAGS = $(CXXFLAGS)
all: $(DEFAULT_RULE)
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 -Wno-nonnull-compare
ASFLAGS = $(CXXFLAGS) ASFLAGS = $(CXXFLAGS)
all: $(DEFAULT_RULE) all: $(DEFAULT_RULE)
endif
endif endif
CFLAGS := -Wall -W -Werror -Wno-unused $(CFLAGS) CFLAGS := -Wall -W -Werror -Wno-unused -Wno-deprecated-declarations $(CFLAGS)
CXXFLAGS += $(CFLAGS) CXXFLAGS += $(CFLAGS)
# -fno-exceptions # -fno-exceptions
@@ -110,8 +126,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)
+6 -4
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
+67 -67
View File
@@ -7962,78 +7962,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;
+1 -1
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());
+2 -2
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)
+2 -2
View File
@@ -5383,7 +5383,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;
@@ -5555,7 +5555,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)
+1 -1
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
+4
View File
@@ -43,6 +43,10 @@ public:
mCurrentCard(0) mCurrentCard(0)
{ {
} }
virtual ~CardZone()
{
}
/* /*
** **
+1
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
+2
View File
@@ -71,6 +71,8 @@ if [ "$BUILD_Qt" = "YES" ]; then
cd qt-gui-build cd qt-gui-build
$QMAKE ../projects/mtg/wagic-qt.pro CONFIG+=release CONFIG+=graphics $QMAKE ../projects/mtg/wagic-qt.pro CONFIG+=release CONFIG+=graphics
make -j 4 make -j 4
chmod -R 775 wagic
zip linuxqtrelease.zip ./wagic
cd .. cd ..
# let's try an Intel linux binary in debug text-mode-only # let's try an Intel linux binary in debug text-mode-only
$QMAKE projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug DEFINES+=CAPTURE_STDERR $QMAKE projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug DEFINES+=CAPTURE_STDERR