mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-19 13:46:13 +00:00
Changed: Code simplification
This commit is contained in:
parent
cb1a2e7fa3
commit
cba06bc88c
10 changed files with 39 additions and 29 deletions
|
@ -53,7 +53,7 @@ static string ListenAddr;
|
||||||
|
|
||||||
static bool AcceptInvalidCookie = false;
|
static bool AcceptInvalidCookie = false;
|
||||||
|
|
||||||
static string DefaultUserPriv = "";
|
static string DefaultUserPriv;
|
||||||
|
|
||||||
static TDisconnectClientCallback DisconnectClientCallback = NULL;
|
static TDisconnectClientCallback DisconnectClientCallback = NULL;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,9 @@
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "stdpch.h"
|
||||||
#include "georgesform_model.h"
|
#include "georgesform_model.h"
|
||||||
|
#include "formitem.h"
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/misc/types_nl.h>
|
#include <nel/misc/types_nl.h>
|
||||||
|
@ -35,9 +37,6 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
|
||||||
// project includes
|
|
||||||
#include "formitem.h"
|
|
||||||
|
|
||||||
using namespace NLGEORGES;
|
using namespace NLGEORGES;
|
||||||
|
|
||||||
namespace GeorgesQt
|
namespace GeorgesQt
|
||||||
|
@ -406,7 +405,7 @@ namespace GeorgesQt
|
||||||
//uint value_uint;
|
//uint value_uint;
|
||||||
//sint value_sint;
|
//sint value_sint;
|
||||||
//double value_double;
|
//double value_double;
|
||||||
QString elmtType = "";
|
QString elmtType;
|
||||||
UFormElm *elmt = 0;
|
UFormElm *elmt = 0;
|
||||||
if(root->getNodeByName(&elmt, elmName.c_str(), whereN, true))
|
if(root->getNodeByName(&elmt, elmName.c_str(), whereN, true))
|
||||||
{
|
{
|
||||||
|
@ -428,13 +427,23 @@ namespace GeorgesQt
|
||||||
switch (type->getType())
|
switch (type->getType())
|
||||||
{
|
{
|
||||||
case UType::UnsignedInt:
|
case UType::UnsignedInt:
|
||||||
value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble()).toUtf8();
|
{
|
||||||
|
uint v;
|
||||||
|
NLMISC::fromString(value, v);
|
||||||
|
value = NLMISC::toString(v);
|
||||||
elmtType.append("_uint");break;
|
elmtType.append("_uint");break;
|
||||||
|
}
|
||||||
case UType::SignedInt:
|
case UType::SignedInt:
|
||||||
value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble()).toUtf8();
|
{
|
||||||
|
sint v;
|
||||||
|
NLMISC::fromString(value, v);
|
||||||
|
value = NLMISC::toString(v);
|
||||||
elmtType.append("_sint");break;
|
elmtType.append("_sint");break;
|
||||||
|
}
|
||||||
case UType::Double:
|
case UType::Double:
|
||||||
value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble(),0,'f',1).toUtf8();
|
float v;
|
||||||
|
NLMISC::fromString(value, v);
|
||||||
|
value = NLMISC::toString(v);
|
||||||
elmtType.append("_double");break;
|
elmtType.append("_double");break;
|
||||||
case UType::String:
|
case UType::String:
|
||||||
elmtType.append("_string");break;
|
elmtType.append("_string");break;
|
||||||
|
@ -569,7 +578,7 @@ namespace GeorgesQt
|
||||||
{
|
{
|
||||||
QList<QVariant> columnData;
|
QList<QVariant> columnData;
|
||||||
std::string value;
|
std::string value;
|
||||||
QString elmtType = "";
|
QString elmtType;
|
||||||
|
|
||||||
UFormElm *elmt = 0;
|
UFormElm *elmt = 0;
|
||||||
if(root->getArrayNode(&elmt,0) && elmt)
|
if(root->getArrayNode(&elmt,0) && elmt)
|
||||||
|
|
|
@ -770,12 +770,13 @@ NL3D::CPSLocated *CParticleWorkspaceDialog::createLocated(NL3D::CParticleSystem
|
||||||
{
|
{
|
||||||
// build new name
|
// build new name
|
||||||
std::string name;
|
std::string name;
|
||||||
if (_PSElementIdentifiers.count(std::string("located")))
|
if (_PSElementIdentifiers.count("located"))
|
||||||
name = (QString("located %1").arg(++_PSElementIdentifiers[std::string("located")])).toUtf8();
|
{
|
||||||
|
name = NLMISC::toString("located %u", ++_PSElementIdentifiers["located"]);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
name = std::string("located 0");
|
name = "located 0";
|
||||||
_PSElementIdentifiers["located"] = 0;
|
_PSElementIdentifiers["located"] = 0;
|
||||||
}
|
}
|
||||||
NL3D::CPSLocated *loc = new NL3D::CPSLocated;
|
NL3D::CPSLocated *loc = new NL3D::CPSLocated;
|
||||||
|
|
|
@ -989,7 +989,7 @@ bool CScenarioValidator::setScenarioToSave(const std::string& filename, CObject*
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CScenarioValidator::AutoSaveSignature = "";
|
std::string CScenarioValidator::AutoSaveSignature;
|
||||||
|
|
||||||
bool CScenarioValidator::applySave(const std::string& signature)
|
bool CScenarioValidator::applySave(const std::string& signature)
|
||||||
{
|
{
|
||||||
|
@ -1252,7 +1252,7 @@ bool CUserComponentValidator::setUserComponentToSave(const std::string& filename
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CUserComponentValidator::AutoSaveSignature = "";
|
std::string CUserComponentValidator::AutoSaveSignature;
|
||||||
|
|
||||||
bool CUserComponentValidator::applySave(const std::string& signature)
|
bool CUserComponentValidator::applySave(const std::string& signature)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2017,7 +2017,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi
|
||||||
//first <=> actId
|
//first <=> actId
|
||||||
CPrimitives *primDoc = &primDocs[first];
|
CPrimitives *primDoc = &primDocs[first];
|
||||||
|
|
||||||
std::string streamFileName = "";
|
std::string streamFileName;
|
||||||
if (first==0)
|
if (first==0)
|
||||||
{
|
{
|
||||||
streamFileName= toString("r2.%04d.base.primitive", aiInstance);
|
streamFileName= toString("r2.%04d.base.primitive", aiInstance);
|
||||||
|
|
|
@ -2023,7 +2023,7 @@ void CExport::writeFloraIG (const string &LandFile, bool bTestForWriting)
|
||||||
|
|
||||||
|
|
||||||
// Make the .IG
|
// Make the .IG
|
||||||
string ZoneName = "";
|
string ZoneName;
|
||||||
ZoneName += NLMISC::toString(-j) + "_";
|
ZoneName += NLMISC::toString(-j) + "_";
|
||||||
ZoneName += 'a' + (i/26);
|
ZoneName += 'a' + (i/26);
|
||||||
ZoneName += 'a' + (i%26);
|
ZoneName += 'a' + (i%26);
|
||||||
|
|
|
@ -380,7 +380,7 @@ namespace NLQT
|
||||||
//uint value_uint;
|
//uint value_uint;
|
||||||
//sint value_sint;
|
//sint value_sint;
|
||||||
//double value_double;
|
//double value_double;
|
||||||
QString elmtType = "";
|
QString elmtType;
|
||||||
UFormElm *elmt = 0;
|
UFormElm *elmt = 0;
|
||||||
if(root->getNodeByName(&elmt, elmName.c_str(), whereN, true))
|
if(root->getNodeByName(&elmt, elmName.c_str(), whereN, true))
|
||||||
{
|
{
|
||||||
|
@ -542,7 +542,7 @@ namespace NLQT
|
||||||
{
|
{
|
||||||
QList<QVariant> columnData;
|
QList<QVariant> columnData;
|
||||||
std::string value;
|
std::string value;
|
||||||
QString elmtType = "";
|
QString elmtType;
|
||||||
|
|
||||||
UFormElm *elmt = 0;
|
UFormElm *elmt = 0;
|
||||||
if(root->getArrayNode(&elmt,0) && elmt)
|
if(root->getArrayNode(&elmt,0) && elmt)
|
||||||
|
|
|
@ -1809,7 +1809,7 @@ string CContentObjective::genCode(CMissionData &md)
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/*std::string CContentObjective::genNbGuildMembersNeededOption(CMissionData &md)
|
/*std::string CContentObjective::genNbGuildMembersNeededOption(CMissionData &md)
|
||||||
{
|
{
|
||||||
string ret = "";
|
string ret;
|
||||||
// If we are in a guild mission we add the 'nb_guild_members_needed' option to the script
|
// If we are in a guild mission we add the 'nb_guild_members_needed' option to the script
|
||||||
if (md.isGuildMission())
|
if (md.isGuildMission())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1455,7 +1455,7 @@ void GenerateDoc()
|
||||||
AltDocs[c].write( "<td><b><a href=\"rm_" + string(DataColStr[cc]) + ".html\">" + string(DataColStr[cc]) + "</a></b></td>" );
|
AltDocs[c].write( "<td><b><a href=\"rm_" + string(DataColStr[cc]) + ".html\">" + string(DataColStr[cc]) + "</a></b></td>" );
|
||||||
AltDocs[c].write( "</tr>" );
|
AltDocs[c].write( "</tr>" );
|
||||||
string previousKey = "[NO PREVIOUS]"; // not a blank string, because it may be a valid value
|
string previousKey = "[NO PREVIOUS]"; // not a blank string, because it may be a valid value
|
||||||
string previousName = "";
|
string previousName;
|
||||||
for ( CRMData::CLookup::const_iterator isd=SortableData.lookup( c ).begin(); isd!=SortableData.lookup( c ).end(); ++isd )
|
for ( CRMData::CLookup::const_iterator isd=SortableData.lookup( c ).begin(); isd!=SortableData.lookup( c ).end(); ++isd )
|
||||||
{
|
{
|
||||||
const TRMItem& item = SortableData.getRow( (*isd).second );
|
const TRMItem& item = SortableData.getRow( (*isd).second );
|
||||||
|
|
|
@ -870,7 +870,7 @@ public:
|
||||||
|
|
||||||
std::string getIndexName(uint32 value) const
|
std::string getIndexName(uint32 value) const
|
||||||
{
|
{
|
||||||
std::string result = "";
|
std::string result;
|
||||||
|
|
||||||
uint i;
|
uint i;
|
||||||
for (i=0; i<Values.size(); ++i)
|
for (i=0; i<Values.size(); ++i)
|
||||||
|
@ -1055,7 +1055,7 @@ public:
|
||||||
std::string getCallString()
|
std::string getCallString()
|
||||||
{
|
{
|
||||||
uint i;
|
uint i;
|
||||||
std::string res = "";
|
std::string res;
|
||||||
for (i=0; i<Context.size(); ++i)
|
for (i=0; i<Context.size(); ++i)
|
||||||
res += Context[i]->Name;
|
res += Context[i]->Name;
|
||||||
return res;
|
return res;
|
||||||
|
@ -1078,7 +1078,7 @@ public:
|
||||||
std::string getDebugCallStringFmt()
|
std::string getDebugCallStringFmt()
|
||||||
{
|
{
|
||||||
uint i, idx=0;
|
uint i, idx=0;
|
||||||
std::string res = "";
|
std::string res;
|
||||||
|
|
||||||
for (i=0; i<Context.size(); ++i)
|
for (i=0; i<Context.size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -1105,7 +1105,7 @@ public:
|
||||||
std::string getDebugCallStringVal()
|
std::string getDebugCallStringVal()
|
||||||
{
|
{
|
||||||
uint i, idx=0;
|
uint i, idx=0;
|
||||||
std::string res = "";
|
std::string res;
|
||||||
|
|
||||||
for (i=0; i<Context.size(); ++i)
|
for (i=0; i<Context.size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -1131,7 +1131,7 @@ public:
|
||||||
*/
|
*/
|
||||||
std::string getCallArgList()
|
std::string getCallArgList()
|
||||||
{
|
{
|
||||||
std::string res = "";
|
std::string res;
|
||||||
uint i, idx=0;
|
uint i, idx=0;
|
||||||
|
|
||||||
for (i=0; i<Context.size(); ++i)
|
for (i=0; i<Context.size(); ++i)
|
||||||
|
@ -1156,7 +1156,7 @@ public:
|
||||||
*/
|
*/
|
||||||
std::string getCallPath()
|
std::string getCallPath()
|
||||||
{
|
{
|
||||||
std::string res = "";
|
std::string res;
|
||||||
uint i, idx=0;
|
uint i, idx=0;
|
||||||
|
|
||||||
for (i=0; i<Context.size(); ++i)
|
for (i=0; i<Context.size(); ++i)
|
||||||
|
@ -1182,7 +1182,7 @@ public:
|
||||||
*/
|
*/
|
||||||
std::string getUserCodeContext()
|
std::string getUserCodeContext()
|
||||||
{
|
{
|
||||||
std::string res = "";
|
std::string res;
|
||||||
uint i;
|
uint i;
|
||||||
|
|
||||||
if (Context.empty())
|
if (Context.empty())
|
||||||
|
@ -1245,7 +1245,7 @@ public:
|
||||||
|
|
||||||
std::string getColumn()
|
std::string getColumn()
|
||||||
{
|
{
|
||||||
std::string res = "";
|
std::string res;
|
||||||
uint i, idx=0;
|
uint i, idx=0;
|
||||||
|
|
||||||
for (i=0; i<Context.size(); ++i)
|
for (i=0; i<Context.size(); ++i)
|
||||||
|
|
Loading…
Reference in a new issue