# HG changeset patch # User helios2000@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1291663527 0 # Node ID 4f36c890b1dda91bfb41fe740d50002c60920102 # Parent 4fe9747d5f88b14282ce5698cc86da2fc93e6716 * Merged the 0.3.3dev branche changes to the trunk. diff -r 4fe9747d5f88 -r 4f36c890b1dd engine/core/gui/console/console.cpp --- a/engine/core/gui/console/console.cpp Mon Dec 06 18:37:18 2010 +0000 +++ b/engine/core/gui/console/console.cpp Mon Dec 06 19:25:27 2010 +0000 @@ -47,7 +47,7 @@ const unsigned Console::m_maxOutputRows = 50; static Logger _log(LM_CONSOLE); - Console::Console() + Console::Console() : gcn::Container(), m_consoleexec(0), m_input(new CommandLine()), @@ -90,7 +90,7 @@ void Console::reLayout() { Image* screen = RenderBackend::instance()->getScreenImage(); assert(screen); - + int w, h, b, input_h, bbar_h, button_w; w = screen->getWidth() * 4/5; h = screen->getHeight() * 4/5; @@ -98,7 +98,7 @@ input_h = getFont()->getHeight(); bbar_h = input_h; button_w = 80; - + gcn::Color black(0x00,0,0,0xff); gcn::Color white(0xff,0xff,0xff,0xff); gcn::Color dark(50,60,50,0xff); @@ -147,7 +147,7 @@ Console::~Console() { doHide(); - + remove(m_input); remove(m_outputscrollarea); remove(m_status); @@ -165,7 +165,7 @@ caption += boost::lexical_cast(fps); m_status->setCaption( caption ); } - + void Console::updateAnimation() { if (m_hiding){ setPosition(getX(), getY() - m_animationDelta); @@ -246,8 +246,8 @@ } } catch (const FIFE::Exception & e) { - FL_WARN(_log, LMsg("Console caught exception: ") << e.getMessage()); - println(e.getMessage()); + FL_WARN(_log, LMsg("Console caught exception: ") << e.what()); + println(e.what()); } } diff -r 4fe9747d5f88 -r 4f36c890b1dd engine/core/model/structures/instance.cpp --- a/engine/core/model/structures/instance.cpp Mon Dec 06 18:37:18 2010 +0000 +++ b/engine/core/model/structures/instance.cpp Mon Dec 06 19:25:27 2010 +0000 @@ -182,7 +182,9 @@ m_object(object), m_location(location), m_facinglocation(NULL), - m_visual(NULL) { + m_visual(NULL), + m_blocking(object->isBlocking()), + m_override_blocking(false) { } Instance::~Instance() { @@ -244,6 +246,16 @@ m_id = identifier; } + void Instance::setBlocking(bool blocking) { + if (m_override_blocking) { + m_blocking = blocking; + } + } + + bool Instance::isBlocking() const { + return m_blocking; + } + void Instance::addActionListener(InstanceActionListener* listener) { initializeChanges(); m_activity->m_actionlisteners.push_back(listener); diff -r 4fe9747d5f88 -r 4f36c890b1dd engine/core/model/structures/instance.h --- a/engine/core/model/structures/instance.h Mon Dec 06 18:37:18 2010 +0000 +++ b/engine/core/model/structures/instance.h Mon Dec 06 19:25:27 2010 +0000 @@ -158,6 +158,22 @@ */ Location& getFacingLocationRef(); + /** Sets if instance blocks movement + */ + void setBlocking(bool blocking); + + /** Gets if instance blocks movement + */ + bool isBlocking() const; + + /** Sets if instance blocking can overriden + */ + void setOverrideBlocking(bool overblock) { m_override_blocking = overblock; } + + /** Gets if instance blocking can overriden + */ + bool isOverrideBlocking() const { return m_override_blocking; } + /** Adds new instance action listener * @param listener to add */ @@ -359,6 +375,10 @@ Location* m_facinglocation; // instance visualization AbstractVisual* m_visual; + // instance blocking info + bool m_blocking; + // allow to override the blocking property + bool m_override_blocking; Instance(const Instance&); Instance& operator=(const Instance&); diff -r 4fe9747d5f88 -r 4f36c890b1dd engine/core/model/structures/instance.i --- a/engine/core/model/structures/instance.i Mon Dec 06 18:37:18 2010 +0000 +++ b/engine/core/model/structures/instance.i Mon Dec 06 19:25:27 2010 +0000 @@ -76,6 +76,10 @@ Location getTargetLocation() const; void setRotation(int); int getRotation() const; + void setBlocking(bool blocking); + bool isBlocking() const; + void setOverrideBlocking(bool overblock); + bool isOverrideBlocking() const; void addActionListener(InstanceActionListener* listener); void removeActionListener(InstanceActionListener* listener); void addChangeListener(InstanceChangeListener* listener); diff -r 4fe9747d5f88 -r 4f36c890b1dd engine/core/model/structures/layer.cpp --- a/engine/core/model/structures/layer.cpp Mon Dec 06 18:37:18 2010 +0000 +++ b/engine/core/model/structures/layer.cpp Mon Dec 06 19:25:27 2010 +0000 @@ -238,7 +238,7 @@ m_instanceTree->findInstances(cellCoordinate, 0, 0, adjacentInstances); bool blockingInstance = false; for(std::list::const_iterator j = adjacentInstances.begin(); j != adjacentInstances.end(); ++j) { - if((*j)->getObject()->isBlocking() && (*j)->getLocationRef().getLayerCoordinates() == cellCoordinate) { + if((*j)->isBlocking() && (*j)->getLocationRef().getLayerCoordinates() == cellCoordinate) { blockingInstance = true; } } diff -r 4fe9747d5f88 -r 4f36c890b1dd engine/core/util/base/exception.cpp --- a/engine/core/util/base/exception.cpp Mon Dec 06 18:37:18 2010 +0000 +++ b/engine/core/util/base/exception.cpp Mon Dec 06 19:25:27 2010 +0000 @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2005-2008 by the FIFE team * - * http://www.fifengine.de * + * Copyright (C) 2005-2010 by the FIFE team * + * http://www.fifengine.net * * This file is part of FIFE. * * * * FIFE is free software; you can redistribute it and/or * @@ -34,15 +34,16 @@ namespace FIFE { static Logger _log(LM_EXCEPTION); - Exception::Exception(const std::string& msg): m_message(msg) { - FL_WARN(_log, LMsg() << getMessage()); - } + Exception::Exception(const std::string& msg): std::runtime_error(msg) { + FL_PANIC(_log, LMsg() << what()); + } + + Exception::~Exception() throw() {} - Exception::~Exception() {} + const char* Exception::what() const throw() { + std::stringstream str; - std::string Exception::getMessage() const { - std::stringstream str; - str << "_[" << getTypeStr() << "]_ , " << m_message; - return str.str(); + str << "_[" << getTypeStr() << "]_ , " << std::runtime_error::what(); + return str.str().c_str(); } }//FIFE diff -r 4fe9747d5f88 -r 4f36c890b1dd engine/core/util/base/exception.h --- a/engine/core/util/base/exception.h Mon Dec 06 18:37:18 2010 +0000 +++ b/engine/core/util/base/exception.h Mon Dec 06 19:25:27 2010 +0000 @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2005-2008 by the FIFE team * - * http://www.fifengine.de * + * Copyright (C) 2005-2010 by the FIFE team * + * http://www.fifengine.net * * This file is part of FIFE. * * * * FIFE is free software; you can redistribute it and/or * @@ -24,6 +24,7 @@ // Standard C++ library includes #include +#include // 3rd party library includes @@ -38,28 +39,24 @@ * All other exceptions derived from this merely adjust the error string * to be slightly more specific. */ - class Exception { + class Exception : public std::runtime_error { public: - /** Constructor. - * @param txt The error mesage to be stored. + /** Constructor. + * @param msg The error mesage to be stored. */ Exception(const std::string& msg); - /** Destructor. + /** Destructor. */ - virtual ~Exception(); + virtual ~Exception() throw(); /** Returns the error message. * @return The error message. */ - std::string getMessage() const; - + virtual const char* what() const throw(); + virtual const std::string& getTypeStr() const { static const std::string s = "Exception"; return s; } virtual const std::string& getDescription() const { static const std::string s = "Generic FIFE exception"; return s; } - - private: - // The error string. - std::string m_message; }; #define FIFE_EXCEPTION_DECL(_name, _description) \ @@ -69,7 +66,7 @@ const std::string& getTypeStr() const { static const std::string s = #_name; return s; } \ const std::string& getDescription() const { static const std::string s = _description; return s; } \ } - + FIFE_EXCEPTION_DECL(SDLException, "SDL reported something bad"); FIFE_EXCEPTION_DECL(NotFound, "Something was searched, but not found"); FIFE_EXCEPTION_DECL(NotSet, "Something was not set correctly"); @@ -84,7 +81,7 @@ FIFE_EXCEPTION_DECL(EventException, "Error related to event functionality"); FIFE_EXCEPTION_DECL(GuiException, "Error related to gui functionality"); FIFE_EXCEPTION_DECL(InconsistencyDetected, "An inconsistency in FIFE internals was detected. Please report this is a FIFE Bug."); - + /** @bug The memory allocation in @c std::string might fail, resulting in terminate. */ FIFE_EXCEPTION_DECL(OutOfMemory, "Buy more ram ;)"); diff -r 4fe9747d5f88 -r 4f36c890b1dd engine/core/vfs/vfs.cpp --- a/engine/core/vfs/vfs.cpp Mon Dec 06 18:37:18 2010 +0000 +++ b/engine/core/vfs/vfs.cpp Mon Dec 06 19:25:27 2010 +0000 @@ -85,7 +85,7 @@ m_usedfiles.insert(path); return source; } catch (const Exception& ex) { - FL_WARN(_log, LMsg(provider->getName()) << " thought it could load " << path << " but didn't succeed (" << ex.getMessage() << ")"); + FL_WARN(_log, LMsg(provider->getName()) << " thought it could load " << path << " but didn't succeed (" << ex.what() << ")"); continue; } catch (...) { FL_WARN(_log, LMsg(provider->getName()) << " thought it could load " << path << " but didn't succeed (unkown exception)"); diff -r 4fe9747d5f88 -r 4f36c890b1dd engine/core/view/renderers/blockinginforenderer.cpp --- a/engine/core/view/renderers/blockinginforenderer.cpp Mon Dec 06 18:37:18 2010 +0000 +++ b/engine/core/view/renderers/blockinginforenderer.cpp Mon Dec 06 19:25:27 2010 +0000 @@ -78,7 +78,7 @@ RenderList::const_iterator instance_it = instances.begin(); for (;instance_it != instances.end(); ++instance_it) { Instance* instance = (*instance_it)->instance; - if (!instance->getObject()->isBlocking()) { + if (!instance->getObject()->isBlocking() || !instance->isBlocking()) { continue; } std::vector vertices; diff -r 4fe9747d5f88 -r 4f36c890b1dd engine/python/fife/extensions/pythonize.py --- a/engine/python/fife/extensions/pythonize.py Mon Dec 06 18:37:18 2010 +0000 +++ b/engine/python/fife/extensions/pythonize.py Mon Dec 06 19:25:27 2010 +0000 @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # #################################################################### -# Copyright (C) 2005-2009 by the FIFE team -# http://www.fifengine.de +# Copyright (C) 2005-2010 by the FIFE team +# http://www.fifengine.net # This file is part of FIFE. # # FIFE is free software; you can redistribute it and/or @@ -46,7 +46,7 @@ __all__ = () -fife.Exception.__str__ = fife.Exception.getMessage +fife.Exception.__str__ = fife.Exception.what def _Color2Str(c): return 'Color(%s)' % ','.join(map(str,(c.r,c.g,c.b,c.a))) fife.Color.__str__ = _Color2Str diff -r 4fe9747d5f88 -r 4f36c890b1dd engine/python/fife/extensions/savers.py --- a/engine/python/fife/extensions/savers.py Mon Dec 06 18:37:18 2010 +0000 +++ b/engine/python/fife/extensions/savers.py Mon Dec 06 19:25:27 2010 +0000 @@ -215,6 +215,13 @@ attr_vals[(None, 'id')] = inst.getId() attr_names[(None, 'id')] = 'id' + if inst.isOverrideBlocking(): + attr_vals[(None, 'override_blocking')] = str(int(inst.isOverrideBlocking())) + attr_names[(None, 'override_blocking')] = 'override_blocking' + if inst.getObject().isBlocking() is not inst.isBlocking(): + attr_vals[(None, 'blocking')] = str(int(inst.isBlocking())) + attr_names[(None, 'blocking')] = 'blocking' + attrs = AttributesNSImpl(attr_vals, attr_names) self.file.write(self.indent_level) self.xmlout.startElementNS((None, 'i'), 'i', attrs) diff -r 4fe9747d5f88 -r 4f36c890b1dd engine/python/fife/extensions/serializers/xmlmap.py --- a/engine/python/fife/extensions/serializers/xmlmap.py Mon Dec 06 18:37:18 2010 +0000 +++ b/engine/python/fife/extensions/serializers/xmlmap.py Mon Dec 06 19:25:27 2010 +0000 @@ -501,6 +501,13 @@ rotation = int(rotation) inst.setRotation(rotation) + over_block = instance.get('override_blocking') + if over_block is not None: + inst.setOverrideBlocking(bool(over_block)) + blocking = instance.get('blocking') + if blocking is not None: + inst.setBlocking(bool(int(blocking))) + fife.InstanceVisual.create(inst) stackpos = instance.get('stackpos') diff -r 4fe9747d5f88 -r 4f36c890b1dd engine/swigwrappers/python/fife.i.templ --- a/engine/swigwrappers/python/fife.i.templ Mon Dec 06 18:37:18 2010 +0000 +++ b/engine/swigwrappers/python/fife.i.templ Mon Dec 06 19:25:27 2010 +0000 @@ -110,7 +110,7 @@ #define _FIFE_EXC_HANDLER(_fife_exc_type, _converted_type) \ catch (FIFE::_fife_exc_type& _e) { \ PyErr_Clear(); \ - SWIG_exception(_converted_type, _e.getMessage().c_str()); \ + SWIG_exception(_converted_type, _e.what()); \ } #define _FIFE_DIRECTOR_EXC_HANDLER() \ diff -r 4fe9747d5f88 -r 4f36c890b1dd tools/editor/gui/objectedit.xml --- a/tools/editor/gui/objectedit.xml Mon Dec 06 18:37:18 2010 +0000 +++ b/tools/editor/gui/objectedit.xml Mon Dec 06 19:25:27 2010 +0000 @@ -19,6 +19,7 @@