Sir R. M8gic1an
2010-06-28 20:48:41
[php]
PlayerScripts[0] := [SCRIPT_VE_TREES];
PlayerObjects[0] := [[]];
PlayerLocation[0] := LOC_VE_TREES;
[/php]
I was looking at these and thinking:
I guess we aren't using Loc for the location, due to it being a string. I'd find it more organized if we had a LocToString and StringToLoc function, rather than having a new array. That's another array that we're forcing onto memory.
As for Scripts: Players.Integers[I_SCRIPS]
As for Objects: Players.Arrays[I_OBJ]
I'm not entirely sure a variant array will be all that happy to take a TIntegerArray as its variant, but it should be possible.
These changes would also save us an awful lot of code like
[php]
SetLength(PlayerItems[j], Length(PlayerObjects[j]));
SetLength(PlayerItemNames[j], Length(PlayerItems[j]));
SetLength(PlayerExperiences[j], Length(PlayerObjects[j]));
[/php]
If not these changes, at least lets make a TPlayerInfo and have
[php]
PInfo: TPlayerInfo;
with PInfo do
begin
ALength := Length(Objects);
SetLength(Items[j], ALength);
SetLength(ItemNames, ALength);
SetLength(Experiences[j], ALength);
end;
[/php]
This would help clear a lot of code, and saving some ms too.
Also, some things need better separation,
eg.
Progress Report stuff could be in a GetReportInfo function. They don't need to be here, better keep them separate. Easier to find.
Just some changes I thought of, while I looked for that lil problem with the proggie.
~RM
PlayerScripts[0] := [SCRIPT_VE_TREES];
PlayerObjects[0] := [[]];
PlayerLocation[0] := LOC_VE_TREES;
[/php]
I was looking at these and thinking:
{ type TUser;
Description: The User Record. }
type
TUser = record
Name: string; // * User Name
Pass: string; // * User Pass
Loc: string; // * User Location
Integers: array of Integer; // * For reports, etc.
Arrays: array of TVariantArray; // * For custom arrays.
end;
I guess we aren't using Loc for the location, due to it being a string. I'd find it more organized if we had a LocToString and StringToLoc function, rather than having a new array. That's another array that we're forcing onto memory.
As for Scripts: Players.Integers[I_SCRIPS]
As for Objects: Players.Arrays[I_OBJ]
I'm not entirely sure a variant array will be all that happy to take a TIntegerArray as its variant, but it should be possible.
These changes would also save us an awful lot of code like
[php]
SetLength(PlayerItems[j], Length(PlayerObjects[j]));
SetLength(PlayerItemNames[j], Length(PlayerItems[j]));
SetLength(PlayerExperiences[j], Length(PlayerObjects[j]));
[/php]
If not these changes, at least lets make a TPlayerInfo and have
[php]
PInfo: TPlayerInfo;
with PInfo do
begin
ALength := Length(Objects);
SetLength(Items[j], ALength);
SetLength(ItemNames, ALength);
SetLength(Experiences[j], ALength);
end;
[/php]
This would help clear a lot of code, and saving some ms too.
Also, some things need better separation,
eg.
{ procedure MSI_SetPlayerInfo; }
ProgressReportArray[i].PlayerName := Players[i].Name;
ProgressReportArray[i].PlayerStatus := Players[i].Active;
ProgressReportArray[i].PlayerLoc := PlayerLocation[i];
Progress Report stuff could be in a GetReportInfo function. They don't need to be here, better keep them separate. Easier to find.
Just some changes I thought of, while I looked for that lil problem with the proggie.
~RM