From 3f9ff1791a5034bf74d460e38282c9bcfe54b6db Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Tue, 26 Jun 2012 14:28:53 +0200 Subject: WINTERMUTE: Rename FuncName->funcName in the Sys-classes. --- engines/wintermute/Ad/AdGame.cpp | 4 +- engines/wintermute/Base/BGame.cpp | 22 +++---- engines/wintermute/Base/BPersistMgr.cpp | 4 +- engines/wintermute/Base/BScriptable.cpp | 2 +- engines/wintermute/Base/PartParticle.cpp | 10 +-- engines/wintermute/Base/scriptables/ScValue.cpp | 2 +- engines/wintermute/PlatformSDL.cpp | 2 +- engines/wintermute/Sys/SysClass.cpp | 58 ++++++++--------- engines/wintermute/Sys/SysClass.h | 36 +++++------ engines/wintermute/Sys/SysClassRegistry.cpp | 82 ++++++++++++------------- engines/wintermute/Sys/SysClassRegistry.h | 30 ++++----- engines/wintermute/Sys/SysInstance.cpp | 6 +- engines/wintermute/Sys/SysInstance.h | 14 ++--- engines/wintermute/UI/UIObject.cpp | 2 +- engines/wintermute/persistent.cpp | 2 +- engines/wintermute/persistent.h | 16 ++--- 16 files changed, 146 insertions(+), 146 deletions(-) (limited to 'engines/wintermute') diff --git a/engines/wintermute/Ad/AdGame.cpp b/engines/wintermute/Ad/AdGame.cpp index dd16e2c0f0..7758737359 100644 --- a/engines/wintermute/Ad/AdGame.cpp +++ b/engines/wintermute/Ad/AdGame.cpp @@ -1316,14 +1316,14 @@ HRESULT CAdGame::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// HRESULT CAdGame::LoadGame(const char *Filename) { HRESULT ret = CBGame::LoadGame(Filename); - if (SUCCEEDED(ret)) CSysClassRegistry::GetInstance()->EnumInstances(AfterLoadRegion, "CAdRegion", NULL); + if (SUCCEEDED(ret)) CSysClassRegistry::getInstance()->enumInstances(AfterLoadRegion, "CAdRegion", NULL); return ret; } ////////////////////////////////////////////////////////////////////////// HRESULT CAdGame::InitAfterLoad() { CBGame::InitAfterLoad(); - CSysClassRegistry::GetInstance()->EnumInstances(AfterLoadScene, "CAdScene", NULL); + CSysClassRegistry::getInstance()->enumInstances(AfterLoadScene, "CAdScene", NULL); return S_OK; } diff --git a/engines/wintermute/Base/BGame.cpp b/engines/wintermute/Base/BGame.cpp index 8a31e8019b..1321d31c67 100644 --- a/engines/wintermute/Base/BGame.cpp +++ b/engines/wintermute/Base/BGame.cpp @@ -2845,7 +2845,7 @@ HRESULT CBGame::UnregisterObject(CBObject *Object) { for (i = 0; i < _regObjects.GetSize(); i++) { if (_regObjects[i] == Object) { _regObjects.RemoveAt(i); - if (!_loadInProgress) CSysClassRegistry::GetInstance()->EnumInstances(InvalidateValues, "CScValue", (void *)Object); + if (!_loadInProgress) CSysClassRegistry::getInstance()->enumInstances(InvalidateValues, "CScValue", (void *)Object); delete Object; return S_OK; } @@ -3254,8 +3254,8 @@ HRESULT CBGame::SaveGame(int slot, const char *desc, bool quickSave) { } } - if (FAILED(ret = CSysClassRegistry::GetInstance()->SaveTable(Game, pm, quickSave))) goto save_finish; - if (FAILED(ret = CSysClassRegistry::GetInstance()->SaveInstances(Game, pm, quickSave))) goto save_finish; + if (FAILED(ret = CSysClassRegistry::getInstance()->saveTable(Game, pm, quickSave))) goto save_finish; + if (FAILED(ret = CSysClassRegistry::getInstance()->saveInstances(Game, pm, quickSave))) goto save_finish; if (FAILED(ret = pm->saveFile(Filename))) goto save_finish; _registry->WriteInt("System", "MostRecentSaveSlot", slot); @@ -3312,8 +3312,8 @@ HRESULT CBGame::LoadGame(const char *Filename) { if (FAILED(ret = pm->initLoad(Filename))) goto load_finish; //if(FAILED(ret = cleanup())) goto load_finish; - if (FAILED(ret = CSysClassRegistry::GetInstance()->LoadTable(Game, pm))) goto load_finish; - if (FAILED(ret = CSysClassRegistry::GetInstance()->LoadInstances(Game, pm))) goto load_finish; + if (FAILED(ret = CSysClassRegistry::getInstance()->loadTable(Game, pm))) goto load_finish; + if (FAILED(ret = CSysClassRegistry::getInstance()->loadInstances(Game, pm))) goto load_finish; // data initialization after load InitAfterLoad(); @@ -3343,11 +3343,11 @@ load_finish: ////////////////////////////////////////////////////////////////////////// HRESULT CBGame::InitAfterLoad() { - CSysClassRegistry::GetInstance()->EnumInstances(AfterLoadRegion, "CBRegion", NULL); - CSysClassRegistry::GetInstance()->EnumInstances(AfterLoadSubFrame, "CBSubFrame", NULL); - CSysClassRegistry::GetInstance()->EnumInstances(AfterLoadSound, "CBSound", NULL); - CSysClassRegistry::GetInstance()->EnumInstances(AfterLoadFont, "CBFontTT", NULL); - CSysClassRegistry::GetInstance()->EnumInstances(AfterLoadScript, "CScScript", NULL); + CSysClassRegistry::getInstance()->enumInstances(AfterLoadRegion, "CBRegion", NULL); + CSysClassRegistry::getInstance()->enumInstances(AfterLoadSubFrame, "CBSubFrame", NULL); + CSysClassRegistry::getInstance()->enumInstances(AfterLoadSound, "CBSound", NULL); + CSysClassRegistry::getInstance()->enumInstances(AfterLoadFont, "CBFontTT", NULL); + CSysClassRegistry::getInstance()->enumInstances(AfterLoadScript, "CScScript", NULL); _scEngine->RefreshScriptBreakpoints(); if (_store) _store->afterLoad(); @@ -4177,7 +4177,7 @@ void CBGame::DEBUG_DumpClassRegistry() { Common::DumpFile *f = new Common::DumpFile; f->open("zz_class_reg_dump.log"); - CSysClassRegistry::GetInstance()->DumpClasses(f); + CSysClassRegistry::getInstance()->dumpClasses(f); f->close(); delete f; diff --git a/engines/wintermute/Base/BPersistMgr.cpp b/engines/wintermute/Base/BPersistMgr.cpp index 6db1fb5cd5..e5479ea8f6 100644 --- a/engines/wintermute/Base/BPersistMgr.cpp +++ b/engines/wintermute/Base/BPersistMgr.cpp @@ -720,7 +720,7 @@ HRESULT CBPersistMgr::transfer(const char *name, void *val) { int ClassID = -1, InstanceID = -1; if (_saving) { - CSysClassRegistry::GetInstance()->GetPointerID(*(void **)val, &ClassID, &InstanceID); + CSysClassRegistry::getInstance()->getPointerID(*(void **)val, &ClassID, &InstanceID); if (*(void **)val != NULL && (ClassID == -1 || InstanceID == -1)) { Game->LOG(0, "Warning: invalid instance '%s'", name); } @@ -731,7 +731,7 @@ HRESULT CBPersistMgr::transfer(const char *name, void *val) { ClassID = _loadStream->readUint32LE(); InstanceID = _loadStream->readUint32LE(); - *(void **)val = CSysClassRegistry::GetInstance()->IDToPointer(ClassID, InstanceID); + *(void **)val = CSysClassRegistry::getInstance()->idToPointer(ClassID, InstanceID); } return S_OK; diff --git a/engines/wintermute/Base/BScriptable.cpp b/engines/wintermute/Base/BScriptable.cpp index d75f6c1994..aa2bb7059c 100644 --- a/engines/wintermute/Base/BScriptable.cpp +++ b/engines/wintermute/Base/BScriptable.cpp @@ -177,7 +177,7 @@ CScScript *CBScriptable::invokeMethodThread(const char *methodName) { // IWmeDebugObject ////////////////////////////////////////////////////////////////////////// const char *CBScriptable::DbgGetNativeClass() { - return GetClassName(); + return getClassName(); } ////////////////////////////////////////////////////////////////////////// diff --git a/engines/wintermute/Base/PartParticle.cpp b/engines/wintermute/Base/PartParticle.cpp index 3443bcbb71..85966eb510 100644 --- a/engines/wintermute/Base/PartParticle.cpp +++ b/engines/wintermute/Base/PartParticle.cpp @@ -81,15 +81,15 @@ HRESULT CPartParticle::setSprite(const char *Filename) { delete _sprite; _sprite = NULL; - CSysClassRegistry::GetInstance()->_disabled = true; + CSysClassRegistry::getInstance()->_disabled = true; _sprite = new CBSprite(Game, Game); if (_sprite && SUCCEEDED(_sprite->loadFile(Filename))) { - CSysClassRegistry::GetInstance()->_disabled = false; + CSysClassRegistry::getInstance()->_disabled = false; return S_OK; } else { delete _sprite; _sprite = NULL; - CSysClassRegistry::GetInstance()->_disabled = false; + CSysClassRegistry::getInstance()->_disabled = false; return E_FAIL; } @@ -242,9 +242,9 @@ HRESULT CPartParticle::persist(CBPersistMgr *persistMgr) { } else { char *Filename; persistMgr->transfer(TMEMBER(Filename)); - CSysClassRegistry::GetInstance()->_disabled = true; + CSysClassRegistry::getInstance()->_disabled = true; setSprite(Filename); - CSysClassRegistry::GetInstance()->_disabled = false; + CSysClassRegistry::getInstance()->_disabled = false; delete[] Filename; Filename = NULL; } diff --git a/engines/wintermute/Base/scriptables/ScValue.cpp b/engines/wintermute/Base/scriptables/ScValue.cpp index 707fda0984..eab345f393 100644 --- a/engines/wintermute/Base/scriptables/ScValue.cpp +++ b/engines/wintermute/Base/scriptables/ScValue.cpp @@ -822,7 +822,7 @@ int CScValue::Compare(CScValue *Val1, CScValue *Val2) { // both natives? if (Val1->IsNative() && Val2->IsNative()) { // same class? - if (strcmp(Val1->GetNative()->GetClassName(), Val2->GetNative()->GetClassName()) == 0) { + if (strcmp(Val1->GetNative()->getClassName(), Val2->GetNative()->getClassName()) == 0) { return Val1->GetNative()->scCompare(Val2->GetNative()); } else return strcmp(Val1->GetString(), Val2->GetString()); } diff --git a/engines/wintermute/PlatformSDL.cpp b/engines/wintermute/PlatformSDL.cpp index 9b4c8e7e04..6f330e35e8 100644 --- a/engines/wintermute/PlatformSDL.cpp +++ b/engines/wintermute/PlatformSDL.cpp @@ -93,7 +93,7 @@ void CBPlatform::HandleEvent(Common::Event *event) { GetCursorPos(&p); Game->SetActiveObject(renderer->GetObjectAt(p.x, p.y)); - if (Game->_activeObject != NULL && strcmp(Game->_activeObject->GetClassName(), "CUIButton") == 0) { + if (Game->_activeObject != NULL && strcmp(Game->_activeObject->getClassName(), "CUIButton") == 0) { CUIButton *btn = static_cast(Game->_activeObject); if (btn->_visible && !btn->_disable) btn->_press = true; } diff --git a/engines/wintermute/Sys/SysClass.cpp b/engines/wintermute/Sys/SysClass.cpp index f7be3d2449..91639bc0ba 100644 --- a/engines/wintermute/Sys/SysClass.cpp +++ b/engines/wintermute/Sys/SysClass.cpp @@ -46,18 +46,18 @@ CSysClass::CSysClass(const AnsiString &name, PERSISTBUILD build, PERSISTLOAD loa _persistent = persistent_class; _numInst = 0; - CSysClassRegistry::GetInstance()->RegisterClass(this); + CSysClassRegistry::getInstance()->registerClass(this); } ////////////////////////////////////////////////////////////////////////// CSysClass::~CSysClass() { - CSysClassRegistry::GetInstance()->UnregisterClass(this); - RemoveAllInstances(); + CSysClassRegistry::getInstance()->unregisterClass(this); + removeAllInstances(); } ////////////////////////////////////////////////////////////////////////// -bool CSysClass::RemoveAllInstances() { +bool CSysClass::removeAllInstances() { Instances::iterator it; for (it = _instances.begin(); it != _instances.end(); ++it) { delete(it->_value); @@ -69,21 +69,21 @@ bool CSysClass::RemoveAllInstances() { } ////////////////////////////////////////////////////////////////////////// -CSysInstance *CSysClass::AddInstance(void *instance, int id, int savedId) { +CSysInstance *CSysClass::addInstance(void *instance, int id, int savedId) { CSysInstance *inst = new CSysInstance(instance, id, this); - inst->SetSavedID(savedId); + inst->setSavedID(savedId); _instances[inst] = (inst); _instanceMap[instance] = inst; - CSysClassRegistry::GetInstance()->AddInstanceToTable(inst, instance); + CSysClassRegistry::getInstance()->addInstanceToTable(inst, instance); return inst; } ////////////////////////////////////////////////////////////////////////// -bool CSysClass::RemoveInstance(void *instance) { +bool CSysClass::removeInstance(void *instance) { InstanceMap::iterator mapIt = _instanceMap.find(instance); if (mapIt == _instanceMap.end()) return false; @@ -99,48 +99,48 @@ bool CSysClass::RemoveInstance(void *instance) { } ////////////////////////////////////////////////////////////////////////// -int CSysClass::GetInstanceID(void *pointer) { +int CSysClass::getInstanceID(void *pointer) { InstanceMap::iterator mapIt = _instanceMap.find(pointer); if (mapIt == _instanceMap.end()) return -1; - else return (mapIt->_value)->GetID(); + else return (mapIt->_value)->getID(); } ////////////////////////////////////////////////////////////////////////// -void *CSysClass::IDToPointer(int savedID) { +void *CSysClass::idToPointer(int savedID) { //slow Instances::iterator it; for (it = _instances.begin(); it != _instances.end(); ++it) { - if ((it->_value)->GetSavedID() == savedID) return (it->_value)->GetInstance(); + if ((it->_value)->getSavedID() == savedID) return (it->_value)->getInstance(); } return NULL; } ////////////////////////////////////////////////////////////////////////// -int CSysClass::GetNumInstances() { +int CSysClass::getNumInstances() { return _instances.size(); } ////////////////////////////////////////////////////////////////////////// -void CSysClass::Dump(Common::WriteStream *stream) { +void CSysClass::dump(Common::WriteStream *stream) { Common::String str; - str = Common::String::format("%03d %c %-20s instances: %d\n", _iD, _persistent ? 'p' : ' ', _name.c_str(), GetNumInstances()); + str = Common::String::format("%03d %c %-20s instances: %d\n", _iD, _persistent ? 'p' : ' ', _name.c_str(), getNumInstances()); stream->write(str.c_str(), str.size()); } ////////////////////////////////////////////////////////////////////////// -void CSysClass::SaveTable(CBGame *Game, CBPersistMgr *persistMgr) { +void CSysClass::saveTable(CBGame *Game, CBPersistMgr *persistMgr) { persistMgr->putString(_name.c_str()); persistMgr->putDWORD(_iD); persistMgr->putDWORD(_instances.size()); Instances::iterator it; for (it = _instances.begin(); it != _instances.end(); ++it) { - persistMgr->putDWORD((it->_value)->GetID()); + persistMgr->putDWORD((it->_value)->getID()); } } ////////////////////////////////////////////////////////////////////////// -void CSysClass::LoadTable(CBGame *Game, CBPersistMgr *persistMgr) { +void CSysClass::loadTable(CBGame *Game, CBPersistMgr *persistMgr) { _savedID = persistMgr->getDWORD(); int numInstances = persistMgr->getDWORD(); @@ -155,8 +155,8 @@ void CSysClass::LoadTable(CBGame *Game, CBPersistMgr *persistMgr) { Instances::iterator it = _instances.begin(); if (it != _instances.end()) { - (it->_value)->SetSavedID(instID); - CSysClassRegistry::GetInstance()->AddInstanceToTable((it->_value), (it->_value)->GetInstance()); + (it->_value)->setSavedID(instID); + CSysClassRegistry::getInstance()->addInstanceToTable((it->_value), (it->_value)->getInstance()); } else Game->LOG(0, "Warning: instance %d of persistent class %s not found", i, _name.c_str()); } // normal instances, create empty objects @@ -166,45 +166,45 @@ void CSysClass::LoadTable(CBGame *Game, CBPersistMgr *persistMgr) { warning("HALT"); } - AddInstance(emptyObject, CSysClassRegistry::GetInstance()->GetNextID(), instID); + addInstance(emptyObject, CSysClassRegistry::getInstance()->getNextID(), instID); } } } ////////////////////////////////////////////////////////////////////////// -void CSysClass::SaveInstances(CBGame *Game, CBPersistMgr *persistMgr) { +void CSysClass::saveInstances(CBGame *Game, CBPersistMgr *persistMgr) { Instances::iterator it; for (it = _instances.begin(); it != _instances.end(); ++it) { // write instace header persistMgr->putString(""); persistMgr->putDWORD(_iD); - persistMgr->putDWORD((it->_value)->GetID()); + persistMgr->putDWORD((it->_value)->getID()); persistMgr->putString(""); - _load((it->_value)->GetInstance(), persistMgr); + _load((it->_value)->getInstance(), persistMgr); persistMgr->putString(""); } } ////////////////////////////////////////////////////////////////////////// -void CSysClass::LoadInstance(void *instance, CBPersistMgr *persistMgr) { +void CSysClass::loadInstance(void *instance, CBPersistMgr *persistMgr) { _load(instance, persistMgr); } ////////////////////////////////////////////////////////////////////////// -void CSysClass::ResetSavedIDs() { +void CSysClass::resetSavedIDs() { Instances::iterator it; for (it = _instances.begin(); it != _instances.end(); ++it) { - (it->_value)->SetSavedID(-1); + (it->_value)->setSavedID(-1); } } ////////////////////////////////////////////////////////////////////////// -void CSysClass::InstanceCallback(SYS_INSTANCE_CALLBACK lpCallback, void *lpData) { +void CSysClass::instanceCallback(SYS_INSTANCE_CALLBACK lpCallback, void *lpData) { Instances::iterator it; for (it = _instances.begin(); it != _instances.end(); ++it) { - lpCallback((it->_value)->GetInstance(), lpData); + lpCallback((it->_value)->getInstance(), lpData); } } diff --git a/engines/wintermute/Sys/SysClass.h b/engines/wintermute/Sys/SysClass.h index 2fdf3a31da..f807ea677c 100644 --- a/engines/wintermute/Sys/SysClass.h +++ b/engines/wintermute/Sys/SysClass.h @@ -68,44 +68,44 @@ public: CSysClass(const AnsiString &name, PERSISTBUILD build, PERSISTLOAD load, bool persistent_class); ~CSysClass(); - int GetNumInstances(); - bool RemoveInstance(void *instance); - CSysInstance *AddInstance(void *instance, int id, int savedId = -1); - bool RemoveAllInstances(); + int getNumInstances(); + bool removeInstance(void *instance); + CSysInstance *addInstance(void *instance, int id, int savedId = -1); + bool removeAllInstances(); - int GetInstanceID(void *pointer); - void *IDToPointer(int savedID); + int getInstanceID(void *pointer); + void *idToPointer(int savedID); - void SetID(int id) { + void setID(int id) { _iD = id; } - int GetID() const { + int getID() const { return _iD; } - int GetSavedID() const { + int getSavedID() const { return _savedID; } - bool IsPersistent() const { + bool isPersistent() const { return _persistent; } - AnsiString GetName() const { + AnsiString getName() const { return _name; } - void SaveTable(CBGame *Game, CBPersistMgr *PersistMgr); - void LoadTable(CBGame *Game, CBPersistMgr *PersistMgr); + void saveTable(CBGame *Game, CBPersistMgr *PersistMgr); + void loadTable(CBGame *Game, CBPersistMgr *PersistMgr); - void SaveInstances(CBGame *Game, CBPersistMgr *PersistMgr); - void LoadInstance(void *instance, CBPersistMgr *PersistMgr); + void saveInstances(CBGame *Game, CBPersistMgr *PersistMgr); + void loadInstance(void *instance, CBPersistMgr *PersistMgr); - void InstanceCallback(SYS_INSTANCE_CALLBACK lpCallback, void *lpData); + void instanceCallback(SYS_INSTANCE_CALLBACK lpCallback, void *lpData); - void ResetSavedIDs(); + void resetSavedIDs(); - void Dump(Common::WriteStream *stream); + void dump(Common::WriteStream *stream); private: int _numInst; diff --git a/engines/wintermute/Sys/SysClassRegistry.cpp b/engines/wintermute/Sys/SysClassRegistry.cpp index 8125678ee4..88b45c3c3a 100644 --- a/engines/wintermute/Sys/SysClassRegistry.cpp +++ b/engines/wintermute/Sys/SysClassRegistry.cpp @@ -46,7 +46,7 @@ CSysClassRegistry::~CSysClassRegistry() { } ////////////////////////////////////////////////////////////////////////// -CSysClassRegistry *CSysClassRegistry::GetInstance() { +CSysClassRegistry *CSysClassRegistry::getInstance() { return g_wintermute->getClassRegistry(); } @@ -58,35 +58,35 @@ void CSysClassRegistry::unregisterClasses() { } ////////////////////////////////////////////////////////////////////////// -bool CSysClassRegistry::RegisterClass(CSysClass *classObj) { - classObj->SetID(_count++); +bool CSysClassRegistry::registerClass(CSysClass *classObj) { + classObj->setID(_count++); //_classes.insert(classObj); _classes[classObj] = classObj; - _nameMap[classObj->GetName()] = classObj; - _idMap[classObj->GetID()] = classObj; + _nameMap[classObj->getName()] = classObj; + _idMap[classObj->getID()] = classObj; return true; } ////////////////////////////////////////////////////////////////////////// -bool CSysClassRegistry::UnregisterClass(CSysClass *classObj) { +bool CSysClassRegistry::unregisterClass(CSysClass *classObj) { Classes::iterator it = _classes.find(classObj); if (it == _classes.end()) return false; - if (classObj->GetNumInstances() != 0) { + if (classObj->getNumInstances() != 0) { char str[MAX_PATH]; - sprintf(str, "Memory leak@class %-20s: %d instance(s) left\n", classObj->GetName().c_str(), classObj->GetNumInstances()); + sprintf(str, "Memory leak@class %-20s: %d instance(s) left\n", classObj->getName().c_str(), classObj->getNumInstances()); CBPlatform::OutputDebugString(str); } _classes.erase(it); - NameMap::iterator mapIt = _nameMap.find(classObj->GetName()); + NameMap::iterator mapIt = _nameMap.find(classObj->getName()); if (mapIt != _nameMap.end()) _nameMap.erase(mapIt); - IdMap::iterator idIt = _idMap.find(classObj->GetID()); + IdMap::iterator idIt = _idMap.find(classObj->getID()); if (idIt != _idMap.end()) _idMap.erase(idIt); @@ -95,34 +95,34 @@ bool CSysClassRegistry::UnregisterClass(CSysClass *classObj) { ////////////////////////////////////////////////////////////////////////// -bool CSysClassRegistry::RegisterInstance(const char *className, void *instance) { +bool CSysClassRegistry::registerInstance(const char *className, void *instance) { if (_disabled) return true; NameMap::iterator mapIt = _nameMap.find(className); if (mapIt == _nameMap.end()) return false; - CSysInstance *inst = (*mapIt)._value->AddInstance(instance, _count++); + CSysInstance *inst = (*mapIt)._value->addInstance(instance, _count++); return (inst != NULL); } ////////////////////////////////////////////////////////////////////////// -void CSysClassRegistry::AddInstanceToTable(CSysInstance *instance, void *pointer) { +void CSysClassRegistry::addInstanceToTable(CSysInstance *instance, void *pointer) { _instanceMap[pointer] = instance; - if (instance->GetSavedID() >= 0) - _savedInstanceMap[instance->GetSavedID()] = instance; + if (instance->getSavedID() >= 0) + _savedInstanceMap[instance->getSavedID()] = instance; } ////////////////////////////////////////////////////////////////////////// -int CSysClassRegistry::GetNextID() { +int CSysClassRegistry::getNextID() { return _count++; } ////////////////////////////////////////////////////////////////////////// -bool CSysClassRegistry::UnregisterInstance(const char *className, void *instance) { +bool CSysClassRegistry::unregisterInstance(const char *className, void *instance) { NameMap::iterator mapIt = _nameMap.find(className); if (mapIt == _nameMap.end()) return false; - (*mapIt)._value->RemoveInstance(instance); + (*mapIt)._value->removeInstance(instance); InstanceMap::iterator instIt = _instanceMap.find(instance); if (instIt != _instanceMap.end()) { @@ -133,7 +133,7 @@ bool CSysClassRegistry::UnregisterInstance(const char *className, void *instance ////////////////////////////////////////////////////////////////////////// -bool CSysClassRegistry::GetPointerID(void *pointer, int *classID, int *instanceID) { +bool CSysClassRegistry::getPointerID(void *pointer, int *classID, int *instanceID) { if (pointer == NULL) return true; InstanceMap::iterator it = _instanceMap.find(pointer); @@ -141,17 +141,17 @@ bool CSysClassRegistry::GetPointerID(void *pointer, int *classID, int *instanceI CSysInstance *inst = (*it)._value; - *instanceID = inst->GetID(); - *classID = inst->GetClass()->GetID(); + *instanceID = inst->getID(); + *classID = inst->getClass()->getID(); return true; } ////////////////////////////////////////////////////////////////////////// -void *CSysClassRegistry::IDToPointer(int classID, int instanceID) { +void *CSysClassRegistry::idToPointer(int classID, int instanceID) { SavedInstanceMap::iterator it = _savedInstanceMap.find(instanceID); if (it == _savedInstanceMap.end()) return NULL; - else return (*it)._value->GetInstance(); + else return (*it)._value->getInstance(); } bool checkHeader(const char *tag, CBPersistMgr *pm) { @@ -166,7 +166,7 @@ bool checkHeader(const char *tag, CBPersistMgr *pm) { } ////////////////////////////////////////////////////////////////////////// -HRESULT CSysClassRegistry::SaveTable(CBGame *Game, CBPersistMgr *persistMgr, bool quickSave) { +HRESULT CSysClassRegistry::saveTable(CBGame *Game, CBPersistMgr *persistMgr, bool quickSave) { persistMgr->putString(""); persistMgr->putDWORD(_classes.size()); @@ -182,7 +182,7 @@ HRESULT CSysClassRegistry::SaveTable(CBGame *Game, CBPersistMgr *persistMgr, boo Game->_renderer->flip(); } - (it->_value)->SaveTable(Game, persistMgr); + (it->_value)->saveTable(Game, persistMgr); } persistMgr->putString(""); return S_OK; @@ -190,18 +190,18 @@ HRESULT CSysClassRegistry::SaveTable(CBGame *Game, CBPersistMgr *persistMgr, boo ////////////////////////////////////////////////////////////////////////// -HRESULT CSysClassRegistry::LoadTable(CBGame *Game, CBPersistMgr *persistMgr) { +HRESULT CSysClassRegistry::loadTable(CBGame *Game, CBPersistMgr *persistMgr) { checkHeader("", persistMgr); // reset SavedID of current instances Classes::iterator it; for (it = _classes.begin(); it != _classes.end(); ++it) { - (it->_value)->ResetSavedIDs(); + (it->_value)->resetSavedIDs(); } for (it = _classes.begin(); it != _classes.end(); ++it) { - if ((it->_value)->IsPersistent()) continue; - (it->_value)->RemoveAllInstances(); + if ((it->_value)->isPersistent()) continue; + (it->_value)->removeAllInstances(); } _instanceMap.clear(); @@ -215,7 +215,7 @@ HRESULT CSysClassRegistry::LoadTable(CBGame *Game, CBPersistMgr *persistMgr) { char *className = persistMgr->getString(); NameMap::iterator mapIt = _nameMap.find(className); - if (mapIt != _nameMap.end())(*mapIt)._value->LoadTable(Game, persistMgr); + if (mapIt != _nameMap.end())(*mapIt)._value->loadTable(Game, persistMgr); } checkHeader("", persistMgr); @@ -225,14 +225,14 @@ HRESULT CSysClassRegistry::LoadTable(CBGame *Game, CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -HRESULT CSysClassRegistry::SaveInstances(CBGame *Game, CBPersistMgr *persistMgr, bool quickSave) { +HRESULT CSysClassRegistry::saveInstances(CBGame *Game, CBPersistMgr *persistMgr, bool quickSave) { Classes::iterator it; // count total instances int numInstances = 0; for (it = _classes.begin(); it != _classes.end(); ++it) { - numInstances += (it->_value)->GetNumInstances(); + numInstances += (it->_value)->getNumInstances(); } persistMgr->putDWORD(numInstances); @@ -250,14 +250,14 @@ HRESULT CSysClassRegistry::SaveInstances(CBGame *Game, CBPersistMgr *persistMgr, } Game->MiniUpdate(); - (it->_value)->SaveInstances(Game, persistMgr); + (it->_value)->saveInstances(Game, persistMgr); } return S_OK; } ////////////////////////////////////////////////////////////////////////// -HRESULT CSysClassRegistry::LoadInstances(CBGame *Game, CBPersistMgr *persistMgr) { +HRESULT CSysClassRegistry::loadInstances(CBGame *Game, CBPersistMgr *persistMgr) { // get total instances int numInstances = persistMgr->getDWORD(); @@ -272,14 +272,14 @@ HRESULT CSysClassRegistry::LoadInstances(CBGame *Game, CBPersistMgr *persistMgr) int classID = persistMgr->getDWORD(); int instanceID = persistMgr->getDWORD(); - void *instance = IDToPointer(classID, instanceID); + void *instance = idToPointer(classID, instanceID); checkHeader("", persistMgr); Classes::iterator it; for (it = _classes.begin(); it != _classes.end(); ++it) { - if ((it->_value)->GetSavedID() == classID) { - (it->_value)->LoadInstance(instance, persistMgr); + if ((it->_value)->getSavedID() == classID) { + (it->_value)->loadInstance(instance, persistMgr); break; } } @@ -293,20 +293,20 @@ HRESULT CSysClassRegistry::LoadInstances(CBGame *Game, CBPersistMgr *persistMgr) ////////////////////////////////////////////////////////////////////////// -HRESULT CSysClassRegistry::EnumInstances(SYS_INSTANCE_CALLBACK lpCallback, const char *className, void *lpData) { +HRESULT CSysClassRegistry::enumInstances(SYS_INSTANCE_CALLBACK lpCallback, const char *className, void *lpData) { NameMap::iterator mapIt = _nameMap.find(className); if (mapIt == _nameMap.end()) return E_FAIL; - (*mapIt)._value->InstanceCallback(lpCallback, lpData); + (*mapIt)._value->instanceCallback(lpCallback, lpData); return S_OK; } ////////////////////////////////////////////////////////////////////////// -void CSysClassRegistry::DumpClasses(Common::WriteStream *stream) { +void CSysClassRegistry::dumpClasses(Common::WriteStream *stream) { Classes::iterator it; for (it = _classes.begin(); it != _classes.end(); ++it) - (it->_value)->Dump(stream); + (it->_value)->dump(stream); } } // end of namespace WinterMute diff --git a/engines/wintermute/Sys/SysClassRegistry.h b/engines/wintermute/Sys/SysClassRegistry.h index 6bc2c11fcf..92dfa5214b 100644 --- a/engines/wintermute/Sys/SysClassRegistry.h +++ b/engines/wintermute/Sys/SysClassRegistry.h @@ -61,25 +61,25 @@ class CSysClassRegistry { void unregisterClasses(); public: void registerClasses(); // persistent.cpp - static CSysClassRegistry *GetInstance(); + static CSysClassRegistry *getInstance(); CSysClassRegistry(); virtual ~CSysClassRegistry(); - HRESULT EnumInstances(SYS_INSTANCE_CALLBACK lpCallback, const char *className, void *lpData); - HRESULT LoadTable(CBGame *Game, CBPersistMgr *PersistMgr); - HRESULT SaveTable(CBGame *Game, CBPersistMgr *PersistMgr, bool quickSave); - HRESULT LoadInstances(CBGame *Game, CBPersistMgr *PersistMgr); - HRESULT SaveInstances(CBGame *Game, CBPersistMgr *PersistMgr, bool quickSave); - void *IDToPointer(int classID, int instanceID); - bool GetPointerID(void *pointer, int *classID, int *instanceID); - bool RegisterClass(CSysClass *classObj); - bool UnregisterClass(CSysClass *classObj); - bool RegisterInstance(const char *className, void *instance); - bool UnregisterInstance(const char *className, void *instance); - void DumpClasses(Common::WriteStream *stream); - int GetNextID(); - void AddInstanceToTable(CSysInstance *instance, void *pointer); + HRESULT enumInstances(SYS_INSTANCE_CALLBACK lpCallback, const char *className, void *lpData); + HRESULT loadTable(CBGame *Game, CBPersistMgr *PersistMgr); + HRESULT saveTable(CBGame *Game, CBPersistMgr *PersistMgr, bool quickSave); + HRESULT loadInstances(CBGame *Game, CBPersistMgr *PersistMgr); + HRESULT saveInstances(CBGame *Game, CBPersistMgr *PersistMgr, bool quickSave); + void *idToPointer(int classID, int instanceID); + bool getPointerID(void *pointer, int *classID, int *instanceID); + bool registerClass(CSysClass *classObj); + bool unregisterClass(CSysClass *classObj); + bool registerInstance(const char *className, void *instance); + bool unregisterInstance(const char *className, void *instance); + void dumpClasses(Common::WriteStream *stream); + int getNextID(); + void addInstanceToTable(CSysInstance *instance, void *pointer); bool _disabled; int _count; diff --git a/engines/wintermute/Sys/SysInstance.cpp b/engines/wintermute/Sys/SysInstance.cpp index 9e6a459bfc..b7f6079912 100644 --- a/engines/wintermute/Sys/SysInstance.cpp +++ b/engines/wintermute/Sys/SysInstance.cpp @@ -33,9 +33,9 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CSysInstance::CSysInstance(void *Instance, int ID, CSysClass *sysClass) { - _instance = Instance; - _iD = ID; +CSysInstance::CSysInstance(void *instance, int id, CSysClass *sysClass) { + _instance = instance; + _id = id; _savedID = -1; _class = sysClass; diff --git a/engines/wintermute/Sys/SysInstance.h b/engines/wintermute/Sys/SysInstance.h index b8e2531c4b..6becd491af 100644 --- a/engines/wintermute/Sys/SysInstance.h +++ b/engines/wintermute/Sys/SysInstance.h @@ -38,26 +38,26 @@ public: CSysInstance(void *Instance, int ID, CSysClass *sysClass); virtual ~CSysInstance(); - int GetID() const { - return _iD; + int getID() const { + return _id; } - int GetSavedID() const { + int getSavedID() const { return _savedID; } - void *GetInstance() const { + void *getInstance() const { return _instance; } - CSysClass *GetClass() const { + CSysClass *getClass() const { return _class; } - void SetSavedID(int id) { + void setSavedID(int id) { _savedID = id; } private: bool _used; - int _iD; + int _id; int _savedID; void *_instance; CSysClass *_class; diff --git a/engines/wintermute/UI/UIObject.cpp b/engines/wintermute/UI/UIObject.cpp index aaeeb6e5dd..46bfe399f2 100644 --- a/engines/wintermute/UI/UIObject.cpp +++ b/engines/wintermute/UI/UIObject.cpp @@ -71,7 +71,7 @@ CUIObject::CUIObject(CBGame *inGame): CBObject(inGame) { ////////////////////////////////////////////////////////////////////////// CUIObject::~CUIObject() { - if (!Game->_loadInProgress) CSysClassRegistry::GetInstance()->EnumInstances(CBGame::InvalidateValues, "CScValue", (void *)this); + if (!Game->_loadInProgress) CSysClassRegistry::getInstance()->enumInstances(CBGame::InvalidateValues, "CScValue", (void *)this); if (_back) delete _back; if (_font && !_sharedFonts) Game->_fontStorage->RemoveFont(_font); diff --git a/engines/wintermute/persistent.cpp b/engines/wintermute/persistent.cpp index 2e80f20049..8d451aad7b 100644 --- a/engines/wintermute/persistent.cpp +++ b/engines/wintermute/persistent.cpp @@ -90,7 +90,7 @@ // CSysClass adds these objects to the registry, thus they aren't as leaked as they look #define REGISTER_CLASS(class_name, persistent_class)\ - new WinterMute::CSysClass(class_name::_className, class_name::PersistBuild, class_name::PersistLoad, persistent_class); + new WinterMute::CSysClass(class_name::_className, class_name::persistBuild, class_name::persistLoad, persistent_class); namespace WinterMute { diff --git a/engines/wintermute/persistent.h b/engines/wintermute/persistent.h index 30f9cd8780..5d81ff51e9 100644 --- a/engines/wintermute/persistent.h +++ b/engines/wintermute/persistent.h @@ -48,9 +48,9 @@ namespace WinterMute { #define DECLARE_PERSISTENT(class_name, parent_class)\ static const char _className[];\ - static void* WINAPI PersistBuild(void);\ - virtual const char* GetClassName();\ - static HRESULT WINAPI PersistLoad(void* Instance, CBPersistMgr* PersistMgr);\ + static void* WINAPI persistBuild(void);\ + virtual const char* getClassName();\ + static HRESULT WINAPI persistLoad(void* Instance, CBPersistMgr* PersistMgr);\ class_name(TDynamicConstructor p1, TDynamicConstructor p2):parent_class(p1, p2){ /*memset(this, 0, sizeof(class_name));*/ };\ virtual HRESULT persist(CBPersistMgr* PersistMgr);\ void* operator new (size_t size);\ @@ -59,15 +59,15 @@ namespace WinterMute { #define IMPLEMENT_PERSISTENT(class_name, persistent_class)\ const char class_name::_className[] = #class_name;\ - void* class_name::PersistBuild(){\ + void* class_name::persistBuild(){\ return ::new class_name(DYNAMIC_CONSTRUCTOR, DYNAMIC_CONSTRUCTOR);\ }\ \ - HRESULT class_name::PersistLoad(void* Instance, CBPersistMgr* PersistMgr){\ + HRESULT class_name::persistLoad(void* Instance, CBPersistMgr* PersistMgr){\ return ((class_name*)Instance)->persist(PersistMgr);\ }\ \ - const char* class_name::GetClassName(){\ + const char* class_name::getClassName(){\ return #class_name;\ }\ \ @@ -75,12 +75,12 @@ namespace WinterMute { \ void* class_name::operator new (size_t size){\ void* ret = ::operator new(size);\ - CSysClassRegistry::GetInstance()->RegisterInstance(#class_name, ret);\ + CSysClassRegistry::getInstance()->registerInstance(#class_name, ret);\ return ret;\ }\ \ void class_name::operator delete (void* p){\ - CSysClassRegistry::GetInstance()->UnregisterInstance(#class_name, p);\ + CSysClassRegistry::getInstance()->unregisterInstance(#class_name, p);\ ::operator delete(p);\ }\ -- cgit v1.2.3