well while working on my mmo in C++ I had made up some classes and functions I figured maybe somone could use
some of it is new functions and some is off the top of my head so no garentee's
and yes I made them
first off is my own improvision of the rand function that allows you to set the max return please note it is advised you start use the line
srand((unsigned)time(0)); befor useing it or will be prone to patterns and that is not good
Code:#include "stdafx.h" #include <iostream> #include <cstdlib> #include <ctime> using namespace std; int rand2(int div) { int a = rand(); long int round = 0; int rhold = RAND_MAX / div; for(;;) { if(a > rhold * round && a < rhold * (round+1)) { return round+1; } else { round++; } } }
next off is my refrence file reader
each file is a list of either int or multi char seperated by ','
please note you need a , at the very end
declare a memory type
example:
memory test;
then you call load
example:
test.load("test", 3, false);
this will load the name in the first arguement as <name>.ref where it till look for it in a data folder in the folder it is in
second one is the number of ID's you want it to load
third is true or false put false only if they are all numbers or will crash
to call char arrays call for <memory name>.id[<number of the one you want to load>]
to call a in <memory name>.gint[<number of the one you want to load>]
Code:Removed Until made a little more user freindly side note: some of your comments actualy caused me to look back at the code and though of yet an even better method of doing this
the memory is good for use on single lists or entire groups of lists by use of multiple classes
I was useing them to read refrence files for monster stats / names for my server files as well as attributes of most things in them and so far it works fast and accuratley without error as long as you make no error in it's use
if you can use it good for you if not oh well please don't spam and I plan to release more later just these are all I had on hand at the moment I could remember exacty how worked
also these are my original works just to restate that for skimmers <_<;


![/[release]C++ code peices](http://ragezone.com/hyper728.png)


