diff options
Diffstat (limited to 'engines/sword25/kernel')
-rw-r--r-- | engines/sword25/kernel/inputpersistenceblock.cpp | 12 | ||||
-rw-r--r-- | engines/sword25/kernel/inputpersistenceblock.h | 4 | ||||
-rw-r--r-- | engines/sword25/kernel/kernel.cpp | 24 | ||||
-rw-r--r-- | engines/sword25/kernel/kernel.h | 18 | ||||
-rw-r--r-- | engines/sword25/kernel/kernel_script.cpp | 20 | ||||
-rw-r--r-- | engines/sword25/kernel/memleaks.cpp | 14 | ||||
-rw-r--r-- | engines/sword25/kernel/memleaks.h | 12 | ||||
-rw-r--r-- | engines/sword25/kernel/objectregistry.h | 26 | ||||
-rw-r--r-- | engines/sword25/kernel/outputpersistenceblock.cpp | 8 | ||||
-rw-r--r-- | engines/sword25/kernel/outputpersistenceblock.h | 4 | ||||
-rw-r--r-- | engines/sword25/kernel/persistenceblock.h | 18 | ||||
-rw-r--r-- | engines/sword25/kernel/persistenceservice.cpp | 36 | ||||
-rw-r--r-- | engines/sword25/kernel/persistenceservice.h | 14 | ||||
-rw-r--r-- | engines/sword25/kernel/resmanager.cpp | 4 | ||||
-rw-r--r-- | engines/sword25/kernel/resmanager.h | 4 | ||||
-rw-r--r-- | engines/sword25/kernel/resource.h | 10 | ||||
-rw-r--r-- | engines/sword25/kernel/service_ids.h | 2 | ||||
-rw-r--r-- | engines/sword25/kernel/string.h | 6 |
18 files changed, 118 insertions, 118 deletions
diff --git a/engines/sword25/kernel/inputpersistenceblock.cpp b/engines/sword25/kernel/inputpersistenceblock.cpp index 0f1eb83f63..cbf2e5b1f9 100644 --- a/engines/sword25/kernel/inputpersistenceblock.cpp +++ b/engines/sword25/kernel/inputpersistenceblock.cpp @@ -46,7 +46,7 @@ namespace Sword25 { // Constructor / Destructor // ----------------------------------------------------------------------------- -InputPersistenceBlock::InputPersistenceBlock(const void *Data, unsigned int DataLength) : +InputPersistenceBlock::InputPersistenceBlock(const void *Data, uint DataLength) : m_Data(static_cast<const byte *>(Data), DataLength), m_ErrorState(NONE) { m_Iter = m_Data.begin(); @@ -81,9 +81,9 @@ void InputPersistenceBlock::Read(signed int &Value) { // ----------------------------------------------------------------------------- -void InputPersistenceBlock::Read(unsigned int &Value) { +void InputPersistenceBlock::Read(uint &Value) { if (CheckMarker(UINT_MARKER)) { - RawRead(&Value, sizeof(unsigned int)); + RawRead(&Value, sizeof(uint)); Value = ConvertEndianessFromStorageToSystem(Value); } else { Value = 0; @@ -105,7 +105,7 @@ void InputPersistenceBlock::Read(float &Value) { void InputPersistenceBlock::Read(bool &Value) { if (CheckMarker(BOOL_MARKER)) { - unsigned int UIntBool; + uint UIntBool; RawRead(&UIntBool, sizeof(float)); UIntBool = ConvertEndianessFromStorageToSystem(UIntBool); Value = UIntBool == 0 ? false : true; @@ -120,7 +120,7 @@ void InputPersistenceBlock::Read(Common::String &Value) { Value = ""; if (CheckMarker(STRING_MARKER)) { - unsigned int Size; + uint Size; Read(Size); if (CheckBlockSize(Size)) { @@ -134,7 +134,7 @@ void InputPersistenceBlock::Read(Common::String &Value) { void InputPersistenceBlock::Read(Common::Array<byte> &Value) { if (CheckMarker(BLOCK_MARKER)) { - unsigned int Size; + uint Size; Read(Size); if (CheckBlockSize(Size)) { diff --git a/engines/sword25/kernel/inputpersistenceblock.h b/engines/sword25/kernel/inputpersistenceblock.h index bab8dcf9b5..3e39a69918 100644 --- a/engines/sword25/kernel/inputpersistenceblock.h +++ b/engines/sword25/kernel/inputpersistenceblock.h @@ -57,12 +57,12 @@ public: OUT_OF_SYNC }; - InputPersistenceBlock(const void *Data, unsigned int DataLength); + InputPersistenceBlock(const void *Data, uint DataLength); virtual ~InputPersistenceBlock(); void Read(int16 &Value); void Read(signed int &Value); - void Read(unsigned int &Value); + void Read(uint &Value); void Read(float &Value); void Read(bool &Value); void Read(Common::String &Value); diff --git a/engines/sword25/kernel/kernel.cpp b/engines/sword25/kernel/kernel.cpp index 8c08e18e81..a398fdfa38 100644 --- a/engines/sword25/kernel/kernel.cpp +++ b/engines/sword25/kernel/kernel.cpp @@ -134,7 +134,7 @@ Kernel::Superclass::Superclass(Kernel *pKernel, const Common::String &Identifier _Identifier(Identifier), _ServiceCount(0), _ActiveService(NULL) { - for (unsigned int i = 0; i < BS_SERVICE_COUNT; i++) + for (uint i = 0; i < BS_SERVICE_COUNT; i++) if (BS_SERVICE_TABLE[i].SuperclassIdentifier == _Identifier) _ServiceCount++; } @@ -152,11 +152,11 @@ Kernel::Superclass::~Superclass() { * Hierbei ist zu beachten, dass der erste Service die Nummer 0 erhält. Number muss also eine Zahl zwischen * 0 und GetServiceCount() - 1 sein. */ -Common::String Kernel::Superclass::GetServiceIdentifier(unsigned int Number) { +Common::String Kernel::Superclass::GetServiceIdentifier(uint Number) { if (Number > _ServiceCount) return NULL; - unsigned int CurServiceOrd = 0; - for (unsigned int i = 0; i < BS_SERVICE_COUNT; i++) { + uint CurServiceOrd = 0; + for (uint i = 0; i < BS_SERVICE_COUNT; i++) { if (BS_SERVICE_TABLE[i].SuperclassIdentifier == _Identifier) { if (Number == CurServiceOrd) return BS_SERVICE_TABLE[i].ServiceIdentifier; @@ -178,7 +178,7 @@ Common::String Kernel::Superclass::GetServiceIdentifier(unsigned int Number) { * For the superclass "sfx" an example could be "Fmod" or "directsound" */ Service *Kernel::Superclass::NewService(const Common::String &ServiceIdentifier) { - for (unsigned int i = 0; i < BS_SERVICE_COUNT; i++) + for (uint i = 0; i < BS_SERVICE_COUNT; i++) if (BS_SERVICE_TABLE[i].SuperclassIdentifier == _Identifier && BS_SERVICE_TABLE[i].ServiceIdentifier == ServiceIdentifier) { Service *NewService_ = BS_SERVICE_TABLE[i].CreateMethod(_pKernel); @@ -230,7 +230,7 @@ Kernel::Superclass *Kernel::GetSuperclassByIdentifier(const Common::String &Iden /** * Returns the number of register superclasses */ -unsigned int Kernel::GetSuperclassCount() { +uint Kernel::GetSuperclassCount() { return _SuperclassList.size(); } @@ -240,10 +240,10 @@ unsigned int Kernel::GetSuperclassCount() { * @param Number The number of the superclass to return the identifier for. * It should be noted that the number should be between 0 und GetSuperclassCount() - 1. */ -Common::String Kernel::GetSuperclassIdentifier(unsigned int Number) { +Common::String Kernel::GetSuperclassIdentifier(uint Number) { if (Number > _SuperclassList.size()) return NULL; - unsigned int CurSuperclassOrd = 0; + uint CurSuperclassOrd = 0; Common::Array<Superclass *>::iterator Iter; for (Iter = _SuperclassList.begin(); Iter != _SuperclassList.end(); ++Iter) { if (CurSuperclassOrd == Number) @@ -260,7 +260,7 @@ Common::String Kernel::GetSuperclassIdentifier(unsigned int Number) { * @param SuperclassIdentifier The name of the superclass * z.B: "sfx", "gfx", "package" ... */ -unsigned int Kernel::GetServiceCount(const Common::String &SuperclassIdentifier) { +uint Kernel::GetServiceCount(const Common::String &SuperclassIdentifier) { Superclass *pSuperclass; if (!(pSuperclass = GetSuperclassByIdentifier(SuperclassIdentifier))) return 0; @@ -278,7 +278,7 @@ unsigned int Kernel::GetServiceCount(const Common::String &SuperclassIdentifier) * Hierbei ist zu beachten, dass der erste Service die Nummer 0 erhält. Number muss also eine Zahl zwischen * 0 und GetServiceCount() - 1 sein. */ -Common::String Kernel::GetServiceIdentifier(const Common::String &SuperclassIdentifier, unsigned int Number) { +Common::String Kernel::GetServiceIdentifier(const Common::String &SuperclassIdentifier, uint Number) { Superclass *pSuperclass; if (!(pSuperclass = GetSuperclassByIdentifier(SuperclassIdentifier))) return NULL; @@ -358,7 +358,7 @@ int Kernel::GetRandomNumber(int Min, int Max) { /** * Returns the elapsed time since startup in milliseconds */ -unsigned int Kernel::GetMilliTicks() { +uint Kernel::GetMilliTicks() { return g_system->getMillis(); } @@ -447,7 +447,7 @@ MoviePlayer *Kernel::GetFMV() { // ----------------------------------------------------------------------------- -void Kernel::Sleep(unsigned int Msecs) const { +void Kernel::Sleep(uint Msecs) const { g_system->delayMillis(Msecs); } diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index 76b092383d..d4e9bfea86 100644 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -126,7 +126,7 @@ public: /** * Returns the number of register superclasses */ - unsigned int GetSuperclassCount(); + uint GetSuperclassCount(); /** * Returns the name of a superclass with the specified index. @@ -134,14 +134,14 @@ public: * @param Number The number of the superclass to return the identifier for. * It should be noted that the number should be between 0 und GetSuperclassCount() - 1. */ - Common::String GetSuperclassIdentifier(unsigned int Number); + Common::String GetSuperclassIdentifier(uint Number); /** * Returns the number of services registered with a given superclass * @param SuperclassIdentifier The name of the superclass * z.B: "sfx", "gfx", "package" ... */ - unsigned int GetServiceCount(const Common::String &SuperclassIdentifier); + uint GetServiceCount(const Common::String &SuperclassIdentifier); /** * Gets the identifier of a service with a given superclass. @@ -152,12 +152,12 @@ public: * Hierbei ist zu beachten, dass der erste Service die Nummer 0 erhält. Number muss also eine Zahl zwischen * 0 und GetServiceCount() - 1 sein. */ - Common::String GetServiceIdentifier(const Common::String &SuperclassIdentifier, unsigned int Number); + Common::String GetServiceIdentifier(const Common::String &SuperclassIdentifier, uint Number); /** * Returns the elapsed time since startup in milliseconds */ - unsigned int GetMilliTicks(); + uint GetMilliTicks(); /** * Returns the elapsed time since the system start in microseconds. @@ -216,7 +216,7 @@ public: * Pauses for the specified amount of time * @param Msecs The amount of time in milliseconds */ - void Sleep(unsigned int Msecs) const; + void Sleep(uint Msecs) const; /** * Returns the singleton instance for the kernel @@ -264,7 +264,7 @@ private: class Superclass { private: Kernel *_pKernel; - unsigned int _ServiceCount; + uint _ServiceCount; Common::String _Identifier; Service *_ActiveService; Common::String _ActiveServiceName; @@ -273,7 +273,7 @@ private: Superclass(Kernel *pKernel, const Common::String &Identifier); ~Superclass(); - unsigned int GetServiceCount() const { + uint GetServiceCount() const { return _ServiceCount; } Common::String GetIdentifier() const { @@ -285,7 +285,7 @@ private: Common::String GetActiveServiceName() const { return _ActiveServiceName; } - Common::String GetServiceIdentifier(unsigned int Number); + Common::String GetServiceIdentifier(uint Number); Service *NewService(const Common::String &ServiceIdentifier); bool DisconnectService(); }; diff --git a/engines/sword25/kernel/kernel_script.cpp b/engines/sword25/kernel/kernel_script.cpp index f1c75bd691..16bb2d0636 100644 --- a/engines/sword25/kernel/kernel_script.cpp +++ b/engines/sword25/kernel/kernel_script.cpp @@ -87,7 +87,7 @@ static int GetSuperclassIdentifier(lua_State *L) { BS_ASSERT(pKernel); lua_pushstring(L, pKernel->GetSuperclassIdentifier( - static_cast<unsigned int>(luaL_checknumber(L, 1))).c_str()); + static_cast<uint>(luaL_checknumber(L, 1))).c_str()); return 1; } @@ -110,7 +110,7 @@ static int GetServiceIdentifier(lua_State *L) { BS_ASSERT(pKernel); lua_pushstring(L, pKernel->GetServiceIdentifier(luaL_checkstring(L, 1), - static_cast<unsigned int>(luaL_checknumber(L, 2))).c_str()); + static_cast<uint>(luaL_checknumber(L, 2))).c_str()); return 1; } @@ -153,7 +153,7 @@ static int StartService(lua_State *L) { static int Sleep(lua_State *L) { Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); - pKernel->Sleep(static_cast<unsigned int>(luaL_checknumber(L, 1) * 1000)); + pKernel->Sleep(static_cast<uint>(luaL_checknumber(L, 1) * 1000)); return 0; } @@ -563,7 +563,7 @@ static int SetMaxMemoryUsage(lua_State *L) { ResourceManager *pResource = pKernel->GetResourceManager(); BS_ASSERT(pResource); - pResource->SetMaxMemoryUsage(static_cast<unsigned int>(lua_tonumber(L, 1))); + pResource->SetMaxMemoryUsage(static_cast<uint>(lua_tonumber(L, 1))); return 0; } @@ -655,7 +655,7 @@ static int GetSlotCount(lua_State *L) { static int IsSlotOccupied(lua_State *L) { lua_pushbooleancpp(L, PersistenceService::GetInstance().IsSlotOccupied( - static_cast<unsigned int>(luaL_checknumber(L, 1)) - 1)); + static_cast<uint>(luaL_checknumber(L, 1)) - 1)); return 1; } @@ -670,7 +670,7 @@ static int GetSavegameDirectory(lua_State *L) { static int IsSavegameCompatible(lua_State *L) { lua_pushbooleancpp(L, PersistenceService::GetInstance().IsSavegameCompatible( - static_cast<unsigned int>(luaL_checknumber(L, 1)) - 1)); + static_cast<uint>(luaL_checknumber(L, 1)) - 1)); return 1; } @@ -678,28 +678,28 @@ static int IsSavegameCompatible(lua_State *L) { static int GetSavegameDescription(lua_State *L) { lua_pushstring(L, PersistenceService::GetInstance().GetSavegameDescription( - static_cast<unsigned int>(luaL_checknumber(L, 1)) - 1).c_str()); + static_cast<uint>(luaL_checknumber(L, 1)) - 1).c_str()); return 1; } // ----------------------------------------------------------------------------- static int GetSavegameFilename(lua_State *L) { - lua_pushstring(L, PersistenceService::GetInstance().GetSavegameFilename(static_cast<unsigned int>(luaL_checknumber(L, 1)) - 1).c_str()); + lua_pushstring(L, PersistenceService::GetInstance().GetSavegameFilename(static_cast<uint>(luaL_checknumber(L, 1)) - 1).c_str()); return 1; } // ----------------------------------------------------------------------------- static int LoadGame(lua_State *L) { - lua_pushbooleancpp(L, PersistenceService::GetInstance().LoadGame(static_cast<unsigned int>(luaL_checknumber(L, 1)) - 1)); + lua_pushbooleancpp(L, PersistenceService::GetInstance().LoadGame(static_cast<uint>(luaL_checknumber(L, 1)) - 1)); return 1; } // ----------------------------------------------------------------------------- static int SaveGame(lua_State *L) { - lua_pushbooleancpp(L, PersistenceService::GetInstance().SaveGame(static_cast<unsigned int>(luaL_checknumber(L, 1)) - 1, luaL_checkstring(L, 2))); + lua_pushbooleancpp(L, PersistenceService::GetInstance().SaveGame(static_cast<uint>(luaL_checknumber(L, 1)) - 1, luaL_checkstring(L, 2))); return 1; } diff --git a/engines/sword25/kernel/memleaks.cpp b/engines/sword25/kernel/memleaks.cpp index e6ba1df608..ef0a6aba81 100644 --- a/engines/sword25/kernel/memleaks.cpp +++ b/engines/sword25/kernel/memleaks.cpp @@ -54,17 +54,17 @@ #include <string.h> typedef struct { - unsigned int address; - unsigned int size; + uint address; + uint size; std::string file; - unsigned int line; + uint line; } ALLOC_INFO; static const char *MEMLEAK_LOG_FILE = "memory_leaks.txt"; -static const unsigned int BUCKET_COUNT = 1021; +static const uint BUCKET_COUNT = 1021; std::vector< std::vector<ALLOC_INFO> > TrackData(BUCKET_COUNT); -static unsigned int TotalSize = 0; +static uint TotalSize = 0; // Diese Klasse stellt sicher, dass beim Programmende, das Memory-Leak Log geschrieben wird. static class LeakDumper { @@ -102,7 +102,7 @@ void DumpUnfreed(const char *OutputFilename) { fclose(Log); } -void AddTrack(unsigned int addr, unsigned int asize, const char *fname, unsigned int lnum) { +void AddTrack(uint addr, uint asize, const char *fname, uint lnum) { std::vector<ALLOC_INFO> & CurBucket = TrackData[(addr >> 3) % BUCKET_COUNT]; ALLOC_INFO Info; Info.address = addr; @@ -114,7 +114,7 @@ void AddTrack(unsigned int addr, unsigned int asize, const char *fname, unsign TotalSize += asize; } -void RemoveTrack(unsigned int addr) { +void RemoveTrack(uint addr) { if (addr != 0 && TrackData.size() == BUCKET_COUNT) { std::vector<ALLOC_INFO> & CurBucket = TrackData[(addr >> 3) % BUCKET_COUNT]; std::vector<ALLOC_INFO>::iterator Iter = CurBucket.begin(); diff --git a/engines/sword25/kernel/memleaks.h b/engines/sword25/kernel/memleaks.h index aff61338f8..825edcece9 100644 --- a/engines/sword25/kernel/memleaks.h +++ b/engines/sword25/kernel/memleaks.h @@ -44,22 +44,22 @@ #include <malloc.h> void DumpUnfreed(const char *OutputFilename); -void AddTrack(unsigned int addr, unsigned int asize, const char *fname, unsigned int lnum); -void RemoveTrack(unsigned int addr); +void AddTrack(uint addr, uint asize, const char *fname, uint lnum); +void RemoveTrack(uint addr); -inline void *__cdecl operator new(unsigned int size, const char *file, int line) { +inline void *__cdecl operator new(uint size, const char *file, int line) { void *ptr = malloc(size); - if (ptr) AddTrack((unsigned int)ptr, size, file, line); + if (ptr) AddTrack((uint)ptr, size, file, line); return(ptr); }; inline void __cdecl operator delete(void *p) { - RemoveTrack((unsigned int)p); + RemoveTrack((uint)p); free(p); }; inline void __cdecl operator delete[](void *p) { - RemoveTrack((unsigned int)p); + RemoveTrack((uint)p); free(p); }; diff --git a/engines/sword25/kernel/objectregistry.h b/engines/sword25/kernel/objectregistry.h index d6a53baf4d..3e80ec9321 100644 --- a/engines/sword25/kernel/objectregistry.h +++ b/engines/sword25/kernel/objectregistry.h @@ -58,7 +58,7 @@ public: // ------------------------------------------------------------------------- - unsigned int RegisterObject(T *ObjectPtr) { + uint RegisterObject(T *ObjectPtr) { // Null-Pointer können nicht registriert werden. if (ObjectPtr == 0) { LogErrorLn("Cannot register a null pointer."); @@ -66,7 +66,7 @@ public: } // Falls das Objekt bereits registriert wurde, wird eine Warnung ausgeben und das Handle zurückgeben. - unsigned int Handle = FindHandleByPtr(ObjectPtr); + uint Handle = FindHandleByPtr(ObjectPtr); if (Handle != 0) { LogWarningLn("Tried to register a object that was already registered."); return Handle; @@ -82,7 +82,7 @@ public: // ----------------------------------------------------------------------------- - unsigned int RegisterObject(T *ObjectPtr, unsigned int Handle) { + uint RegisterObject(T *ObjectPtr, uint Handle) { // Null-Pointer und Null-Handle können nicht registriert werden. if (ObjectPtr == 0 || Handle == 0) { LogErrorLn("Cannot register a null pointer or a null handle."); @@ -90,7 +90,7 @@ public: } // Falls das Objekt bereits registriert wurde, wird ein Fehler ausgegeben und 0 zurückgeben. - unsigned int HandleTest = FindHandleByPtr(ObjectPtr); + uint HandleTest = FindHandleByPtr(ObjectPtr); if (HandleTest != 0) { LogErrorLn("Tried to register a object that was already registered."); return 0; @@ -116,7 +116,7 @@ public: // ----------------------------------------------------------------------------- void DeregisterObject(T *ObjectPtr) { - unsigned int Handle = FindHandleByPtr(ObjectPtr); + uint Handle = FindHandleByPtr(ObjectPtr); if (Handle != 0) { // Registriertes Objekt aus beiden Maps entfernen. @@ -129,7 +129,7 @@ public: // ----------------------------------------------------------------------------- - T *ResolveHandle(unsigned int Handle) { + T *ResolveHandle(uint Handle) { // Zum Handle gehöriges Objekt in der Hash-Map finden. T *ObjectPtr = FindPtrByHandle(Handle); @@ -139,9 +139,9 @@ public: // ----------------------------------------------------------------------------- - unsigned int ResolvePtr(T *ObjectPtr) { + uint ResolvePtr(T *ObjectPtr) { // Zum Pointer gehöriges Handle in der Hash-Map finden. - unsigned int Handle = FindHandleByPtr(ObjectPtr); + uint Handle = FindHandleByPtr(ObjectPtr); // Handle zurückgeben. Im Fehlerfall ist dieses 0. return Handle; @@ -160,16 +160,16 @@ protected: } }; - typedef Common::HashMap<unsigned int, T *> HANDLE2PTR_MAP; - typedef Common::HashMap<T *, unsigned int, ClassPointer_Hash, ClassPointer_EqualTo> PTR2HANDLE_MAP; + typedef Common::HashMap<uint, T *> HANDLE2PTR_MAP; + typedef Common::HashMap<T *, uint, ClassPointer_Hash, ClassPointer_EqualTo> PTR2HANDLE_MAP; HANDLE2PTR_MAP m_Handle2PtrMap; PTR2HANDLE_MAP m_Ptr2HandleMap; - unsigned int m_NextHandle; + uint m_NextHandle; // ----------------------------------------------------------------------------- - T *FindPtrByHandle(unsigned int Handle) { + T *FindPtrByHandle(uint Handle) { // Zum Handle gehörigen Pointer finden. typename HANDLE2PTR_MAP::const_iterator it = m_Handle2PtrMap.find(Handle); @@ -179,7 +179,7 @@ protected: // ----------------------------------------------------------------------------- - unsigned int FindHandleByPtr(T *ObjectPtr) { + uint FindHandleByPtr(T *ObjectPtr) { // Zum Pointer gehöriges Handle finden. typename PTR2HANDLE_MAP::const_iterator it = m_Ptr2HandleMap.find(ObjectPtr); diff --git a/engines/sword25/kernel/outputpersistenceblock.cpp b/engines/sword25/kernel/outputpersistenceblock.cpp index 9965fdb9d5..0394aa1808 100644 --- a/engines/sword25/kernel/outputpersistenceblock.cpp +++ b/engines/sword25/kernel/outputpersistenceblock.cpp @@ -45,7 +45,7 @@ // ----------------------------------------------------------------------------- namespace { -const unsigned int INITIAL_BUFFER_SIZE = 1024 * 64; +const uint INITIAL_BUFFER_SIZE = 1024 * 64; } namespace Sword25 { @@ -70,7 +70,7 @@ void OutputPersistenceBlock::Write(signed int Value) { // ----------------------------------------------------------------------------- -void OutputPersistenceBlock::Write(unsigned int Value) { +void OutputPersistenceBlock::Write(uint Value) { WriteMarker(UINT_MARKER); Value = ConvertEndianessFromSystemToStorage(Value); RawWrite(&Value, sizeof(Value)); @@ -89,7 +89,7 @@ void OutputPersistenceBlock::Write(float Value) { void OutputPersistenceBlock::Write(bool Value) { WriteMarker(BOOL_MARKER); - unsigned int UIntBool = Value ? 1 : 0; + uint UIntBool = Value ? 1 : 0; UIntBool = ConvertEndianessFromSystemToStorage(UIntBool); RawWrite(&UIntBool, sizeof(UIntBool)); } @@ -122,7 +122,7 @@ void OutputPersistenceBlock::WriteMarker(byte Marker) { void OutputPersistenceBlock::RawWrite(const void *DataPtr, size_t Size) { if (Size > 0) { - unsigned int OldSize = m_Data.size(); + uint OldSize = m_Data.size(); m_Data.resize(OldSize + Size); memcpy(&m_Data[OldSize], DataPtr, Size); } diff --git a/engines/sword25/kernel/outputpersistenceblock.h b/engines/sword25/kernel/outputpersistenceblock.h index bc5bfad605..fab0552d31 100644 --- a/engines/sword25/kernel/outputpersistenceblock.h +++ b/engines/sword25/kernel/outputpersistenceblock.h @@ -53,7 +53,7 @@ public: OutputPersistenceBlock(); void Write(signed int Value); - void Write(unsigned int Value); + void Write(uint Value); void Write(float Value); void Write(bool Value); void Write(const Common::String &String); @@ -62,7 +62,7 @@ public: const void *GetData() const { return &m_Data[0]; } - unsigned int GetDataSize() const { + uint GetDataSize() const { return m_Data.size(); } diff --git a/engines/sword25/kernel/persistenceblock.h b/engines/sword25/kernel/persistenceblock.h index 32936bd222..1f043aa68a 100644 --- a/engines/sword25/kernel/persistenceblock.h +++ b/engines/sword25/kernel/persistenceblock.h @@ -49,20 +49,20 @@ namespace Sword25 { class PersistenceBlock { public: - static unsigned int GetSInt32Size() { + static uint GetSInt32Size() { return sizeof(signed int) + sizeof(byte); } - static unsigned int GetUInt32Size() { - return sizeof(unsigned int) + sizeof(byte); + static uint GetUInt32Size() { + return sizeof(uint) + sizeof(byte); } - static unsigned int GetFloat32Size() { + static uint GetFloat32Size() { return sizeof(float) + sizeof(byte); } - static unsigned int GetBoolSize() { + static uint GetBoolSize() { return sizeof(byte) + sizeof(byte); } - static unsigned int GetStringSize(const Common::String &String) { - return static_cast<unsigned int>(sizeof(unsigned int) + String.size() + sizeof(byte)); + static uint GetStringSize(const Common::String &String) { + return static_cast<uint>(sizeof(uint) + String.size() + sizeof(byte)); } protected: @@ -97,7 +97,7 @@ protected: private: static bool IsBigEndian() { - unsigned int Dummy = 1; + uint Dummy = 1; byte *DummyPtr = reinterpret_cast<byte *>(&Dummy); return DummyPtr[0] == 0; } @@ -124,7 +124,7 @@ private: #define CTASSERT(ex) typedef char ctassert_type[(ex) ? 1 : -1] CTASSERT(sizeof(byte) == 1); CTASSERT(sizeof(signed int) == 4); -CTASSERT(sizeof(unsigned int) == 4); +CTASSERT(sizeof(uint) == 4); CTASSERT(sizeof(float) == 4); #undef CTASSERT diff --git a/engines/sword25/kernel/persistenceservice.cpp b/engines/sword25/kernel/persistenceservice.cpp index acd2d08f9f..696f85459e 100644 --- a/engines/sword25/kernel/persistenceservice.cpp +++ b/engines/sword25/kernel/persistenceservice.cpp @@ -59,13 +59,13 @@ namespace Sword25 { const char *SAVEGAME_EXTENSION = ".b25s"; const char *SAVEGAME_DIRECTORY = "saves"; const char *FILE_MARKER = "BS25SAVEGAME"; -const unsigned int SLOT_COUNT = 18; -const unsigned int FILE_COPY_BUFFER_SIZE = 1024 * 10; +const uint SLOT_COUNT = 18; +const uint FILE_COPY_BUFFER_SIZE = 1024 * 10; const char *VERSIONID = "1"; // ------------------------------------------------------------------------- -Common::String GenerateSavegameFilename(unsigned int SlotID) { +Common::String GenerateSavegameFilename(uint SlotID) { Common::String oss; oss += SlotID; oss += SAVEGAME_EXTENSION; @@ -74,7 +74,7 @@ Common::String GenerateSavegameFilename(unsigned int SlotID) { // ------------------------------------------------------------------------- -Common::String GenerateSavegamePath(unsigned int SlotID) { +Common::String GenerateSavegamePath(uint SlotID) { Common::String oss; oss = PersistenceService::GetSavegameDirectory(); oss += FileSystemUtil::GetInstance().GetPathSeparator(); @@ -124,9 +124,9 @@ struct SavegameInformation { bool IsCompatible; Common::String Description; Common::String Filename; - unsigned int GamedataLength; - unsigned int GamedataOffset; - unsigned int GamedataUncompressedLength; + uint GamedataLength; + uint GamedataOffset; + uint GamedataUncompressedLength; SavegameInformation() { Clear(); @@ -156,12 +156,12 @@ struct PersistenceService::Impl { void ReloadSlots() { // Über alle Spielstanddateien iterieren und deren Infos einlesen. - for (unsigned int i = 0; i < SLOT_COUNT; ++i) { + for (uint i = 0; i < SLOT_COUNT; ++i) { ReadSlotSavegameInformation(i); } } - void ReadSlotSavegameInformation(unsigned int SlotID) { + void ReadSlotSavegameInformation(uint SlotID) { // Aktuelle Slotinformationen in den Ausgangszustand versetzen, er wird im Folgenden neu gefüllt. SavegameInformation &CurSavegameInfo = m_SavegameInformations[SlotID]; CurSavegameInfo.Clear(); @@ -194,7 +194,7 @@ struct PersistenceService::Impl { CurSavegameInfo.Description = FormatTimestamp(FileSystemUtil::GetInstance().GetFileTime(Filename)); // Den Offset zu den gespeicherten Spieldaten innerhalb der Datei speichern. // Dieses entspricht der aktuellen Position + 1, da nach der letzten Headerinformation noch ein Leerzeichen als trenner folgt. - CurSavegameInfo.GamedataOffset = static_cast<unsigned int>(File->pos()) + 1; + CurSavegameInfo.GamedataOffset = static_cast<uint>(File->pos()) + 1; } delete File; @@ -233,7 +233,7 @@ void PersistenceService::ReloadSlots() { // ----------------------------------------------------------------------------- -unsigned int PersistenceService::GetSlotCount() { +uint PersistenceService::GetSlotCount() { return SLOT_COUNT; } @@ -246,7 +246,7 @@ Common::String PersistenceService::GetSavegameDirectory() { // ----------------------------------------------------------------------------- namespace { -bool CheckSlotID(unsigned int SlotID) { +bool CheckSlotID(uint SlotID) { // Überprüfen, ob die Slot-ID zulässig ist. if (SlotID >= SLOT_COUNT) { BS_LOG_ERRORLN("Tried to access an invalid slot (%d). Only slot ids from 0 to %d are allowed.", SlotID, SLOT_COUNT - 1); @@ -259,21 +259,21 @@ bool CheckSlotID(unsigned int SlotID) { // ----------------------------------------------------------------------------- -bool PersistenceService::IsSlotOccupied(unsigned int SlotID) { +bool PersistenceService::IsSlotOccupied(uint SlotID) { if (!CheckSlotID(SlotID)) return false; return m_impl->m_SavegameInformations[SlotID].IsOccupied; } // ----------------------------------------------------------------------------- -bool PersistenceService::IsSavegameCompatible(unsigned int SlotID) { +bool PersistenceService::IsSavegameCompatible(uint SlotID) { if (!CheckSlotID(SlotID)) return false; return m_impl->m_SavegameInformations[SlotID].IsCompatible; } // ----------------------------------------------------------------------------- -Common::String &PersistenceService::GetSavegameDescription(unsigned int SlotID) { +Common::String &PersistenceService::GetSavegameDescription(uint SlotID) { static Common::String EmptyString; if (!CheckSlotID(SlotID)) return EmptyString; return m_impl->m_SavegameInformations[SlotID].Description; @@ -281,7 +281,7 @@ Common::String &PersistenceService::GetSavegameDescription(unsigned int SlotID) // ----------------------------------------------------------------------------- -Common::String &PersistenceService::GetSavegameFilename(unsigned int SlotID) { +Common::String &PersistenceService::GetSavegameFilename(uint SlotID) { static Common::String EmptyString; if (!CheckSlotID(SlotID)) return EmptyString; return m_impl->m_SavegameInformations[SlotID].Filename; @@ -289,7 +289,7 @@ Common::String &PersistenceService::GetSavegameFilename(unsigned int SlotID) { // ----------------------------------------------------------------------------- -bool PersistenceService::SaveGame(unsigned int SlotID, const Common::String &ScreenshotFilename) { +bool PersistenceService::SaveGame(uint SlotID, const Common::String &ScreenshotFilename) { // Überprüfen, ob die Slot-ID zulässig ist. if (SlotID >= SLOT_COUNT) { BS_LOG_ERRORLN("Tried to save to an invalid slot (%d). Only slot ids form 0 to %d are allowed.", SlotID, SLOT_COUNT - 1); @@ -376,7 +376,7 @@ bool PersistenceService::SaveGame(unsigned int SlotID, const Common::String &Scr // ----------------------------------------------------------------------------- -bool PersistenceService::LoadGame(unsigned int SlotID) { +bool PersistenceService::LoadGame(uint SlotID) { Common::SaveFileManager *sfm = g_system->getSavefileManager(); Common::InSaveFile *File; diff --git a/engines/sword25/kernel/persistenceservice.h b/engines/sword25/kernel/persistenceservice.h index 06d5422d46..d14185eac2 100644 --- a/engines/sword25/kernel/persistenceservice.h +++ b/engines/sword25/kernel/persistenceservice.h @@ -62,17 +62,17 @@ public: // Interface // ----------------------------------------------------------------------------- - static unsigned int GetSlotCount(); + static uint GetSlotCount(); static Common::String GetSavegameDirectory(); void ReloadSlots(); - bool IsSlotOccupied(unsigned int SlotID); - bool IsSavegameCompatible(unsigned int SlotID); - Common::String &GetSavegameDescription(unsigned int SlotID); - Common::String &GetSavegameFilename(unsigned int SlotID); + bool IsSlotOccupied(uint SlotID); + bool IsSavegameCompatible(uint SlotID); + Common::String &GetSavegameDescription(uint SlotID); + Common::String &GetSavegameFilename(uint SlotID); - bool SaveGame(unsigned int SlotID, const Common::String &ScreenshotFilename); - bool LoadGame(unsigned int SlotID); + bool SaveGame(uint SlotID, const Common::String &ScreenshotFilename); + bool LoadGame(uint SlotID); private: struct Impl; diff --git a/engines/sword25/kernel/resmanager.cpp b/engines/sword25/kernel/resmanager.cpp index b6c70cd0ad..59f1034704 100644 --- a/engines/sword25/kernel/resmanager.cpp +++ b/engines/sword25/kernel/resmanager.cpp @@ -223,7 +223,7 @@ void ResourceManager::MoveToFront(Resource *pResource) { */ Resource *ResourceManager::LoadResource(const Common::String &FileName) { // ResourceService finden, der die Resource laden kann. - for (unsigned int i = 0; i < m_ResourceServices.size(); ++i) { + for (uint i = 0; i < m_ResourceServices.size(); ++i) { if (m_ResourceServices[i]->CanLoadResource(FileName)) { // If more memory is desired, memory must be released DeleteResourcesIfNecessary(); @@ -328,7 +328,7 @@ void ResourceManager::DumpLockedResources() { * as a guideline, and not as a fixed boundary. It is not guaranteed not to be exceeded; * the whole game engine may still use more memory than any amount specified. */ -void ResourceManager::SetMaxMemoryUsage(unsigned int MaxMemoryUsage) { +void ResourceManager::SetMaxMemoryUsage(uint MaxMemoryUsage) { m_MaxMemoryUsage = MaxMemoryUsage; DeleteResourcesIfNecessary(); } diff --git a/engines/sword25/kernel/resmanager.h b/engines/sword25/kernel/resmanager.h index 47c920ce6b..7000005b08 100644 --- a/engines/sword25/kernel/resmanager.h +++ b/engines/sword25/kernel/resmanager.h @@ -104,7 +104,7 @@ public: * as a guideline, and not as a fixed boundary. It is not guaranteed not to be exceeded; * the whole game engine may still use more memory than any amount specified. */ - void SetMaxMemoryUsage(unsigned int MaxMemoryUsage); + void SetMaxMemoryUsage(uint MaxMemoryUsage); /** * Specifies whether a warning is written to the log when a cache miss occurs. @@ -181,7 +181,7 @@ private: void DeleteResourcesIfNecessary(); Kernel *m_KernelPtr; - unsigned int m_MaxMemoryUsage; + uint m_MaxMemoryUsage; Common::Array<ResourceService *> m_ResourceServices; Common::List<Resource *> m_Resources; Common::List<Resource *> m_ResourceHashTable[HASH_TABLE_BUCKETS]; diff --git a/engines/sword25/kernel/resource.h b/engines/sword25/kernel/resource.h index 7d696ec198..a78129666e 100644 --- a/engines/sword25/kernel/resource.h +++ b/engines/sword25/kernel/resource.h @@ -91,14 +91,14 @@ public: /** * Returns the hash of the filename of a resource */ - unsigned int GetFileNameHash() const { + uint GetFileNameHash() const { return _FileNameHash; } /** * Returns a resource's type */ - unsigned int GetType() const { + uint GetType() const { return _Type; } @@ -107,9 +107,9 @@ protected: private: Common::String _FileName; ///< The absolute filename - unsigned int _FileNameHash; ///< The hash value of the filename - unsigned int _RefCount; ///< The number of locks - unsigned int _Type; ///< The type of the resource + uint _FileNameHash; ///< The hash value of the filename + uint _RefCount; ///< The number of locks + uint _Type; ///< The type of the resource Common::List<Resource *>::iterator _Iterator; ///< Points to the resource position in the LRU list }; diff --git a/engines/sword25/kernel/service_ids.h b/engines/sword25/kernel/service_ids.h index ee8221b69a..9aafbd3e1d 100644 --- a/engines/sword25/kernel/service_ids.h +++ b/engines/sword25/kernel/service_ids.h @@ -73,7 +73,7 @@ const BS_ServiceInfo BS_SERVICE_TABLE[] = { BS_ServiceInfo("fmv", "oggtheora", OggTheora_CreateObject), }; -const unsigned int BS_SERVICE_COUNT = sizeof(BS_SERVICE_TABLE) / sizeof(BS_ServiceInfo); +const uint BS_SERVICE_COUNT = sizeof(BS_SERVICE_TABLE) / sizeof(BS_ServiceInfo); } // End of namespace Sword25 diff --git a/engines/sword25/kernel/string.h b/engines/sword25/kernel/string.h index 7ff1d75f7b..b701e2312b 100644 --- a/engines/sword25/kernel/string.h +++ b/engines/sword25/kernel/string.h @@ -39,10 +39,10 @@ namespace BS_String { -inline unsigned int GetHash(const Common::String &Str) { - unsigned int Result = 0; +inline uint GetHash(const Common::String &Str) { + uint Result = 0; - for (unsigned int i = 0; i < Str.size(); i++) + for (uint i = 0; i < Str.size(); i++) Result = ((Result << 5) - Result) + Str[i]; return Result; |