Mercurial > fife-parpg
changeset 677:bb26a76458c6
* 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
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 12 Nov 2010 03:10:46 +0000 |
parents | f73be43f69c8 |
children | 3bdb8a112173 |
files | engine/core/util/resource/resource.i engine/core/util/resource/resource_location.h engine/core/util/structures/point.h |
diffstat | 3 files changed, 17 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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
--- 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<T>(sqrt(sq)); + return static_cast<T>(Mathd::Sqrt(sq)); } /** Normalizes the point