/// Get players from authorization
Vector<PlayerList> GameEconomicGameClient::LoginGetAccountPlayersFromAuthorization(String ServerString)
{

    /// Change convert
    String TempString=ServerString;
    Vector <String> ServerStringSplit;

    /// Replace | to a space
    TempString.Replace ('|', ' ', false);

    /// Split the string
    ServerStringSplit = TempString.Split(' ');

    /// Create a empty list for now
    Vector<PlayerList> temporaryList;

    /// return blank list
    if(ServerStringSplit.At(1)==String("0"))
    {
        return temporaryList;
    }

    /// Converstion here
    unsigned int NumberCols=atoi(ServerStringSplit.At(0).CString());
    unsigned int NumberRows=atoi(ServerStringSplit.At(1).CString());

    for(unsigned int i=0; i<NumberRows; i++)
    {
        unsigned int index=(i*NumberCols)+2;

        /// Create temporary Player
        PlayerList temporaryPlayer;

        temporaryPlayer.Firstname = ServerStringSplit.At(index);
        temporaryPlayer.Middlename = ServerStringSplit.At(index+1);
        temporaryPlayer.Lastname = ServerStringSplit.At(index+2);
        temporaryPlayer.UniqueID = ServerStringSplit.At(index+3);
        temporaryPlayer.Level = atoi(ServerStringSplit.At(index+4).CString());
        temporaryPlayer.AlienRace = atoi(ServerStringSplit.At(index+5).CString());
        temporaryPlayer.AlienRaceAllianceAligned = atoi(ServerStringSplit.At(index+6).CString());
        temporaryPlayer.Gender = atoi(ServerStringSplit.At(index+7).CString());
        temporaryPlayer.PersonalityTrait = atoi(ServerStringSplit.At(index+8).CString());

        cout << "playeruniqueid" << temporaryPlayer.UniqueID.CString()<< endl;

        /// Append temporaryplayer
        temporaryList.Push(temporaryPlayer);
    }

    return temporaryList;
}
void CSModuleWriter::GenerateManagedModuleClass(String& sourceOut)
{
    Indent();

    String source;
    String line = ToString("public static partial class %sModule\n", module_->GetName().CString());

    source += IndentLine(line);

    source += IndentLine("{\n");

    Indent();

    source += IndentLine("public static void Initialize()\n");

    source += IndentLine("{\n");

    Indent();

    Vector<SharedPtr<JSBClass>> classes = module_->classes_.Values();

    for (unsigned i = 0; i < classes.Size(); i++)
    {
        JSBClass* klass = classes.At(i);
        JSBPackage* package = module_->GetPackage();

        if (klass->IsNumberArray() || klass->IsAbstract())
            continue;

        line = ToString("NativeCore.RegisterNativeType(typeof(%s));\n", klass->GetName().CString());

        source += IndentLine(line);

        line = ToString("NativeCore.nativeClassIDToManagedConstructor [ %s.csb_%s_%s_GetClassIDStatic ()] = (IntPtr x) => {\n",
                        klass->GetName().CString(), package->GetName().CString(), klass->GetName().CString());

        source += IndentLine(line);

        Indent();

        source += IndentLine(ToString("return new %s (x);\n", klass->GetName().CString()));

        Dedent();

        source += IndentLine("};\n");

    }

    Dedent();

    source += IndentLine("}\n");

    Dedent();

    source += IndentLine("}\n");

    sourceOut += source;

    Dedent();
}
Beispiel #3
0
	static void _apply_gradient(
		Combine combine,
		const std::vector<Vector<T, N>>& grad0,
		const std::vector<Vector<T, N>>& grad1,
		const std::vector<Vector<T, N>>& grad2,
		GLubyte* dp,
		GLubyte* de
	)
	{
		auto gb0 = grad0.begin(), ge0 = grad0.end();
		auto gb1 = grad1.begin(), ge1 = grad1.end();
		auto gb2 = grad2.begin(), ge2 = grad2.end();

		for(auto gp0=gb0; gp0!=ge0; ++gp0)
		for(auto gp1=gb1; gp1!=ge1; ++gp1)
		for(auto gp2=gb2; gp2!=ge2; ++gp2)
		{
			Vector<T, N> color = combine(*gp0, *gp1, *gp2);
			for(std::size_t c=0; c!=N; ++c)
			{
				assert(dp != de);
				*dp++ = GLubyte(_clamp(color.At(c))*_cc_max());
			}
		}
		OGLPLUS_FAKE_USE(de);
		assert(dp == de);
	}
void JSBModule::ProcessHaxeDecl()
{
    // Haxe declarations

    JSONValue root = moduleJSON_->GetRoot();

    JSONValue decl = root.GetChild("haxe_decl");

    if (decl.IsObject())
    {
        Vector<String> childNames = decl.GetChildNames();

        for (unsigned j = 0; j < childNames.Size(); j++)
        {
            String classname = childNames.At(j);

            JSBClass* klass = GetClass(classname);

            if (!klass)
            {
                ErrorExit("Bad Haxe decl class");
            }

            JSONValue classdecl = decl.GetChild(classname);

            for (unsigned k = 0; k < classdecl.GetSize(); k++)
            {
                klass->AddHaxeDecl(classdecl.GetString(k));
            }
        }
    }
}
Beispiel #5
0
// Calculate business days forward or back depending on a 5-day week.
// Send a negative bdaysaway to calculate days back.
// http://www.smart.net/~mmontes/ushols.html
//==============================================================================================
Date GetDateFromDateBDays(Date startDate, int bdaysaway, UrpCountry country) {
	Date fromdate = startDate; // Make working colpy
	int dayofweek = DayOfWeek(fromdate);
	if (dayofweek == 6 /* Sat */) fromdate+= 1; // Shift to sunday so week calc works
	int bdaysleftinweek = 5 - DayOfWeek(fromdate); // Calculate days left in week (backwards)
	int weeksinbetween = (bdaysaway - bdaysleftinweek + (bdaysaway > 0? 4 : 0)) / 5; // Substract current week if going forward
	bdaysaway = bdaysaway + (weeksinbetween * 2); // 2 days skipped per week

	// Holiday general calculator:
	// 1 + (Q-1)*7 + (N - DoW(Year,Month,1))%7
	// where N is the day of week, Q is what occurence (th) that we want DoW = Day of week for a date
	// http://www.tondering.dk/main/index.php/calendar-information
	Date edate;
	edate = fromdate + bdaysaway;
	
	if (holidays.GetCount() == 0) {
		LoadHolidays();
	}
	
	
	// If this is a holiday, skip ahead or back a working day (business day)
	if (holidays.At((int)country).Find(edate) != -1) {
		return GetDateFromDateBDays(edate, Sgn(bdaysaway), country);
	} else {
		// If the previous day is sunday and it was a holiday, since we only have official
		// non-working holidays in the database, then we calculate the observed holiday
		// as being Monday.  
		// Federal law (5 U.S.C. 6103) establishes the following public holidays for Federal employees. Please note that most Federal employees work on a Monday through Friday schedule. For these employees, when a holiday falls on a nonworkday -- Saturday or Sunday -- the holiday usually is observed on Monday (if the holiday falls on Sunday) or Friday (if the holiday falls on Saturday).
		// January 1, 2011 (the legal public holiday for New Year’s Day), falls on a Saturday. For most Federal employees, Friday, December 31, 2010, will be treated as a holiday for pay and leave purposes. (See 5 U.S.C. 6103(b).)
		// TODO: Does this work regardless of country?
		Date prevfrom_edate = edate - 1;
		
		if (DayOfWeek(prevfrom_edate) == SUNDAY && holidays.At((int)country).Find(prevfrom_edate) != -1) {
			return GetDateFromDateBDays(edate, Sgn(bdaysaway), country);
		}
		
		// Check if tomorrow is a saturday and a holiday. http://www.opm.gov/Operating_Status_Schedules/fedhol/2011.asp
		Date nextafter_edate = edate + 1;
		if (DayOfWeek(nextafter_edate) == SATURDAY && holidays.At((int)country).Find(nextafter_edate) != -1) {
			return GetDateFromDateBDays(edate, Sgn(bdaysaway), country);
		}

	}
	
	return edate;
}
void JSBModuleWriter::WriteClassDeclaration(String& source)
{
    Vector<SharedPtr<JSBClass>> classes = module_->classes_.Values();

    source += "static void jsb_declare_classes(JSVM* vm)\n{\n";

    source += "duk_context* ctx = vm->GetJSContext();\n";

    String packageName = module_->GetPackage()->GetName();

    for (unsigned i = 0; i < classes.Size(); i++)
    {
        JSBClass* klass = classes.At(i);

        if (klass->IsNumberArray())
            continue;

        source.AppendWithFormat("   js_class_declare<%s>(vm, \"%s\", \"%s\", jsb_constructor_%s);\n", klass->GetNativeName().CString(), packageName.CString(), klass->GetName().CString(), klass->GetName().CString());

        if (klass->HasProperties())
        {
            source.AppendWithFormat("js_class_push_propertyobject(vm, \"%s\", \"%s\");\n", packageName.CString(), klass->GetName().CString());

            Vector<String> pnames;
            klass->GetPropertyNames(pnames);

            for (unsigned j = 0; j < pnames.Size(); j++)
            {
                JSBProperty* prop = klass->GetProperty(pnames[j]);

                source.Append("duk_push_object(ctx);\n");

                if (prop->getter_ && !prop->getter_->Skip())
                {
                    source.AppendWithFormat("duk_push_c_function(ctx, jsb_class_%s_%s, 0);\n",
                                            klass->GetName().CString(), prop->getter_->GetName().CString());
                    source.Append("duk_put_prop_string(ctx, -2, \"get\");\n");
                }
                if (prop->setter_ && !prop->setter_->Skip())
                {
                    source.AppendWithFormat("duk_push_c_function(ctx, jsb_class_%s_%s, 1);\n",
                                            klass->GetName().CString(), prop->setter_->GetName().CString());
                    source.Append("duk_put_prop_string(ctx, -2, \"set\");\n");
                }

                String propertyName = prop->GetCasePropertyName();
                source.AppendWithFormat("duk_put_prop_string(ctx, -2, \"%s\");\n", propertyName.CString());

            }

            source.Append("duk_pop(ctx);\n");

        }
    }

    source += "\n}\n\n";

}
void JSModuleWriter::WriteModulePreInit(String& source)
{
    source.AppendWithFormat("\nvoid jsb_package_%s_preinit_%s (JSVM* vm)\n{\n\njsb_declare_classes(vm);\n",
                            module_->package_->GetName().ToLower().CString(), module_->GetName().ToLower().CString());

    // register enums and constants
    source += "// enums and constants\n";
    source += "duk_context* ctx = vm->GetJSContext();\n";
    source.AppendWithFormat("duk_get_global_string(ctx, \"%s\");\n", module_->package_->GetName().CString());
    source += "// enums\n";

    Vector<SharedPtr<JSBEnum>> enums = module_->enums_.Values();

    for (unsigned i = 0; i < enums.Size(); i++)
    {
        JSBEnum* jenum = enums[i];

        HashMap<String, String>& values = jenum->GetValues();

        HashMap<String, String>::ConstIterator itr = values.Begin();

        while (itr != values.End())
        {
            String name = (*itr).first_;
            source.AppendWithFormat("duk_push_number(ctx, (double) %s);\n", name.CString());
            source.AppendWithFormat("duk_put_prop_string(ctx, -2, \"%s\");\n",name.CString());
            itr++;
        }
    }
    source += "// constants\n";

    Vector<String> constants = module_->constants_.Keys();

    for (unsigned i = 0; i < constants.Size(); i++)
    {
        source.AppendWithFormat("duk_push_number(ctx, (double) %s);\n", constants.At(i).CString());
        source.AppendWithFormat("duk_put_prop_string(ctx, -2, \"%s\");\n", constants.At(i).CString());
    }

    source += "duk_pop(ctx);\n";
    source += "// end enums and constants\n";

    source += "\n}\n";

}
void CSModuleWriter::WriteIncludes(String& source)
{

    Vector<String>& includes = module_->includes_;
    for (unsigned i = 0; i < includes.Size(); i++)
    {
        if (includes[i].StartsWith("<"))
            source.AppendWithFormat("#include %s\n", includes[i].CString());
        else
            source.AppendWithFormat("#include \"%s\"\n", includes[i].CString());
    }

    Vector<JSBHeader*> allheaders;

    HashMap<StringHash, SharedPtr<JSBEnum> >::Iterator eitr = module_->enums_.Begin();
    while (eitr != module_->enums_.End())
    {
        allheaders.Push(eitr->second_->GetHeader());
        eitr++;
    }

    HashMap<StringHash, SharedPtr<JSBClass> >::Iterator citr = module_->classes_.Begin();
    while (citr != module_->classes_.End())
    {
        allheaders.Push(citr->second_->GetHeader());
        citr++;
    }

    Vector<JSBHeader*> included;

    for (unsigned i = 0; i < allheaders.Size(); i++)
    {
        JSBHeader* header = allheaders.At(i);

        if (included.Contains(header))
            continue;

        String headerPath = GetPath(header->GetFilePath());

        String headerfile = GetFileNameAndExtension(header->GetFilePath());

        JSBind* jsbind = header->GetSubsystem<JSBind>();

        headerPath.Replace(jsbind->GetSourceRootFolder() + "Source/", "");

        source.AppendWithFormat("#include <%s%s>\n", headerPath.CString(), headerfile.CString());

        included.Push(header);
    }

    source += ToString("\n#include \"CSPackage%s.h\"\n", module_->GetPackage()->GetName().CString());

}
/// Get account information
AccountInformation * GameEconomicGameClient::LoginGetPlayerAccountFromAuthorization(String ServerString)
{
    /// Change convert
    String TempString=ServerString;
    Vector <String> ServerStringSplit;

    /// Create a pointer
    AccountInformation * ReturnAccountInformation  = new AccountInformation();

    /// Replace | to a space
    TempString.Replace ('|', ' ', false);

    /// Split the string
    ServerStringSplit = TempString.Split(' ');

    if(ServerStringSplit.At(1)==String("0"))
    {
        return NULL;
    }

    /// copy data
    ReturnAccountInformation->Username=ServerStringSplit.At(3);
    ReturnAccountInformation->Firstname=ServerStringSplit.At(4);
    ReturnAccountInformation->Middlename=ServerStringSplit.At(5);
    ReturnAccountInformation->Lastname=ServerStringSplit.At(6);
    ReturnAccountInformation->Email.Clear();
    ReturnAccountInformation->Password.Clear();
    ReturnAccountInformation->LastLogin=0;
    ReturnAccountInformation->UniqueID=ServerStringSplit.At(12);



    return ReturnAccountInformation;
}
/// Get players from authorization
Vector<AlienRaceInformation> GameEconomicGameClient::LoadGetAlienRacesFromAuthorization(String ServerString)
{

    /// Change convert
    String TempString=ServerString;
    Vector <String> ServerStringSplit;

    /// Replace | to a space
    TempString.Replace ('|', ' ', false);

    /// Split the string
    ServerStringSplit = TempString.Split(' ');

    /// Create a empty list for now
    Vector<AlienRaceInformation> temporaryList;

    cout << "test 1" << endl;

    /// return blank list
    if(ServerStringSplit.At(1)==String("0"))
    {
        return temporaryList;
    }

    cout << "test 2" << endl;

    /// Converstion here
    unsigned int NumberCols=atoi(ServerStringSplit.At(0).CString());
    unsigned int NumberRows=atoi(ServerStringSplit.At(1).CString());

    for(unsigned int i=0; i<NumberRows; i++)
    {
        unsigned int index=(i*NumberCols)+2;

        /// Create temporary Player
        AlienRaceInformation temporaryAlienRace;

        temporaryAlienRace.Name=ServerStringSplit.At(index+0);
        temporaryAlienRace.Prefix=ServerStringSplit.At(index+1);
        temporaryAlienRace.Description=ServerStringSplit.At(index+2);
        temporaryAlienRace.AlignedFaction=ServerStringSplit.At(index+3);
        temporaryAlienRace.UniqueID=ServerStringSplit.At(index+4);



        cout << "Adding" << endl;

        /// Append temporaryplayer
        temporaryList.Push(temporaryAlienRace);
    }

    return temporaryList;
}
void JSBModule::ProcessExcludes()
{
    // excludes

    JSONValue root = moduleJSON_->GetRoot();

    JSONValue excludes = root.GetChild("excludes");

    if (excludes.IsObject())
    {
        Vector<String> childNames = excludes.GetChildNames();

        for (unsigned j = 0; j < childNames.Size(); j++)
        {
            String classname = childNames.At(j);

            JSBClass* klass = GetClass(classname);

            if (!klass)
            {
                ErrorExit("Bad exclude klass");
            }

            JSONValue classexcludes = excludes.GetChild(classname);

            Vector<String> functionNames = classexcludes.GetChildNames();

            for (unsigned k = 0; k < functionNames.Size(); k++)
            {
                JSONValue sig = classexcludes.GetChild(functionNames[k]);

                if (!sig.IsArray())
                {
                    ErrorExit("Bad exclude defintion");
                }

                Vector<String> values;
                for (unsigned x = 0; x < sig.GetSize(); x++)
                {
                    values.Push(sig.GetString(x));
                }

                JSBFunctionSignature* fe = new JSBFunctionSignature(functionNames[k], values);
                klass->AddFunctionExclude(fe);

            }
        }
    }
}
Beispiel #12
0
inline Vector<T, Rows> operator * (
	const Matrix<T, Rows, N>& m,
	const Vector<T, N>& v
)
{
	T tmp[Rows];
	for(std::size_t r=0; r!=Rows; ++r)
	{
		tmp[r] = T(0);
		for(std::size_t c=0; c!=N; ++c)
		{
			tmp[r] += m.At(r, c) * v.At(c);
		}
	}
	return Vector<T, Rows>(tmp);
}
void JSBModuleWriter::WriteForwardDeclarations(String& source)
{
    Vector<SharedPtr<JSBClass>> classes = module_->classes_.Values();

    for (unsigned i = 0; i < classes.Size(); i++)
    {
        JSBClass* cls = classes.At(i);

        if (cls->IsNumberArray())
            continue;

        source.AppendWithFormat("static duk_ret_t jsb_constructor_%s(duk_context* ctx);\n", cls->GetName().CString());
        source.AppendWithFormat("static void jsb_class_define_%s(JSVM* vm);\n", cls->GetName().CString());

    }
}
Beispiel #14
0
inline Vector<T, Cols> operator * (
	const Vector<T, N>& v,
	const Matrix<T, N, Cols>& m
)
{
	T tmp[Cols];
	for(std::size_t c=0; c!=Cols; ++c)
	{
		tmp[c] = T(0);
		for(std::size_t r=0; r!=N; ++r)
		{
			tmp[c] += v.At(r) * m.At(r, c);
		}
	}
	return Vector<T, Cols>(tmp);
}
void CSModuleWriter::GenerateManagedClasses(String& source)
{

    Vector<SharedPtr<JSBClass>> classes = module_->classes_.Values();

    for (unsigned i = 0; i < classes.Size(); i++)
    {
        JSBClass* klass = classes.At(i);

        if (klass->IsNumberArray())
            continue;

        CSClassWriter clsWriter(klass);
        clsWriter.GenerateManagedSource(source);

    }

}
void JSBModuleWriter::WriteClassDefine(String& source)
{
    Vector<SharedPtr<JSBClass>> classes = module_->classes_.Values();

    source += "static void jsb_init_classes(JSVM* vm)\n{\n";

    for (unsigned i = 0; i < classes.Size(); i++)
    {
        JSBClass* klass = classes.At(i);

        if (klass->IsNumberArray())
            continue;

        source.AppendWithFormat("   jsb_class_define_%s(vm);\n", klass->GetName().CString());
    }

    source += "\n}\n\n";

}
Beispiel #17
0
DockableCtrl* DockBase::GetDockedWindowFromIndex(int index)
{
	Vector<DockableCtrl*> docks;
	docks.Clear();
	for(int i = 0; i < 8; i++)
	{
		if(i < 4) 
		{
			int n = GetPaneFrame(i).GetCount();
			if(n) for(int j = 0; j < n; j++) docks.Add(GetPaneFrame(i).GetChild(j + 1));
		}
		else
		{
			int n = GetHideBar(i - 4).GetCount();
			if(n) for(int j = 0; j < n; j++) docks.Add(GetHideBar(i - 4).GetChild(j));
		}
	}
	return docks.GetCount() ? docks.At(index) : NULL;
}
Beispiel #18
0
void JSBModule::WriteIncludes(String& source)
{

    Vector<JSBHeader*> allheaders;

    for (unsigned i = 0; i < enums_.Size(); i++)
    {
        allheaders.Push(enums_.At(i)->header_);
    }

    for (unsigned i = 0; i < classes_.Size(); i++)
    {
        allheaders.Push(classes_.At(i)->GetHeader());
    }

    Vector<JSBHeader*> included;
    for (unsigned i = 0; i < allheaders.Size(); i++)
    {
        JSBHeader* header = allheaders.At(i);

        if (included.Contains(header))
            continue;

        String headerPath = GetPath(header->filepath_);

		String headerfile = GetFileNameAndExtension(header->filepath_);

        headerPath.Replace(JSBind::ROOT_FOLDER + "/Source/Atomic/", "Atomic/");

        source.AppendWithFormat("#include <%s%s>\n", headerPath.CString(), headerfile.CString());

        included.Push(header);
    }

    for (unsigned i = 0; i < includes_.Size(); i++)
    {
        if (includes_[i].StartsWith("<"))
            source.AppendWithFormat("#include %s\n", includes_[i].CString());
        else
            source.AppendWithFormat("#include \"%s\"\n", includes_[i].CString());
    }
}
Beispiel #19
0
	static void _apply_gradient(
		const std::vector<Vector<T, N>>& grad0,
		GLubyte* dp,
		GLubyte* de
	)
	{
		auto gb0 = grad0.begin(), ge0 = grad0.end();

		for(auto gp0=gb0; gp0!=ge0; ++gp0)
		{
			Vector<T, N> color = *gp0;
			for(std::size_t c=0; c!=N; ++c)
			{
				assert(dp != de);
				*dp++ = GLubyte(_clamp(color.At(c))*_cc_max());
			}
		}
		OGLPLUS_FAKE_USE(de);
		assert(dp == de);
	}
Beispiel #20
0
    /**
    * hope this takes negligible time because work is not being spun off - blocking return
    * Uses the GMM objecct to do Gaussian Mixture Regression. on the input vector (with dimensions defined by the inputDimensions vector.
    * Also calculates what the output dimensions should be.
    * Regression finds a mean of a unimodal distribution over the output dimensions.
    * Regression finds a covariance matrix for the regressed that too.
    */
    bool doInference(const Vector &inputVector,const Vector &inputDimensions,Vector &outputMu,Matrix &outputSigma) {
        sem.wait();
        std::cout<<"Doing inference on "<<inputVector;
        //inputVector.Print();
        std::cout<<" which contains dimensions "<<inputDimensions<<std::endl;
        //inputDimensions.Print();
        std::cout<<std::endl;
        if (curr_status!=LEARNT) {
            std::cout<<"But can't do anything because map not yet learnt"<<std::endl;
            sem.post();
            return false;
        }
        if(inputVector.Size()!=inputDimensions.Size()){
	 std::cerr<<"BIG PROBLEM inputVector.Size() == "<<inputVector.Size()<<"!="<<inputDimensions.Size()<<" == inputDimensions.Size()"<<std::endl;
	 
	}
        Vector outputDimensions(learned_model->dim-inputDimensions.Size());
        int ocCntr=0;
        for (int i=0;i<learned_model->dim;i++) {
            bool found=false;
            for (int j=0;j<inputDimensions.Size();j++) {
                if (inputDimensions.At(j)==i) {
                    found=true;
                    j=inputDimensions.Size()+5;
                }
            }
            if (!found) {
                outputDimensions[ocCntr]=i;
                ocCntr++;
            }
        }
        
        std::cout<<"doRegression("<<inputVector<<","<<outputSigma<<","<<inputDimensions<<","<<outputDimensions<<");"<<std::endl;
        outputMu=learned_model->doRegression( inputVector,
                                              outputSigma,
                                              inputDimensions,
                                              outputDimensions);
        sem.post();
        std::cout<<"Regression is returning"<<outputMu<<std::endl;
        return true;
    }
/// Get players from authorization
Vector<FactionInformation> GameEconomicGameClient::LoadGetFactionsFromAuthorization(String ServerString)
{

    /// Change convert
    String TempString=ServerString;
    Vector <String> ServerStringSplit;

    /// Replace | to a space
    TempString.Replace ('|', ' ', false);

    /// Split the string
    ServerStringSplit = TempString.Split(' ');

    /// Create a empty list for now
    Vector<FactionInformation> temporaryList;

    /// return blank list
    if(ServerStringSplit.At(1)==String("0"))
    {
        return temporaryList;
    }

    /// Converstion here
    unsigned int NumberCols=atoi(ServerStringSplit.At(0).CString());
    unsigned int NumberRows=atoi(ServerStringSplit.At(1).CString());

    for(unsigned int i=0; i<NumberRows; i++)
    {
        unsigned int index=(i*NumberCols)+2;

        /// Create temporary Player
        FactionInformation temporaryFaction;

        temporaryFaction.Name=ServerStringSplit.At(index+0);
        temporaryFaction.Prefix=ServerStringSplit.At(index+1);
        temporaryFaction.Description=ServerStringSplit.At(index+2);
        temporaryFaction.UniqueID=ServerStringSplit.At(index+3);

        ///Replace characters
        temporaryFaction.Description.Replace('_',' ',true);

        /// Append temporaryplayer
        temporaryList.Push(temporaryFaction);
    }

    return temporaryList;
}
Beispiel #22
0
void RichQtfParser::Parse(const char *qtf, int _accesskey)
{
	accesskey = _accesskey;
	term = qtf;
	while(*term) {
		if(Key('[')) {
			Flush();
			fstack.Add(format);
			for(;;) {
				int c = *term;
				if(!c)
					Error("Unexpected end of text");
				term++;
				if(c == ' ' || c == '\n') break;
				switch(c) {
				case 's': {
					Uuid id;
					c = *term;
					if(Key('\"') || Key('\''))
						id = target.GetStyleId(GetText(c));
					else {
						int i = ReadNumber();
						if(i >= 0 && i < styleid.GetCount())
							id = styleid[i];
						else
							id = RichStyle::GetDefaultId();
					}
					const RichStyle& s = target.GetStyle(id);
					bool p = format.newpage;
					int lng = format.language;
					(RichPara::Format&) format = s.format;
					format.styleid = id;
					format.language = lng;
					format.newpage = p;
					break;
				}
				case '/': format.Italic(!format.IsItalic()); break;
				case '*': format.Bold(!format.IsBold()); break;
				case '_': format.Underline(!format.IsUnderline()); break;
				case 'T': format.NonAntiAliased(!format.IsNonAntiAliased()); break;
				case '-': format.Strikeout(!format.IsStrikeout()); break;
				case 'c': format.capitals = !format.capitals; break;
				case 'd': format.dashed = !format.dashed; break;
				case '`': format.sscript = format.sscript == 1 ? 0 : 1; break;
				case ',': format.sscript = format.sscript == 2 ? 0 : 2; break;
				case '^': format.link = GetText('^'); break;
				case 'I': format.indexentry = FromUtf8(GetText(';')); break;
				case '+': format.Height(GetNumber()); break;
				case '@': format.ink = GetColor(); break;
				case '$': format.paper = GetColor(); break;
				case 'A': format.Face(Font::ARIAL); break;
				case 'R': format.Face(Font::ROMAN); break;
				case 'C': format.Face(Font::COURIER); break;
				case 'G': format.Face(Font::STDFONT); break;
				case 'S':
#ifdef PLATFORM_WIN32
					format.Face(Font::SYMBOL);
#endif
					break;
				case '.': {
					int n = GetNumber();
					if(n >= Font::GetFaceCount())
						Error("Invalid face number");
					format.Face(n); break;
				}
				case '!': {
						String fn = GetText('!');
						int i = Font::FindFaceNameIndex(fn);
						if(i < 0)
							i = Font::ARIAL;
						format.Face(i);
					}
					break;
				case '{': {
						String cs = GetText('}');
						if(cs.GetLength() == 1) {
							int c = *cs;
							if(c == '_')
								format.charset = CHARSET_UTF8;
							if(c >= '0' && c <= '8')
								format.charset = c - '0' + CHARSET_WIN1250;
							if(c >= 'A' && c <= 'Z')
								format.charset = c - '0' + CHARSET_ISO8859_1;
						}
						else {
							for(int i = 0; i < CharsetCount(); i++)
								if(stricmp(CharsetName(i), cs) == 0) {
									format.charset = i;
									break;
								}
						}
						break;
					}
				case '%': {
						String h;
						if(*term == '-') {
							format.language = 0;
							term++;
						}
						else
						if(*term == '%') {
							format.language = LNG_ENGLISH;
							term++;
						}
						else {
							while(*term && h.GetLength() < 5)
								h.Cat(*term++);
							format.language = LNGFromText(h);
						}
						break;
					}
				case 'g':
					format.Face(Font::STDFONT);
					format.Height(GetRichTextScreenStdFontHeight());
					break;
				default:
					if(c >= '0' && c <= '9') {
						format.Height(QTFFontHeight[c - '0']);
						break;
					}
					switch(c) {
					case ':': format.label = GetText(':'); break;
					case '<': format.align = ALIGN_LEFT; break;
					case '>': format.align = ALIGN_RIGHT; break;
					case '=': format.align = ALIGN_CENTER; break;
					case '#': format.align = ALIGN_JUSTIFY; break;
					case 'l': format.lm = GetNumber(); break;
					case 'r': format.rm = GetNumber(); break;
					case 'i': format.indent = GetNumber(); break;
					case 'b': format.before = GetNumber(); break;
					case 'a': format.after = GetNumber(); break;
					case 'P': format.newpage = !format.newpage; break;
					case 'k': format.keep = !format.keep; break;
					case 'K': format.keepnext = !format.keepnext; break;
					case 'H': format.ruler = GetNumber(); break;
					case 'h': format.rulerink = GetColor(); break;
					case 'L': format.rulerstyle = GetNumber(); break;
					case 'Q': format.orphan = !format.orphan; break;
					case 'n': format.before_number = GetText(';'); break;
					case 'm': format.after_number = GetText(';'); break;
					case 'N': {
						memset(format.number, 0, sizeof(format.number));
						format.reset_number = false;
						int i = 0;
						while(i < 8) {
							int c;
							if(Key('-'))
								c = RichPara::NUMBER_NONE;
							else
							if(Key('1'))
								c = RichPara::NUMBER_1;
							else
							if(Key('0'))
								c = RichPara::NUMBER_0;
							else
							if(Key('a'))
								c = RichPara::NUMBER_a;
							else
							if(Key('A'))
								c = RichPara::NUMBER_A;
							else
							if(Key('i'))
								c = RichPara::NUMBER_i;
							else
							if(Key('I'))
								c = RichPara::NUMBER_I;
							else
								break;
							format.number[i++] = c;
						}
						if(Key('!'))
							format.reset_number = true;
						break;
					}
					case 'o': format.bullet = RichPara::BULLET_ROUND;
					          format.indent = 150; break;
					case 'O':
						if(Key('_'))
							format.bullet = RichPara::BULLET_NONE;
						else {
							int c = *term++;
							if(!c)
								Error("Unexpected end of text");
							format.bullet =
							                c == '1' ? RichPara::BULLET_ROUNDWHITE :
							                c == '2' ? RichPara::BULLET_BOX :
							                c == '3' ? RichPara::BULLET_BOXWHITE :
							                c == '9' ? RichPara::BULLET_TEXT :
							                           RichPara::BULLET_ROUND;
						}
						break;
					case 'p':
						switch(*term++) {
						case 0:   Error("Unexpected end of text");
						case 'h': format.linespacing = RichPara::LSP15; break;
						case 'd': format.linespacing = RichPara::LSP20; break;
						default:  format.linespacing = RichPara::LSP10;
						}
						break;
					case 't':
						if(IsDigit(*term)) //temporary fix... :(
							format.tabsize = ReadNumber();
						break;
					case '~': {
							if(Key('~'))
								format.tab.Clear();
							else {
								RichPara::Tab tab;
								Key('<');
								if(Key('>'))
									tab.align = ALIGN_RIGHT;
								if(Key('='))
									tab.align = ALIGN_CENTER;
								if(Key('.'))
									tab.fillchar = 1;
								if(Key('-'))
									tab.fillchar = 2;
								if(Key('_'))
									tab.fillchar = 3;
								int rightpos = Key('>') ? RichPara::TAB_RIGHTPOS : 0;
								tab.pos = rightpos | ReadNumber();
								format.tab.Add(tab);
							}
						}
						break;
					default:
						continue;
					}
				}
			}
			SetFormat();
		}
		else
		if(Key(']')) {
			Flush();
			if(fstack.GetCount()) {
				format = fstack.Top();
				fstack.Drop();
			}
			else
				Error("Unmatched ']'");
		}
		else
		if(Key2('{')) {
			if(oldtab)
				Error("{{ in ++ table");
			if(text.GetLength() || paragraph.GetCount())
				EndPart();
			table.Add();
			int r = IsDigit(*term) ? ReadNumber() : 1;
			Table().AddColumn(r);
			while(Key(':'))
				Table().AddColumn(ReadNumber());
			TableFormat();
			SetFormat();
		}
		else
		if(Key2('}')) {
			if(oldtab)
				Error("}} in ++ table");
			FinishTable();
		}
		else
		if(Key2('+'))
			if(oldtab)
				FinishOldTable();
			else {
				Flush();
				if(text.GetLength() || paragraph.GetCount())
					EndPart();
				Tab& b = table.Add();
				b.rown.Add(0);
				b.hspan = 1;
				b.Old();
				oldtab = true;
			}
		else
		if(Key2('|'))
			FinishCell();
		else
		if(Key2('-')) {
			FinishCell();
			table.Top().rown.Add(0);
		}
		else
		if(Key2(':')) {
			if(!oldtab)
				FinishCell();
			TableFormat(oldtab);
		}
		else
		if(Key2('^')) {
			EndPart();
			breakpage = true;
		}
		else
		if(Key2('@')) {
			ReadObject();
		}
		else
		if(Key2('@', '$')) {
			String xu;
			while(isxdigit(*term))
				xu.Cat(*term++);
			int c = stou(~xu, NULL, 16);
			if(c >= 32)
				Cat(c);
			if(*term == ';')
				term++;
			SetFormat();
		}
		else
		if(Key2('^', 'H'))
			target.SetHeaderQtf(GetText2('^', '^'));
		else
		if(Key2('^', 'F'))
			target.SetFooterQtf(GetText2('^', '^'));
		else
		if(Key2('{', ':')) {
			Flush();
			String field = GetText(':');
			String param = GetText(':');
			Id fid(field);
			if(RichPara::fieldtype().Find(fid) >= 0)
				paragraph.Cat(fid, param, format);
			Key('}');
		}
		else
		if(Key('&')) {
			SetFormat();
			EndPart();
		}
		else
		if(Key2('$')) {
			Flush();
			int i = GetNumber();
			Uuid id;
			RichStyle style;
			style.format = format;
			if(Key(','))
				stylenext.At(i, 0) = GetNumber();
			else
				stylenext.At(i, 0) = i;
			if(Key('#')) {
				String xu;
				while(isxdigit(*term))
					xu.Cat(*term++);
				if(xu.GetLength() != 32)
					Error("Invalid UUID !");
				id = ScanUuid(xu);
			}
			else
				if(i)
					id = Uuid::Create();
				else
					id = RichStyle::GetDefaultId();
			if(Key(':'))
				style.name = GetText(']');
			if(fstack.GetCount()) {
				format = fstack.Top();
				fstack.Drop();
			}
			target.SetStyle(id, style);
			styleid.At(i, RichStyle::GetDefaultId()) = id;
			if(id == RichStyle::GetDefaultId()) {
				bool p = format.newpage;
				int lng = format.language;
				(RichPara::Format&) format = style.format;
				format.styleid = id;
				format.language = lng;
				format.newpage = p;
			}
		}
		else
		if(*term == '_') {
			SetFormat();
			text.Cat(160);
			term++;
		}
		else
		if(Key2('-', '|')) {
			SetFormat();
			text.Cat(9);
		}
		else
		if(*term == '\1') {
			if(istable)
				EndPart();
			SetFormat();
			const char *b = ++term;
			for(; *term && *term != '\1'; term++) {
				if((byte)*term == '\n') {
					text.Cat(ToUnicode(b, (int)(term - b), format.charset));
					EndPart();
					b = term + 1;
				}
				if((byte)*term == '\t') {
					text.Cat(ToUnicode(b, (int)(term - b), format.charset));
					text.Cat(9);
					b = term + 1;
				}
			}
			text.Cat(ToUnicode(b, (int)(term - b), format.charset));
			if(*term == '\1')
				term++;
		}
		else {
			if(!Key('`')) Key('\\');
			if((byte)*term >= ' ') {
				SetFormat();
				do {
					if(istable)
						EndPart();
					if(format.charset == CHARSET_UTF8) {
						word code = (byte)*term++;
						if(code <= 0x7F)
							Cat(code);
						else
						if(code <= 0xDF) {
							if(*term == '\0') break;
							int c0 = (byte)*term++;
							if(c0 < 0x80)
								Error("Invalid UTF-8 sequence");
							Cat(((code - 0xC0) << 6) + c0 - 0x80);
						}
						else
						if(code <= 0xEF) {
							int c0 = (byte)*term++;
							int c1 = (byte)*term++;
							if(c0 < 0x80 || c1 < 0x80)
								Error("Invalid UTF-8 sequence");
							Cat(((code - 0xE0) << 12) + ((c0 - 0x80) << 6) + c1 - 0x80);
						}
						else
							Error("Invalid UTF-8 sequence");
					}
					else
						Cat(ToUnicode((byte)*term++, format.charset));
				}
				while((byte)*term >= 128 || s_nodeqtf[(byte)*term]);
			}
			else
			if(*term)
				term++;
		}
	}
//	if(paragraph.GetCount() == 0) // TRC 11/02/15: kills formatting of last paragraph in text
//		SetFormat();
	if(oldtab)
		FinishOldTable();
	else
		while(table.GetCount())
			FinishTable();
	EndPart();
	FlushStyles();
}
Beispiel #23
0
void ODBCConnection::SetParam(int i, const Value& r)
{
	param.At(i) = r;
/*
	Param& p = param.At(i);
	p.orig = r;
	p.width = 0;
	if(IsNull(r)) {
		p.li = SQL_NULL_DATA;
		p.ctype = SQL_C_CHAR;
		p.sqltype = SQL_VARCHAR;
		p.data = NULL;
		return;
	}
	if(IsNumber(r)) {
		if(r.Is<int64>()) {
			int64 x = r;
			p.ctype = SQL_C_SBIGINT;
			p.sqltype = SQL_BIGINT;
			p.data = String((char *)&x, sizeof(x));
			p.li = sizeof(x);
		}
		else {
			double x = r;
			if(x >= INT_MIN && x < INT_MAX && (int)x == x) {
				long int h = (int)x;
				p.ctype = SQL_C_SLONG;
				p.sqltype = SQL_INTEGER;
				p.data = String((char *)&h, sizeof(h));
				p.li = sizeof(h);
			}
			else {
				p.ctype = SQL_C_DOUBLE;
				p.sqltype = SQL_DOUBLE;
				p.data = String((char *)&x, sizeof(x));
				p.li = sizeof(x);
			}
		}
	}
	if(IsString(r)) {
		p.ctype = SQL_C_CHAR;
		p.sqltype = SQL_VARCHAR;
		p.data = r;
		p.li = p.data.GetLength();
	}
	if(IsDateTime(r)) {
		p.ctype = SQL_C_TYPE_TIMESTAMP;
		p.sqltype = SQL_TYPE_TIMESTAMP;
		Time t = r;
		SQL_TIMESTAMP_STRUCT tm;
		tm.year = t.year;
		tm.month = t.month;
		tm.day = t.day;
		tm.hour = t.hour;
		tm.minute = t.minute;
		tm.second = t.second;
		tm.fraction = 0;
		p.data = String((char *)&tm, sizeof(tm));
		p.li = sizeof(tm);
	}
	if(r.GetType() == 34) {
		p.data = SqlRaw(r);
		p.ctype = SQL_C_BINARY;
		p.sqltype = SQL_LONGVARBINARY;
		p.width = p.li = p.data.GetLength();
	}
*/
}
Beispiel #24
0
inline T At(const Vector<T, N>& a, std::size_t i, T fallback)
{
	return a.At(i, fallback);
}
Beispiel #25
0
inline T At(const Vector<T, N>& a, std::size_t i)
{
	return a.At(i);
}
Beispiel #26
0
    void JSBHaxe::ExportModuleClasses(JSBModule* module)
    {
        Vector<SharedPtr<JSBClass>> classes = module->GetClasses();

        if (!classes.Size())
            return;

        source_ += "\n";

        for (unsigned i = 0; i < classes.Size(); i++)
        {
            JSBClass* klass = classes.At(i);

            if (klass->IsNumberArray()) {
                source_ += "typedef " + klass->GetName() + " = Array<Float>;\n";
                continue;
            }

            source_ += "@:native(\"Atomic." + klass->GetName() + "\")\n";

            source_ += "extern class " + klass->GetName();

            JSBClass* base = klass->GetBaseClass();

            if (base)
            {
                    source_ += " extends " + base->GetName();
            }

            source_ += " {\n\n";

            Vector<String> propertyNames;

            klass->GetPropertyNames(propertyNames);

            for (unsigned j = 0; j < propertyNames.Size(); j++)
            {

                JSBProperty* prop = klass->GetProperty(propertyNames[j]);

                JSBFunctionType* ftype = NULL;

                if (prop->getter_ && !prop->getter_->Skip())
                {
                    ftype = prop->getter_->GetReturnType();
                }
                else if (prop->setter_ && !prop->setter_->Skip())
                    ftype = prop->setter_->GetParameters()[0];

                if (!ftype)
                    continue;

                String scriptType = GetScriptType(ftype);
                String scriptName = prop->GetCasePropertyName();

                if (!checkV(klass, scriptName, scriptType)) {
                    //rename haxe reserved words
                    if (scriptName == "override") {
                        scriptName = "overide";
                    }
                    if (scriptName == "dynamic") {
                        scriptName = "dynamik";
                    }
                    source_ += "    var " + scriptName + ": " + scriptType + ";\n";
                }

            }

            if (propertyNames.Size())
                source_ += "\n";

            JSBFunction* constructor = klass->GetConstructor();
            if (constructor)
            {
                ExportFunction(constructor);
                source_ += "\n";
            }

            PODVector<JSBFunction*>& functions = klass->GetFunctions();

            for (unsigned j = 0; j < functions.Size(); j++)
            {

                JSBFunction* func = functions[j];

                if (func->IsConstructor() || func->IsDestructor() || func->Skip())
                    continue;

                ExportFunction(func);
            }

            for (unsigned j = 0; j < klass->GetNumHaxeDecl(); j++)
            {
                source_ += "      " + klass->GetHaxeDecl(j) + "\n";
            }

            source_ += "\n}\n\n";

        }

        source_ += "\n";

    }
Beispiel #27
0
void JSBModule::Load(const String &moduleJSONFilename)
{
    ResourceCache* cache = JSBind::context_->GetSubsystem<ResourceCache>();

    JSONFile* moduleJSONFile = cache->GetResource<JSONFile>(moduleJSONFilename);

    if (!moduleJSONFile)
    {
        LOGERRORF("Couldn't load module json: %s", moduleJSONFilename.CString());
        ErrorExit("Couldn't load module json");
    }

    JSONValue moduleJSON = moduleJSONFile->GetRoot();
    JSONValue sources = moduleJSON.GetChild("sources");
    JSONValue classes = moduleJSON.GetChild("classes");
    JSONValue includes = moduleJSON.GetChild("includes");
    JSONValue classes_rename = moduleJSON.GetChild("classes_rename");
    JSONValue overloads = moduleJSON.GetChild("overloads");
    JSONValue requires = moduleJSON.GetChild("requires");

    HashMap<String, String> rename;

    if (requires.IsArray())
    {
        for (unsigned j = 0; j < requires.GetSize(); j++)
        {
            requirements_.Push(requires.GetString(j));
        }

    }

    if (classes_rename.IsObject())
    {
        Vector<String> childNames = classes_rename.GetValueNames();
        for (unsigned j = 0; j < childNames.Size(); j++)
        {
            String classname = childNames.At(j);
            String crename = classes_rename.GetString(classname);

            rename[classname] = crename;

        }

    }

    if (includes.IsArray())
    {
        for (unsigned j = 0; j < includes.GetSize(); j++)
        {
            includes_.Push(includes.GetString(j));

        }
    }

    if (classes.IsArray())
    {
        for (unsigned j = 0; j < classes.GetSize(); j++)
        {
            String classname = classes.GetString(j);

            if (rename.Contains(classname))
                bindings_->RegisterClass(classname, rename[classname]);
            else
                bindings_->RegisterClass(classname);

        }
    }

    if (overloads.IsObject())
    {
        Vector<String> childNames = overloads.GetChildNames();

        for (unsigned j = 0; j < childNames.Size(); j++)
        {
            String classname = childNames.At(j);

            JSBClass* klass = bindings_->GetClass(classname);
            if (!klass)
            {
                ErrorExit("Bad overload klass");
            }

            JSONValue classoverloads = overloads.GetChild(classname);

            Vector<String> functionNames = classoverloads.GetChildNames();

            for (unsigned k = 0; k < functionNames.Size(); k++)
            {
                JSONValue sig = classoverloads.GetChild(functionNames[k]);

                if (!sig.IsArray())
                {
                    ErrorExit("Bad overload defintion");
                }

                Vector<String> values;
                for (unsigned x = 0; x < sig.GetSize(); x++)
                {
                    values.Push(sig.GetString(x));
                }

                JSBFunctionOverride* fo = new JSBFunctionOverride(functionNames[k], values);
                klass->AddFunctionOverride(fo);

            }

        }

    }

    this->name_ = moduleJSON.GetString("name");

    if (this->name_ == "Graphics")
    {
#ifdef _MSC_VER
        sources.AddString("Graphics/Direct3D9");
#else
        sources.AddString("Graphics/OpenGL");
#endif
    }

    for (unsigned j = 0; j < sources.GetSize(); j++)
    {
        String sourceFolder = sources.GetString(j);
        Vector<String> fileNames;

        String sourceRoot = "Atomic";

        if (sourceFolder == "Javascript")
            sourceRoot = "AtomicJS";

        JSBind::fileSystem_->ScanDir(fileNames, JSBind::ROOT_FOLDER + "/Source/" + sourceRoot + "/" + sourceFolder, "*.h", SCAN_FILES, false);
        for (unsigned k = 0; k < fileNames.Size(); k++)
        {
            // TODO: filter
            String filepath = JSBind::ROOT_FOLDER + "/Source/" + sourceRoot + "/" + sourceFolder + "/" + fileNames[k];

            this->headerFiles_.Push(filepath);
        }

    }

}
bool GameEconomicServer::verifyDBMarket(Vector<String> TableName,Vector<String> TableNameParameter)
{


    /// get db
    connectorDB * connectionDB = GetSubsystem<connectorDB>();


    /// Set up a single statement
    bool multipletablenames=false;

    /// Table name does not match
    if(TableName.Size()!=TableNameParameter.Size())
    {
        return false;
    }

    /// Table name does not match
    if(TableName.Empty()||TableNameParameter.Empty())
    {
        return false;
    }

    /// Muiltiple parameters
    if(TableName.Size()>1)
    {
        multipletablenames=true;
    }

    /// Prepare statement
    String PreparedStatement("SELECT MarketIdx FROM Markets WHERE ");

    /// loop through each one
    for(unsigned int i=0; i<TableName.Size(); i++)
    {
        if(multipletablenames&&i!=0)
        {
            PreparedStatement.Append(" AND ");
        }
        /// unique values
        /// unique values
        if(TableName.At(i).ToLower()=="marketname")
        {
            PreparedStatement.Append("MarketName = '"+TableNameParameter.At(i)+"'");
        };
        if(TableName.At(i).ToLower()=="marketuniqueid")
        {
            PreparedStatement.Append("MarketUniqueID = '"+TableNameParameter.At(i)+"'");
        };
    }

    /// end statement
    PreparedStatement.Append(";");

    /// Change statement to string
    string mysqlpreparedstatement =string(PreparedStatement.CString());

    /// attempt to write
    if(!connectionDB -> executePreparedStatement(mysqlpreparedstatement))
    {
        return false;
    }


    return true;
}
/// select Transaction
Vector<String> GameEconomicServer::selectDBMarketTransaction(Vector<String> TableName,Vector<String> TableNameParameter)
{

    /// get db
    connectorDB * connectionDBMarketTransaction = GetSubsystem<connectorDB>();

    /// Set up a single statement
    bool multipletablenames=false;

    Vector<String> Results;

    /// Table name does not match
    if(TableName.Size()!=TableNameParameter.Size())
    {
        return Results;
    }

    /// Muiltiple parameters
    if(TableName.Size()>1)
    {
        multipletablenames=true;
    }

    /// Prepare statement
    String PreparedStatement("SELECT * FROM MarketTransactions");

    if(TableName.Size()!=0)
    {
        PreparedStatement.Append(" WHERE ");
    }

    /// loop through each one
    for(unsigned int i=0; i<TableName.Size(); i++)
    {
        if(multipletablenames&&i!=0)
        {
            PreparedStatement.Append(" AND ");
        }

        /// unique values
        if(TableName.At(i).ToLower()=="transactionname")
        {
            PreparedStatement.Append("TransactionName = '"+TableNameParameter.At(i)+"'");
        };
        if(TableName.At(i).ToLower()=="transactionuniqueid")
        {
            PreparedStatement.Append("TransactionUniqueID = '"+TableNameParameter.At(i)+"'");
        };
        if(TableName.At(i).ToLower()=="transactionseller")
        {
            PreparedStatement.Append("TransactionSeller = '"+TableNameParameter.At(i)+"'");
        };
    }

    /// end statement
    PreparedStatement.Append(";");

    /// Change statement to string
    string mysqlpreparedstatement =string(PreparedStatement.CString());

    /// attempt to write
    Results = connectionDBMarketTransaction -> executePreparedStatementResult(mysqlpreparedstatement);

    return Results;
}
bool GameEconomicServer::editDBMarketTransaction(Vector<String> TableName,Vector<String> TableNameParameter, String UniqueID)
{
    /// get db
    connectorDB * connectionDBMarketTransaction = GetSubsystem<connectorDB>();

    /// Set up a single statement
    bool multipletablenames=false;

    /// Table name does not match
    if(TableName.Size()!=TableNameParameter.Size())
    {
        return false;
    }

    /// Table name does not match
    if(TableName.Empty()||TableNameParameter.Empty())
    {
        return false;
    }

    /// Muiltiple parameters
    if(TableName.Size()>1)
    {
        multipletablenames=true;
    }



    /// Prepare statement
    String PreparedStatement("UPDATE Transactions SET ");

    /// loop through each one
    for(unsigned int i=0; i<TableName.Size(); i++)
    {
        if(multipletablenames&&i>0)
        {
            PreparedStatement.Append(",");
        }
        /// unique values
        /// unique values
        if(TableName.At(i).ToLower()=="transactionname")
        {
            PreparedStatement.Append("TransactionName = '"+TableNameParameter.At(i)+"'");
        };
        if(TableName.At(i).ToLower()=="transactionuniqueid")
        {
            PreparedStatement.Append("TransactionUniqueID = '"+TableNameParameter.At(i)+"'");
        };
        if(TableName.At(i).ToLower()=="transactionseller")
        {
            PreparedStatement.Append("TransactionSeller = '"+TableNameParameter.At(i)+"'");
        };
    }

    /// end statement
    PreparedStatement.Append(" WHERE TransactionUniqueID='");

    PreparedStatement.Append(UniqueID);

    PreparedStatement.Append("' LIMIT 1;");

    /// Change statement to string
    string mysqlpreparedstatement = string(PreparedStatement.CString());

    /// attempt to write
    if(!connectionDBMarketTransaction -> executePreparedStatement(mysqlpreparedstatement))
    {
        return false;
    }

    return true;
}