diff options
author | Eugene Sandulenko | 2010-09-02 12:14:04 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-10-12 23:30:00 +0000 |
commit | 086f5961b6575c50bb386750b6e9a3ed1efdd8cd (patch) | |
tree | 75c532790d67ccd3b8fdc5c371a3ce3bf0705dca /engines/sword25/math | |
parent | 0cdb2ded85d17150cb108a5d63dd8957c29af2a5 (diff) | |
download | scummvm-rg350-086f5961b6575c50bb386750b6e9a3ed1efdd8cd.tar.gz scummvm-rg350-086f5961b6575c50bb386750b6e9a3ed1efdd8cd.tar.bz2 scummvm-rg350-086f5961b6575c50bb386750b6e9a3ed1efdd8cd.zip |
SWORD25: unsigned int -> uint
svn-id: r53309
Diffstat (limited to 'engines/sword25/math')
-rw-r--r-- | engines/sword25/math/geometry_script.cpp | 22 | ||||
-rw-r--r-- | engines/sword25/math/region.cpp | 22 | ||||
-rw-r--r-- | engines/sword25/math/region.h | 10 | ||||
-rw-r--r-- | engines/sword25/math/regionregistry.cpp | 6 | ||||
-rw-r--r-- | engines/sword25/math/walkregion.cpp | 22 | ||||
-rw-r--r-- | engines/sword25/math/walkregion.h | 2 |
6 files changed, 42 insertions, 42 deletions
diff --git a/engines/sword25/math/geometry_script.cpp b/engines/sword25/math/geometry_script.cpp index ecc437b6b3..8160199c4d 100644 --- a/engines/sword25/math/geometry_script.cpp +++ b/engines/sword25/math/geometry_script.cpp @@ -86,7 +86,7 @@ static void *my_checkudata(lua_State *L, int ud, const char *tname) { // ----------------------------------------------------------------------------- -static void NewUintUserData(lua_State *L, unsigned int Value) { +static void NewUintUserData(lua_State *L, uint Value) { void *UserData = lua_newuserdata(L, sizeof(Value)); memcpy(UserData, &Value, sizeof(Value)); } @@ -181,7 +181,7 @@ static void TablePolygonToPolygon(lua_State *L, Polygon &Polygon) { // ----------------------------------------------------------------------------- -static unsigned int TableRegionToRegion(lua_State *L, const char *ClassName) { +static uint TableRegionToRegion(lua_State *L, const char *ClassName) { #ifdef DEBUG int __startStackDepth = lua_gettop(L); #endif @@ -199,7 +199,7 @@ static unsigned int TableRegionToRegion(lua_State *L, const char *ClassName) { return 0; } - unsigned int RegionHandle = 0; + uint RegionHandle = 0; if (!strcmp(ClassName, REGION_CLASS_NAME)) { RegionHandle = Region::Create(Region::RT_REGION); } else if (!strcmp(ClassName, WALKREGION_CLASS_NAME)) { @@ -268,7 +268,7 @@ static unsigned int TableRegionToRegion(lua_State *L, const char *ClassName) { static void NewUserdataRegion(lua_State *L, const char *ClassName) { // Region due to the Lua code to create // Any errors that occur will be intercepted to the luaL_error - unsigned int RegionHandle = TableRegionToRegion(L, ClassName); + uint RegionHandle = TableRegionToRegion(L, ClassName); BS_ASSERT(RegionHandle); NewUintUserData(L, RegionHandle); @@ -306,9 +306,9 @@ static const luaL_reg GEO_FUNCTIONS[] = { static Region *CheckRegion(lua_State *L) { // The first parameter must be of type 'userdata', and the Metatable class Geo.Region or Geo.WalkRegion - unsigned int *RegionHandlePtr; - if ((RegionHandlePtr = reinterpret_cast<unsigned int *>(my_checkudata(L, 1, REGION_CLASS_NAME))) != 0 || - (RegionHandlePtr = reinterpret_cast<unsigned int *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) { + uint *RegionHandlePtr; + if ((RegionHandlePtr = reinterpret_cast<uint *>(my_checkudata(L, 1, REGION_CLASS_NAME))) != 0 || + (RegionHandlePtr = reinterpret_cast<uint *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) { return RegionRegistry::GetInstance().ResolveHandle(*RegionHandlePtr); } else { luaL_argcheck(L, 0, 1, "'" REGION_CLASS_NAME "' expected"); @@ -407,7 +407,7 @@ static int R_SetY(lua_State *L) { // ----------------------------------------------------------------------------- -static void DrawPolygon(const Polygon &Polygon, unsigned int Color, const Vertex &Offset) { +static void DrawPolygon(const Polygon &Polygon, uint Color, const Vertex &Offset) { GraphicEngine *pGE = static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx")); BS_ASSERT(pGE); @@ -419,7 +419,7 @@ static void DrawPolygon(const Polygon &Polygon, unsigned int Color, const Vertex // ----------------------------------------------------------------------------- -static void DrawRegion(const Region &Region, unsigned int Color, const Vertex &Offset) { +static void DrawRegion(const Region &Region, uint Color, const Vertex &Offset) { DrawPolygon(Region.GetContour(), Color, Offset); for (int i = 0; i < Region.GetHoleCount(); i++) DrawPolygon(Region.GetHole(i), Color, Offset); @@ -490,8 +490,8 @@ static const luaL_reg REGION_METHODS[] = { static WalkRegion *CheckWalkRegion(lua_State *L) { // The first parameter must be of type 'userdate', and the Metatable class Geo.WalkRegion - unsigned int RegionHandle; - if ((RegionHandle = *reinterpret_cast<unsigned int *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) { + uint RegionHandle; + if ((RegionHandle = *reinterpret_cast<uint *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) { return reinterpret_cast<WalkRegion *>(RegionRegistry::GetInstance().ResolveHandle(RegionHandle)); } else { luaL_argcheck(L, 0, 1, "'" WALKREGION_CLASS_NAME "' expected"); diff --git a/engines/sword25/math/region.cpp b/engines/sword25/math/region.cpp index 3eb5b6dbe7..97a49dd2f9 100644 --- a/engines/sword25/math/region.cpp +++ b/engines/sword25/math/region.cpp @@ -52,14 +52,14 @@ Region::Region() : m_Valid(false), m_Type(RT_REGION) { // ----------------------------------------------------------------------------- -Region::Region(InputPersistenceBlock &Reader, unsigned int Handle) : m_Valid(false), m_Type(RT_REGION) { +Region::Region(InputPersistenceBlock &Reader, uint Handle) : m_Valid(false), m_Type(RT_REGION) { RegionRegistry::GetInstance().RegisterObject(this, Handle); Unpersist(Reader); } // ----------------------------------------------------------------------------- -unsigned int Region::Create(REGION_TYPE Type) { +uint Region::Create(REGION_TYPE Type) { Region *RegionPtr = NULL; switch (Type) { case RT_REGION: @@ -79,9 +79,9 @@ unsigned int Region::Create(REGION_TYPE Type) { // ----------------------------------------------------------------------------- -unsigned int Region::Create(InputPersistenceBlock &Reader, unsigned int Handle) { +uint Region::Create(InputPersistenceBlock &Reader, uint Handle) { // Read type - unsigned int Type; + uint Type; Reader.Read(Type); // Depending on the type, create a new BS_Region or BS_WalkRegion object @@ -125,7 +125,7 @@ bool Region::Init(const Polygon &Contour, const Common::Array<Polygon> *pHoles) // Place the hole polygons in the following positions if (pHoles) { - for (unsigned int i = 0; i < pHoles->size(); ++i) { + for (uint i = 0; i < pHoles->size(); ++i) { m_Polygons.push_back(Polygon()); m_Polygons[i + 1].Init((*pHoles)[i].VertexCount, (*pHoles)[i].Vertecies); m_Polygons[i + 1].EnsureCWOrder(); @@ -171,7 +171,7 @@ void Region::SetPos(int X, int Y) { m_Position = Vertex(X, Y); // Move all the vertecies - for (unsigned int i = 0; i < m_Polygons.size(); ++i) { + for (uint i = 0; i < m_Polygons.size(); ++i) { m_Polygons[i] += Delta; } @@ -200,7 +200,7 @@ bool Region::IsPointInRegion(int X, int Y) const { // Test whether the point is in the contour if (m_Polygons[0].IsPointInPolygon(X, Y, true)) { // Test whether the point is in a hole - for (unsigned int i = 1; i < m_Polygons.size(); i++) { + for (uint i = 1; i < m_Polygons.size(); i++) { if (m_Polygons[i].IsPointInPolygon(X, Y, false)) return false; } @@ -225,7 +225,7 @@ Vertex Region::FindClosestRegionPoint(const Vertex &Point) const { // point on the edge of the hole is determined int PolygonIdx = 0; { - for (unsigned int i = 1; i < m_Polygons.size(); ++i) { + for (uint i = 1; i < m_Polygons.size(); ++i) { if (m_Polygons[i].IsPointInPolygon(Point)) { PolygonIdx = i; break; @@ -337,7 +337,7 @@ bool Region::IsLineOfSight(const Vertex &a, const Vertex &b) const { bool Region::Persist(OutputPersistenceBlock &Writer) { bool Result = true; - Writer.Write(static_cast<unsigned int>(m_Type)); + Writer.Write(static_cast<uint>(m_Type)); Writer.Write(m_Valid); Writer.Write(m_Position.X); Writer.Write(m_Position.Y); @@ -365,9 +365,9 @@ bool Region::Unpersist(InputPersistenceBlock &Reader) { Reader.Read(m_Position.Y); m_Polygons.clear(); - unsigned int PolygonCount; + uint PolygonCount; Reader.Read(PolygonCount); - for (unsigned int i = 0; i < PolygonCount; ++i) { + for (uint i = 0; i < PolygonCount; ++i) { m_Polygons.push_back(Polygon(Reader)); } diff --git a/engines/sword25/math/region.h b/engines/sword25/math/region.h index 0bb9bb84b9..40d52e38d6 100644 --- a/engines/sword25/math/region.h +++ b/engines/sword25/math/region.h @@ -62,7 +62,7 @@ protected: */ Region(); - Region(InputPersistenceBlock &Reader, unsigned int Handle); + Region(InputPersistenceBlock &Reader, uint Handle); public: enum REGION_TYPE { @@ -70,8 +70,8 @@ public: RT_WALKREGION }; - static unsigned int Create(REGION_TYPE Type); - static unsigned int Create(InputPersistenceBlock &Reader, unsigned int Handle = 0); + static uint Create(REGION_TYPE Type); + static uint Create(InputPersistenceBlock &Reader, uint Handle = 0); virtual ~Region(); @@ -154,7 +154,7 @@ public: * The index must be between 0 and GetHoleCount() - 1. * @return Returns the desired hole polygon */ - inline const Polygon &GetHole(unsigned int i) const; + inline const Polygon &GetHole(uint i) const; /** * For a point outside the region, finds the closest point inside the region @@ -236,7 +236,7 @@ protected: // Inlines // ----------------------------------------------------------------------------- -inline const Polygon &Region::GetHole(unsigned int i) const { +inline const Polygon &Region::GetHole(uint i) const { BS_ASSERT(i < m_Polygons.size() - 1); return m_Polygons[i + 1]; } diff --git a/engines/sword25/math/regionregistry.cpp b/engines/sword25/math/regionregistry.cpp index ca09ec32ac..6be4c1fa2a 100644 --- a/engines/sword25/math/regionregistry.cpp +++ b/engines/sword25/math/regionregistry.cpp @@ -106,13 +106,13 @@ bool RegionRegistry::Unpersist(InputPersistenceBlock &Reader) { while (!m_Handle2PtrMap.empty()) delete m_Handle2PtrMap.begin()->_value; // Read in the number of BS_Regions - unsigned int RegionCount; + uint RegionCount; Reader.Read(RegionCount); // Restore all the BS_Regions objects - for (unsigned int i = 0; i < RegionCount; ++i) { + for (uint i = 0; i < RegionCount; ++i) { // Handle read - unsigned int Handle; + uint Handle; Reader.Read(Handle); // BS_Region restore diff --git a/engines/sword25/math/walkregion.cpp b/engines/sword25/math/walkregion.cpp index 6fbf489bdc..8416662d58 100644 --- a/engines/sword25/math/walkregion.cpp +++ b/engines/sword25/math/walkregion.cpp @@ -58,7 +58,7 @@ WalkRegion::WalkRegion() { // ----------------------------------------------------------------------------- -WalkRegion::WalkRegion(InputPersistenceBlock &Reader, unsigned int Handle) : +WalkRegion::WalkRegion(InputPersistenceBlock &Reader, uint Handle) : Region(Reader, Handle) { m_Type = RT_WALKREGION; Unpersist(Reader); @@ -155,7 +155,7 @@ static void RelaxNodes(DijkstraNode::Container &Nodes, // a shorter path has been found to them. int CurNodeIndex = CurNodeIter - Nodes.begin(); - for (unsigned int i = 0; i < Nodes.size(); i++) { + for (uint i = 0; i < Nodes.size(); i++) { int Cost = VisibilityMatrix[CurNodeIndex][i]; if (!Nodes[i].Chosen && Cost != infinity) { int TotalCost = (*CurNodeIter).Cost + Cost; @@ -193,7 +193,7 @@ bool WalkRegion::FindPath(const Vertex &Start, const Vertex &End, BS_Path &Path) // Since a node is selected each round from the node list, and can never be selected again // after that, the maximum number of loop iterations is limited by the number of nodes - for (unsigned int i = 0; i < m_Nodes.size(); i++) { + for (uint i = 0; i < m_Nodes.size(); i++) { // Determine the nearest edge node in the node list DijkstraNode::Iter NodeInter = ChooseClosestNode(DijkstraNodes); @@ -245,14 +245,14 @@ void WalkRegion::InitNodeVector() { // Determine the number of nodes int NodeCount = 0; { - for (unsigned int i = 0; i < m_Polygons.size(); i++) + for (uint i = 0; i < m_Polygons.size(); i++) NodeCount += m_Polygons[i].VertexCount; } // Knoten-Vector füllen m_Nodes.reserve(NodeCount); { - for (unsigned int j = 0; j < m_Polygons.size(); j++) + for (uint j = 0; j < m_Polygons.size(); j++) for (int i = 0; i < m_Polygons[j].VertexCount; i++) m_Nodes.push_back(m_Polygons[j].Vertecies[i]); } @@ -272,8 +272,8 @@ void WalkRegion::ComputeVisibilityMatrix() { } // Calculate visibility been vertecies - for (unsigned int j = 0; j < m_Nodes.size(); ++j) { - for (unsigned int i = j; i < m_Nodes.size(); ++i) { + for (uint j = 0; j < m_Nodes.size(); ++j) { + for (uint i = j; i < m_Nodes.size(); ++i) { if (IsLineOfSight(m_Nodes[i], m_Nodes[j])) { // There is a line of sight, so save the distance between the two int Distance = m_Nodes[i].Distance(m_Nodes[j]); @@ -332,7 +332,7 @@ void WalkRegion::SetPos(int X, int Y) { Vertex Delta(X - m_Position.X, Y - m_Position.Y); // Move all the nodes - for (unsigned int i = 0; i < m_Nodes.size(); i++) m_Nodes[i] += Delta; + for (uint i = 0; i < m_Nodes.size(); i++) m_Nodes[i] += Delta; // Move regions Region::SetPos(X, Y); @@ -381,7 +381,7 @@ bool WalkRegion::Unpersist(InputPersistenceBlock &Reader) { // this point only the additional data from BS_WalkRegion needs to be loaded // Node load - unsigned int NodeCount; + uint NodeCount; Reader.Read(NodeCount); m_Nodes.clear(); m_Nodes.resize(NodeCount); @@ -393,13 +393,13 @@ bool WalkRegion::Unpersist(InputPersistenceBlock &Reader) { } // Visibility matrix load - unsigned int RowCount; + uint RowCount; Reader.Read(RowCount); m_VisibilityMatrix.clear(); m_VisibilityMatrix.resize(RowCount); Common::Array< Common::Array<int> >::iterator RowIter = m_VisibilityMatrix.begin(); while (RowIter != m_VisibilityMatrix.end()) { - unsigned int ColCount; + uint ColCount; Reader.Read(ColCount); RowIter->resize(ColCount); Common::Array<int>::iterator ColIter = RowIter->begin(); diff --git a/engines/sword25/math/walkregion.h b/engines/sword25/math/walkregion.h index a99f9a42fd..feb40949ce 100644 --- a/engines/sword25/math/walkregion.h +++ b/engines/sword25/math/walkregion.h @@ -59,7 +59,7 @@ class WalkRegion : public Region { protected: WalkRegion(); - WalkRegion(InputPersistenceBlock &Reader, unsigned int Handle); + WalkRegion(InputPersistenceBlock &Reader, uint Handle); public: virtual ~WalkRegion(); |