diff --git a/mg/mglib.h b/mg/mglib.h index f9bf7852c..1332ee938 100755 --- a/mg/mglib.h +++ b/mg/mglib.h @@ -195,7 +195,6 @@ public: class TCodice_livelli : public TObject { - bool _enabled[MANY_MAG_LEV]; int _code_lenght[MANY_MAG_LEV]; TString _name[MANY_MAG_LEV]; TString _picture[MANY_MAG_LEV]; diff --git a/mg/mglib01.cpp b/mg/mglib01.cpp index bdfd9e23f..dffd2bcd7 100755 --- a/mg/mglib01.cpp +++ b/mg/mglib01.cpp @@ -588,8 +588,7 @@ void TCodice_livelli::load(bool enabled, const char *tabname,const char *tabgrp) _last_level=0; e=_tabformato.first(); for (int i=0; i< MANY_MAG_LEV; i++) { - _enabled[i]=(e==NOERR) && _lev_enabled; - if (_enabled[i]) { + if ((e==NOERR) && _lev_enabled) { _name[i]=_tabformato.get("S0"); _picture[i]=_tabformato.get("S1"); _code_lenght[i]=TMetachar::maxstrlen(_picture[i]); @@ -641,10 +640,7 @@ const bool TCodice_livelli::enabled() const const bool TCodice_livelli::enabled(int levnum) const { - if (_lev_enabled && levnum<=MANY_MAG_LEV && levnum>0) - return(_enabled[levnum-1]); - else - return(FALSE) ; + return (_lev_enabled && levnum<=MANY_MAG_LEV && levnum>0 && levnum<=_last_level); } @@ -704,7 +700,7 @@ TString TCodice_livelli::unpack_grpcode(const TString & pc, const int levnum) co if (start>=pc.len()) return(""); else { - if (levnum != _last_level && !_enabled[levnum-1]) + if (levnum < 1 || levnum > _last_level ) return(""); return(pc.mid(start,levnum == _last_level ? -1 : _code_lenght[levnum-1])); }