# HG changeset patch # User prock@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1289531446 0 # Node ID bb26a76458c6f32f918347103aff480eb3a9f811 # Parent f73be43f69c8dd5b6eb4826116e7bf315e8adc88 * Modified a calculation in PointType2D to use the FIFE math function * Replaced a #define with an enum for the resource location type * Exposed ResourceLocation::getType() to python diff -r f73be43f69c8 -r bb26a76458c6 engine/core/util/resource/resource.i --- a/engine/core/util/resource/resource.i Tue Nov 09 21:39:45 2010 +0000 +++ b/engine/core/util/resource/resource.i Fri Nov 12 03:10:46 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 * @@ -29,6 +29,12 @@ namespace FIFE { + enum ResourceLocationType { + RES_TYPE_FILE = 0, + RES_TYPE_IMAGE = 1 + }; + + class ResourceLocation { public: ResourceLocation(const std::string& filename); @@ -37,9 +43,8 @@ virtual bool operator ==(const ResourceLocation& loc) const; virtual bool operator <(const ResourceLocation& loc) const; virtual ResourceLocation* clone() const; - - private: - ResourceLocation(const std::string& filename); + + ResourceLocationType getType() const; }; @@ -77,9 +82,6 @@ virtual void save(const std::string& filename, IResource* resource) { save(ResourceLocation(filename), resource); } }; - - enum { RES_LOADED = 0x01, RES_NON_LOADED = 0x02}; - class Pool { public: static const int INVALID_ID = -1; diff -r f73be43f69c8 -r bb26a76458c6 engine/core/util/resource/resource_location.h --- a/engine/core/util/resource/resource_location.h Tue Nov 09 21:39:45 2010 +0000 +++ b/engine/core/util/resource/resource_location.h Fri Nov 12 03:10:46 2010 +0000 @@ -34,8 +34,10 @@ namespace FIFE { -#define RES_TYPE_FILE 0 -#define RES_TYPE_IMAGE 1 + enum ResourceLocationType { + RES_TYPE_FILE = 0, + RES_TYPE_IMAGE = 1 + }; /** Contains information about the Location of a Resource * @@ -97,11 +99,11 @@ return new ResourceLocation(m_filename); } - int getType() const { return m_type; } + ResourceLocationType getType() const { return m_type; } protected: std::string m_filename; - int m_type; + ResourceLocationType m_type; }; } //FIFE diff -r f73be43f69c8 -r bb26a76458c6 engine/core/util/structures/point.h --- a/engine/core/util/structures/point.h Tue Nov 09 21:39:45 2010 +0000 +++ b/engine/core/util/structures/point.h Fri Nov 12 03:10:46 2010 +0000 @@ -122,7 +122,7 @@ T length() const { double sq; sq = x*x + y*y; - return static_cast(sqrt(sq)); + return static_cast(Mathd::Sqrt(sq)); } /** Normalizes the point