1
0
forked from mirrors/0ad

Simple refactoring of Singleton. Make it non-copyable.

Reviewed By: wraitii
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D1564
This was SVN commit r22050.
This commit is contained in:
vladislavbelov
2019-01-13 15:11:40 +00:00
parent 43758bcb92
commit 43a291a071
6 changed files with 77 additions and 84 deletions
+3 -4
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2016 Wildfire Games.
/* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -34,13 +34,13 @@ class ScriptEngine : public Singleton<ScriptEngine>
public:
ScriptEngine()
{
ENSURE(m_Runtimes.size() == 0 && "JS_Init must be called before any runtimes are created!");
ENSURE(m_Runtimes.empty() && "JS_Init must be called before any runtimes are created!");
JS_Init();
}
~ScriptEngine()
{
ENSURE(m_Runtimes.size() == 0 && "All runtimes must be destroyed before calling JS_ShutDown!");
ENSURE(m_Runtimes.empty() && "All runtimes must be destroyed before calling JS_ShutDown!");
JS_ShutDown();
}
@@ -48,7 +48,6 @@ public:
void UnRegisterRuntime(const JSRuntime* rt) { m_Runtimes.remove(rt); }
private:
std::list<const JSRuntime*> m_Runtimes;
};