The online racing simulator
Maybe something similar to this:

Dictionary<string,byte> carToTimerDic = ...
carToTimerDic.add("BFG",15); //I predefine all this

in place of the case i put this:


if (carToTimerDic.ContainKey("BFG"))
return carToTimerDic["BFG"] (MyTimerDefine value)
else
return 0; // or anything you love
#27 - sun
the BFG.. is that the carname or just BFG ?
I believe it's the BFG 9000.

... More seriously... I think Greenseed was using BFG as a placeholdfer for other cars.

The first part (as I understand), is him creating an array called "carToTimerDic", and then in each if statement, simply calling the value from the array.
here is a more profiled version



public static readonly Dictionary<string,byte> carTimerLength = new Dictionary<string,byte>
{
{"UF1",5},
{"XFG",5},
{"XRG",6},
{"LX4",6},
{"RAC",7},
// and so on

};
public byte GetTimerLength(string carPrefix)
{
if (carTimerLength.ContainsKey(carPrefix))
return carTimerLength[carPrefix];
else
return 0; // or what ever is your default value
}

Quote from dougie-lampkin :Lolz I wrote this yonks ago. Real spaghetti code. If I wanted to, several thousand lines could be removed. But I gave up

@Sun: You can't just cut and paste parts of it into other programs, unless you actually know and understand what each part does. Otherwise, this happens...

BTW: He is doing it for the same guy who you did it for .
Quote from shaun463 :BTW: He is doing it for the same guy who you did it for .

Ah...could turn out interesting
Josh (pro_drift_93). Or was. He got sacked by Josh !
Quote from shaun463 :Josh (pro_drift_93). Or was. He got sacked by Josh !

or maybe he left cause didn't want to waste his time on him?
2

FGED GREDG RDFGDR GSFDG