From 34cf62b18134b5f17262996fe2651bd94980a848 Mon Sep 17 00:00:00 2001 From: Raymond Date: Tue, 8 Feb 2011 16:20:28 +0100 Subject: [PATCH] Some minor changes.. Revert if you dislike. --- Units/MMLAddon/PSInc/Wrappers/extensions.inc | 16 +--------------- Units/MMLAddon/PSInc/Wrappers/math.inc | 10 ++++++++++ Units/MMLAddon/PSInc/Wrappers/other.inc | 15 ++------------- Units/MMLAddon/PSInc/psexportedmethods.inc | 7 ++++--- 4 files changed, 17 insertions(+), 31 deletions(-) diff --git a/Units/MMLAddon/PSInc/Wrappers/extensions.inc b/Units/MMLAddon/PSInc/Wrappers/extensions.inc index b125994..ba14ff9 100644 --- a/Units/MMLAddon/PSInc/Wrappers/extensions.inc +++ b/Units/MMLAddon/PSInc/Wrappers/extensions.inc @@ -170,21 +170,7 @@ end; procedure ext_OpenScriptEx(FileName: string; Run: boolean); begin FileName := SetDirSeparators(FileName); - with SimbaForm do - begin - AddTab(); - with CurrScript do - begin - SynEdit.Lines.LoadFromFile(FileName); - StartText := SynEdit.Lines.Text; - ScriptName := ExtractFileNameOnly(FileName); - ScriptFile := FileName; - ScriptChanged := False; - end; - RefreshTab(); - UpdateTitle(); - end; - + SimbaForm.LoadScriptFile(FileName,True,false); if (Run) then SimbaForm.RunScript(); end; diff --git a/Units/MMLAddon/PSInc/Wrappers/math.inc b/Units/MMLAddon/PSInc/Wrappers/math.inc index 07dc6c7..1d41e35 100644 --- a/Units/MMLAddon/PSInc/Wrappers/math.inc +++ b/Units/MMLAddon/PSInc/Wrappers/math.inc @@ -107,6 +107,16 @@ begin Result:=Random(Abs(aFrom-aTo))+Min(aTo,AFrom); end; +function ps_Random(Int: integer): integer; extdecl; +begin + result := Random(int); +end; + +function ps_RandomE : extended; +begin + result := Random; +end; + function ps_ArcTan2(y,x : extended) : extended; extdecl; begin result := ArcTan2(y,x); diff --git a/Units/MMLAddon/PSInc/Wrappers/other.inc b/Units/MMLAddon/PSInc/Wrappers/other.inc index c793ecc..e12cedb 100644 --- a/Units/MMLAddon/PSInc/Wrappers/other.inc +++ b/Units/MMLAddon/PSInc/Wrappers/other.inc @@ -37,21 +37,15 @@ begin; end; {$ENDIF} -procedure ps_Wait(t: Integer); extdecl; +procedure ps_Wait(t: DWord); extdecl; {$ifdef MSWINDOWS} begin - if t < 0 then - raise Exception.CreateFmt('The given wait time ([%d]) is invalid.',[t]) - else - Sleep(t); + Sleep(t); end; {$else} var EndTime : DWord; begin - if t < 0 then - raise Exception.CreateFmt('The given wait time ([%d]) is invalid.',[t]); - if t > 50 then begin; EndTime := GetTickCount + t; @@ -266,11 +260,6 @@ begin '+//1sR/NLyhCQ=='))); end; -function ps_Random(Int: integer): integer; extdecl; -begin - result := Random(int); -end; - procedure ps_SetClipBoard(const Data: string); extdecl; begin try diff --git a/Units/MMLAddon/PSInc/psexportedmethods.inc b/Units/MMLAddon/PSInc/psexportedmethods.inc index 59b2e19..87b60e3 100644 --- a/Units/MMLAddon/PSInc/psexportedmethods.inc +++ b/Units/MMLAddon/PSInc/psexportedmethods.inc @@ -76,6 +76,8 @@ AddFunction(@ps_point,'function Point(x,y:integer) : TPoint;'); AddFunction(@ps_Distance,'function Distance(xs,ys,xe,ye : integer) : integer;'); AddFunction(@ps_hypot,'function Hypot(X, Y: Extended): Extended;'); AddFunction(@ps_RandomRange,'function RandomRange(aFrom,aTo: Integer): Integer;'); +AddFunction(@ps_Random,'function Random(Int: integer): integer;'); +AddFunction(@ps_RandomE,'function RandomE: extended;'); AddFunction(@ps_incex,'procedure IncEx(var x : integer; increase : integer);'); AddFunction(@ps_DecEx,'procedure DecEx(var x : integer; Decrease : integer);'); AddFunction(@ps_BinCoe,'function BinCoe(a, b: LongInt): Extended;'); @@ -160,8 +162,8 @@ AddFunction(@ps_ExtractFileExt,'function ExtractFileExt(const FileName: string): {other} SetCurrSection('Other'); -AddFunction(@ps_Wait, 'procedure wait(t: integer);'); -AddFunction(@ps_Wait, 'procedure Sleep(t: integer);'); +AddFunction(@ps_Wait, 'procedure wait(t: LongWord);'); +AddFunction(@ps_Wait, 'procedure Sleep(t: LongWord);'); {$IFNDEF MML_EXPORT_THREADSAFE} AddFunction(@ps_GetTClient,'function GetTClient : TClient;'); AddFunction(@ps_SetSupressExceptions, 'procedure SetSupressExceptions(Supress : boolean);'); @@ -180,7 +182,6 @@ AddFunction(@ps_DecodeDate,'procedure DecodeDate ( const SourceDate : TDateTime AddFunction(@ps_ConvertTime,'procedure ConvertTime(Time: integer; var h, m, s: integer);'); AddFunction(@ps_HakunaMatata,'procedure HakunaMatata;'); AddFunction(@ps_Simba,'procedure Simba;'); -AddFunction(@ps_Random,'function Random(Int: integer): integer;'); AddFunction(@ps_PlaySound,'procedure PlaySound( Sound : string);'); AddFunction(@ps_StopSound,'procedure StopSound;'); {$IFNDEF MML_EXPORT_THREADSAFE}