Updated the way module are initialized

It's safer and prevent a bug when initialisation fails


Former-commit-id: a04f18e18f2d9db11ec595a9b8096c2792b39641
This commit is contained in:
Lynix
2014-02-21 11:13:14 +01:00
parent 3f4b3aeef5
commit fd958fd9ac
9 changed files with 86 additions and 57 deletions

View File

@@ -11,8 +11,11 @@
bool NzLua::Initialize()
{
if (s_moduleReferenceCounter++ != 0)
if (s_moduleReferenceCounter > 0)
{
s_moduleReferenceCounter++;
return true; // Déjà initialisé
}
// Initialisation des dépendances
if (!NzCore::Initialize())
@@ -21,10 +24,11 @@ bool NzLua::Initialize()
return false;
}
s_moduleReferenceCounter++;
// Initialisation du module
NazaraNotice("Initialized: Lua module");
return true;
}