Sir R. M8gic1an
2010-06-29 08:08:31
As I told Coh3n yesterday, I am currently unable to commit to the svn, (as I haven't yet set up everything I need for it on ubuntu).
So here's a little something to discuss / commit.
I think we're better off having a centralized function, as it will allow for easier updating in the future, rather than going through all the script records and changing it.
And yes, I know that var e is not necessary there. Just looked better to me :p
This might need a change or two to work with everything else the way it currently is set up.
As for the string one, it forces consistency.
Basically, I find it 'stupid' that we'd be filling in the same thing over and over again, when we can just have a function do it for us.
~RM
So here's a little something to discuss / commit.
Function LoadObjExperiences(Objects: TIntegerArray): TExtendedArray;
var
i, e: integer;
begin
for i := 0 to High(Objects) do
begin
e := 0;
case Objects[i] of
{Trees}
OBJ_TREE_NORMAL : e := 25.0;
OBJ_TREE_OAK : e := 37.5;
OBJ_TREE_WILLOW : e := 67.5;
OBJ_TREE_MAPLE : e := 100.0;
OBJ_TREE_YEW : e := 175.0;
OBJ_TREE_MAGIC : e := 250.0;
{Rocks}
OBJ_ROCK_CLAY : e := 5.0;
OBJ_ROCK_TIN : e := 17.5;
OBJ_ROCK_COPPER : e := 17.5;
OBJ_ROCK_IRON : e := 35.0;
OBJ_ROCK_SILVER : e := 40.0;
else MSI_Debug('LoadObjExperiences', 'wrong object in ObjectConstants', DEBUG_FORCE);
end;
Result[i] := e;
end;
end;
function LoadItemNames(Items: TIntegerArray): TStringArray;
var
i: integer;
s: string;
begin
for i:= 0 to High(Items) do
begin
s := '';
case i of
ITEM_LOGS_NORMAL : s := 'Normal Logs';
ITEM_LOGS_OAK : s := 'Oak Logs';
ITEM_LOGS_WILLOW : s := 'Willow Logs';
ITEM_LOGS_MAPLE : s := 'Mapple Logs';
ITEM_LOGS_YEW : s := 'Yew Logs';
else MSI_Debug('LoadItemNames', 'wrong item in ItemConstants', DEBUG_FORCE);
end;
Result[i] := s;
end;
end;
I think we're better off having a centralized function, as it will allow for easier updating in the future, rather than going through all the script records and changing it.
And yes, I know that var e is not necessary there. Just looked better to me :p
This might need a change or two to work with everything else the way it currently is set up.
As for the string one, it forces consistency.
Basically, I find it 'stupid' that we'd be filling in the same thing over and over again, when we can just have a function do it for us.
~RM