# HG changeset patch # User nihathrael@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1235691205 0 # Node ID 3d0cc4545938758c8a17383c63ecabdc5883bae9 # Parent 06dddc96ce54b23252de194c95745318049945e8 * Applied two patches from icelus * Fix animation reseting on every move()/act() command even if the given animation was already running * Little fix to add boost 1.33 and possibly below compatibility * Added icelus to the AUTHORS file diff -r 06dddc96ce54 -r 3d0cc4545938 doc/AUTHORS --- a/doc/AUTHORS Thu Feb 26 11:26:01 2009 +0000 +++ b/doc/AUTHORS Thu Feb 26 23:33:25 2009 +0000 @@ -8,6 +8,7 @@ donbachi >> donbachi@bachmor.de hahasound >> amc.kjg@gmail.com helios2000 >> helios@zero-projekt.net +icelus >> icelus2k5@gmail.com ifoobar >> ali.fareed@gmail.com ismarc >> ismarc31@gmail.com jasoka >> j.jasoka@gmail.com diff -r 06dddc96ce54 -r 3d0cc4545938 engine/core/model/structures/instance.cpp --- a/engine/core/model/structures/instance.cpp Thu Feb 26 11:26:01 2009 +0000 +++ b/engine/core/model/structures/instance.cpp Thu Feb 26 23:33:25 2009 +0000 @@ -45,13 +45,13 @@ namespace FIFE { static Logger _log(LM_INSTANCE); - + class ActionInfo { public: - ActionInfo(AbstractPather* pather, const Location& curloc): - m_action(NULL), - m_target(NULL), - m_speed(0), + ActionInfo(AbstractPather* pather, const Location& curloc): + m_action(NULL), + m_target(NULL), + m_speed(0), m_repeating(false), m_action_start_time(0), m_prev_call_time(0), @@ -86,7 +86,7 @@ // leader for follow activity Instance* m_leader; }; - + class SayInfo { public: SayInfo(const std::string& txt, unsigned int duration): @@ -97,8 +97,8 @@ std::string m_txt; unsigned int m_duration; unsigned int m_start_time; - }; - + }; + Instance::InstanceActivity::InstanceActivity(Instance& source): m_location(source.m_location), m_facinglocation(), @@ -115,13 +115,13 @@ m_facinglocation = *source.m_facinglocation; } } - + Instance::InstanceActivity::~InstanceActivity() { delete m_actioninfo; delete m_sayinfo; delete m_timeprovider; } - + void Instance::InstanceActivity::update(Instance& source) { source.m_changeinfo = ICHANGE_NO_CHANGES; if (m_location != source.m_location) { @@ -148,7 +148,7 @@ source.m_changeinfo |= ICHANGE_SAYTEXT; m_saytxt = m_sayinfo->m_txt; } - + if (source.m_changeinfo != ICHANGE_NO_CHANGES) { std::vector::iterator i = m_changelisteners.begin(); while (i != m_changelisteners.end()) { @@ -174,13 +174,13 @@ delete m_facinglocation; delete m_visual; } - + void Instance::initializeChanges() { if (!m_activity) { m_activity = new InstanceActivity(*this); } } - + void Instance::setLocation(const Location& loc) { initializeChanges(); m_location = loc; @@ -235,10 +235,10 @@ } FL_WARN(_log, "Cannot remove unknown listener"); } - - void Instance::initalizeAction(const std::string& action_name) { + void Instance::initializeAction(const std::string& action_name) { assert(m_object); assert(m_activity); + const Action *old_action = m_activity->m_actioninfo ? m_activity->m_actioninfo->m_action : NULL; if (m_activity->m_actioninfo) { delete m_activity->m_actioninfo; m_activity->m_actioninfo = NULL; @@ -250,21 +250,24 @@ m_activity->m_actioninfo = NULL; throw NotFound(std::string("action ") + action_name + " not found"); } - m_activity->m_actioninfo->m_prev_call_time = m_activity->m_actioninfo->m_action_start_time = getRuntime(); + m_activity->m_actioninfo->m_prev_call_time = getRuntime(); + if (m_activity->m_actioninfo->m_action != old_action) { + m_activity->m_actioninfo->m_action_start_time = m_activity->m_actioninfo->m_prev_call_time; + } } void Instance::move(const std::string& action_name, const Location& target, const double speed) { initializeChanges(); - initalizeAction(action_name); + initializeAction(action_name); m_activity->m_actioninfo->m_target = new Location(target); m_activity->m_actioninfo->m_speed = speed; setFacingLocation(target); FL_DBG(_log, LMsg("starting action ") << action_name << " from" << m_location << " to " << target << " with speed " << speed); } - + void Instance::follow(const std::string& action_name, Instance* leader, const double speed) { initializeChanges(); - initalizeAction(action_name); + initializeAction(action_name); m_activity->m_actioninfo->m_target = new Location(leader->getLocationRef()); m_activity->m_actioninfo->m_speed = speed; m_activity->m_actioninfo->m_leader = leader; @@ -274,7 +277,7 @@ void Instance::act(const std::string& action_name, const Location& direction, bool repeating) { initializeChanges(); - initalizeAction(action_name); + initializeAction(action_name); m_activity->m_actioninfo->m_repeating = repeating; setFacingLocation(direction); } @@ -283,7 +286,7 @@ initializeChanges(); delete m_activity->m_sayinfo; m_activity->m_sayinfo = NULL; - + if (text != "") { m_activity->m_sayinfo = new SayInfo(text, duration); m_activity->m_sayinfo->m_start_time = getRuntime(); @@ -314,7 +317,7 @@ // how far we can travel double distance_to_travel = (static_cast(timedelta) / 1000.0) * info->m_speed; FL_DBG(_log, LMsg("dist ") << distance_to_travel); - + Location nextLocation = m_location; info->m_pather_session_id = info->m_pather->getNextLocation( this, *info->m_target, @@ -328,7 +331,7 @@ // return if we are close enough to target to stop if (info->m_pather_session_id == -1) { return true; - } + } return false; } @@ -444,7 +447,7 @@ } delete m_activity->m_timeprovider; m_activity->m_timeprovider = NULL; - + if (m_location.getLayer()) { Map* map = m_location.getLayer()->getMap(); if (map) { diff -r 06dddc96ce54 -r 3d0cc4545938 engine/core/model/structures/instance.h --- a/engine/core/model/structures/instance.h Thu Feb 26 11:26:01 2009 +0000 +++ b/engine/core/model/structures/instance.h Thu Feb 26 23:33:25 2009 +0000 @@ -63,13 +63,13 @@ ICHANGE_ROTATION = 0x0040, // NOTE! does not currently get updated onInstanceChange unless some other activity is performed }; typedef unsigned int InstanceChangeInfo; - + class InstanceChangeListener { public: virtual ~InstanceChangeListener() {}; virtual void onInstanceChanged(Instance* instance, InstanceChangeInfo info) = 0; }; - + /** * An Instance is an "instantiation" of an Object at a Location. */ @@ -108,12 +108,12 @@ * @return current location */ Location getLocation() const { return m_location; } - + /** Gets reference of current location of instance * @return reference to current location */ Location& getLocationRef() { return m_location; } - + /** Gets movement target in case instance is moving. In case not, returns current location * To move target location, call move-method * @see move @@ -121,12 +121,12 @@ * @return Movement target location */ Location getTargetLocation() const; - + /** Sets the direction where instance is heading. Useful e.g. with static * instances which don't "move" or "act" */ void setFacingLocation(const Location& loc); - + /** Returns the direction where instance is heading * @note does not return const Location&, since swig wont be const correct * @return the direction of instance. @@ -136,11 +136,11 @@ /** Set the rotation offset of this instance */ void setRotation(int rotation); - + /** Get the rotation offset of this instance */ int getRotation() const { return m_rotation; } - + /** Returns reference to the direction where instance is heading * Note: if instance didn't previously hadn't defined facing location * (e.g. by movement or setFacingLocation), method creates the location @@ -148,7 +148,7 @@ * @return reference to the direction of instance. */ Location& getFacingLocationRef(); - + /** Adds new instance action listener * @param listener to add */ @@ -168,7 +168,7 @@ * @param listener to remove */ void removeChangeListener(InstanceChangeListener* listener); - + /** Gets the currently active action. This is owned by * the instance's object, so don't delete it! * @return current action, NULL in case there is none @@ -226,27 +226,27 @@ * @returns marked changes */ InstanceChangeInfo update(); - + /** Sets visualization to be used. Transfers ownership. */ void setVisual(AbstractVisual* visual) { m_visual = visual; } - + /** Gets used visualization */ template T* getVisual() const { return reinterpret_cast(m_visual); } - + /** Sets speed for the map. See Model::setTimeMultiplier. */ void setTimeMultiplier(float multip); - + /** Gets instance speed. @see setTimeMultiplier. */ float getTimeMultiplier(); - + /** Gets instance speed, considering also model and map speeds. @see setTimeMultiplier. */ float getTotalTimeMultiplier(); - + /** Gets the scaled runtime in milliseconds * @return runtime */ @@ -280,7 +280,7 @@ public: InstanceActivity(Instance& source); ~InstanceActivity(); - + // ----- Fields related to change tracking ----- // updates cached variables, marks changes void update(Instance& source); @@ -298,7 +298,7 @@ std::string m_saytxt; // listeners for changes std::vector m_changelisteners; - + // ----- Fields related to generic activity ----- // listeners for action related events std::vector m_actionlisteners; @@ -312,7 +312,7 @@ InstanceActivity* m_activity; // bitmask stating current changes InstanceChangeInfo m_changeinfo; - + // object where instantiated from Object* m_object; // current location @@ -321,13 +321,13 @@ Location* m_facinglocation; // instance visualization AbstractVisual* m_visual; - + Instance(const Instance&); Instance& operator=(const Instance&); // Finalize current action void finalizeAction(); // Initialize action for use - void initalizeAction(const std::string& action_name); + void initializeAction(const std::string& action_name); // Moves instance. Returns true if finished bool process_movement(); // Calculates movement based current location and speed diff -r 06dddc96ce54 -r 3d0cc4545938 engine/core/vfs/vfsdirectory.cpp --- a/engine/core/vfs/vfsdirectory.cpp Thu Feb 26 11:26:01 2009 +0000 +++ b/engine/core/vfs/vfsdirectory.cpp Thu Feb 26 23:33:25 2009 +0000 @@ -102,7 +102,10 @@ if (bfs::is_directory(*i) != directorys) continue; - list.insert(i->path().leaf()); + // This only works with boost 1.34 and up + // list.insert(i->path().leaf()); + // This one should be ok with both 1.33 and above + list.insert(i->leaf()); } return list;