From 1c687fdc960280745221976b2b137d453ce009d2 Mon Sep 17 00:00:00 2001 From: coppro Date: Fri, 18 May 2007 19:11:40 +0000 Subject: [PATCH] Prevented some crashes from uncaught exceptions Moved mse.ico to app.ico Fixed the Linux version of load_resource_icon(). git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@388 0fc631ac-6414-0410-93d0-97cfa31319b6 --- MakeAM.sh | 2 +- src/gui/util.cpp | 2 +- src/resource/msw/icon/{mse.ico => app.ico} | Bin src/resource/msw/mse.rc | 4 ++-- src/script/image.cpp | 23 +++++++++++++-------- 5 files changed, 18 insertions(+), 13 deletions(-) rename src/resource/msw/icon/{mse.ico => app.ico} (100%) diff --git a/MakeAM.sh b/MakeAM.sh index c188f70a..e09c928f 100755 --- a/MakeAM.sh +++ b/MakeAM.sh @@ -15,6 +15,6 @@ AM_LDFLAGS = @WX_LIBS@ magicseteditor_SOURCES = -# The script used to generate is MakeAM. " > Makefile.am; +# The script used to generate is MakeAM.sh " > Makefile.am; find . -name *.cpp | sed "s/\./magicseteditor_SOURCES += ./" >> Makefile.am; \ No newline at end of file diff --git a/src/gui/util.cpp b/src/gui/util.cpp index 9add1708..13da01e3 100644 --- a/src/gui/util.cpp +++ b/src/gui/util.cpp @@ -116,7 +116,7 @@ wxIcon load_resource_icon(const String& name) { #if defined(__WXMSW__) return wxIcon(_("icon/") + name); #else - static String path = wxStandardPaths::Get().GetDataDir() + _("/icon/"); + static String path = wxStandardPaths::Get().GetDataDir() + _("/resource/icon/"); return wxIcon(path + name + _(".ico"), wxBITMAP_TYPE_ICO); #endif } diff --git a/src/resource/msw/icon/mse.ico b/src/resource/msw/icon/app.ico similarity index 100% rename from src/resource/msw/icon/mse.ico rename to src/resource/msw/icon/app.ico diff --git a/src/resource/msw/mse.rc b/src/resource/msw/mse.rc index 1fa740b0..a1a311df 100644 --- a/src/resource/msw/mse.rc +++ b/src/resource/msw/mse.rc @@ -8,7 +8,7 @@ // -------------------------------------------------------- : Icons -icon/app ICON "icon/mse.ico" // has to come first in alphabet!! +icon/app ICON "icon/app.ico" // has to come first in alphabet!! icon/export ICON "icon/set.ico" //todo icon/game ICON "icon/set.ico" //todo icon/set ICON "icon/set.ico" @@ -163,7 +163,7 @@ FILETYPE VFT_APP VALUE "License", "GNU General Public License 2 or later; This is free software, and you are welcome to redistribute it under certain conditions; See the help file for details" VALUE "FileDescription", "Magic Set Editor" VALUE "InternalName", "mse2/8" - VALUE "LegalCopyright", "© 2001-2007 Twan van Laarhoven" + VALUE "LegalCopyright", "� 2001-2007 Twan van Laarhoven" VALUE "ProductName", "Magic Set Editor" } } diff --git a/src/script/image.cpp b/src/script/image.cpp index 99c4095f..74ac6ae4 100644 --- a/src/script/image.cpp +++ b/src/script/image.cpp @@ -33,16 +33,21 @@ Image ScriptableImage::generate(const GeneratedImage::Options& options, bool cac // cached, so we are done return cached; } - // generate - Image image; + // generate blank image + Image image(1,1); + image.InitAlpha(); + image.SetAlpha(0,0,0); if (isReady()) { - image = value->generate(options); - } else { - // error, return blank image - Image i(1,1); - i.InitAlpha(); - i.SetAlpha(0,0,0); - image = i; + try { + image = value->generate(options); + } + catch (FileNotFoundError e) { + handle_error (e); + return image; + } + } + else { + return image; } // resize? int iw = image.GetWidth(), ih = image.GetHeight();