Skip to content

Commit

Permalink
Limitation de python : un seul script autorisé.
Browse files Browse the repository at this point in the history
Un seul bot python ne peut être chargé à la fois car il est impossible d'empêcher le partage des variables globales ! (ça pue)
#python @ irc.freenode.org :
<Habbie> Remram, can't be done
<Habbie> Remram, use Lua.
<dash> Remram: python isn't really suitable for embedding
  • Loading branch information
remram44 committed Jul 15, 2009
1 parent b9d32d9 commit b906867
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion GameEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ GameEngine::GameEngine(std::list<std::string> progs)
m_Bombers.resize(progs.size());
int i = 0;
std::list<std::string>::const_iterator it = progs.begin();
#ifdef WITH_PYTHON
bool py_loaded = false; // Limitation de Python - un seul bot python
#endif
for(; it != progs.end(); i++, it++)
{
int startx, starty;
Expand Down Expand Up @@ -70,7 +73,20 @@ GameEngine::GameEngine(std::list<std::string> progs)
#endif
#ifdef WITH_PYTHON
if(file.substr(file.size() - 3) == ".py")
m_Bombers[i] = new PyBomber(this, startx, starty, file.c_str());
{
if(!py_loaded)
{
m_Bombers[i] = new PyBomber(this, startx, starty, file.c_str());
py_loaded = true;
}
else
{
std::cerr << file << " : impossible de charger plus d'un "
"script Python ! (limitation au niveau de la lib Python...)"
"\n";
exit(1);
}
}
else
#endif
{
Expand Down

0 comments on commit b906867

Please sign in to comment.