From 074cc78defe813c8bd0e76110552e405004c3411 Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Sat, 30 Jun 2012 16:08:32 -0400 Subject: [PATCH] PutUser and PutThisUser functions added --- mystic/mpl_common.pas | 2 ++ mystic/mpl_execute.pas | 41 +++++++++++++++++++++++++++++++++++++++++ mystic/mpl_types.pas | 2 +- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/mystic/mpl_common.pas b/mystic/mpl_common.pas index 920b2f0..94c1511 100644 --- a/mystic/mpl_common.pas +++ b/mystic/mpl_common.pas @@ -286,6 +286,8 @@ Begin AddProc ({$IFDEF MPLPARSER} 'strmci', {$ENDIF} 's', iString); // 535 AddProc ({$IFDEF MPLPARSER} 'getcharxy', {$ENDIF} 'bb', iChar); // 536 AddProc ({$IFDEF MPLPARSER} 'getattrxy', {$ENDIF} 'bb', iByte); // 537 + AddProc ({$IFDEF MPLPARSER} 'putthisuser' {$ENDIF} '', iNone); // 538 + AddProc ({$IFDEF MPLPARSER} 'putuser', {$ENDIF} 'l', iNone); // 539 { END OF PROCEDURE DEFINITIONS } diff --git a/mystic/mpl_execute.pas b/mystic/mpl_execute.pas index d4d73e6..6352acc 100644 --- a/mystic/mpl_execute.pas +++ b/mystic/mpl_execute.pas @@ -86,7 +86,10 @@ Type Procedure FileWriteLine (Var F: File; Str: String); Procedure GetUserVars (Var U: RecUser); + Procedure PutUserVars (Var U: RecUser); Function GetUserRecord (Num: LongInt) : Boolean; + Procedure PutUserRecord (Num: LongInt); + Procedure GetMBaseVars (Var M: RecMessageBase); Function GetMBaseRecord (Num: LongInt) : Boolean; Procedure GetMGroupVars (Var G: RecGroup); @@ -166,6 +169,22 @@ Begin Move (U.Flags, VarData[IdxVarUser + 11]^.Data^, SizeOf(U.Flags)); End; +Procedure TInterpEngine.PutUserVars (Var U: RecUser); +Begin + Move (VarData[IdxVarUser ]^.Data^, U.PermIdx, SizeOf(U.PermIdx)); + Move (VarData[IdxVarUser + 1 ]^.Data^, U.RealName, SizeOf(U.RealName)); + Move (VarData[IdxVarUser + 2 ]^.Data^, U.Handle, SizeOf(U.Handle)); + Move (VarData[IdxVarUser + 3 ]^.Data^, U.Address, SizeOf(U.Address)); + Move (VarData[IdxVarUser + 4 ]^.Data^, U.Security, SizeOf(U.Security)); + Move (VarData[IdxVarUser + 5 ]^.Data^, U.Gender, SizeOf(U.Gender)); + Move (VarData[IdxVarUser + 6 ]^.Data^, U.FirstOn, SizeOf(U.FirstOn)); + Move (VarData[IdxVarUser + 7 ]^.Data^, U.LastOn, SizeOf(U.LastOn)); + Move (VarData[IdxVarUser + 8 ]^.Data^, U.DateType, SizeOf(U.DateType)); + Move (VarData[IdxVarUser + 9 ]^.Data^, U.Calls, SizeOf(U.Calls)); + Move (VarData[IdxVarUser + 10]^.Data^, U.Password, SizeOf(U.Password)); + Move (VarData[IdxVarUser + 11]^.Data^, U.Flags, SizeOf(U.Flags)); +End; + Function TInterpEngine.GetUserRecord (Num: LongInt) : Boolean; Var F : File; @@ -184,6 +203,26 @@ Begin Close (F); End; +Procedure TInterpEngine.PutUserRecord (Num: LongInt); +Var + F : File; + U : RecUser; +Begin + Assign (F, Config.DataPath + 'users.dat'); + + If Not ioReset(F, SizeOf(RecUser), fmRWDN) Then Exit; + + PutUserVars(U); + + If Not ioSeek(F, Pred(Num)) Then Begin + Close(F); + Exit; + End; + + IoWrite (F, U); + Close (F); +End; + Procedure TInterpEngine.GetMBaseVars (Var M: RecMessageBase); Begin Move (M.Index, VarData[IdxVarMBase ]^.Data^, SizeOf(M.Index)); @@ -1842,6 +1881,8 @@ Begin Store (TempByte, 1); End; + 538 : PutUserVars(Session.User.ThisUser); + 539 : PutUserRecord(Param[1].L); End; End; diff --git a/mystic/mpl_types.pas b/mystic/mpl_types.pas index 7362799..74529de 100644 --- a/mystic/mpl_types.pas +++ b/mystic/mpl_types.pas @@ -77,7 +77,7 @@ Type ); Const - mplVer = '11@'; + mplVer = '11&'; mplVersion = '[MPX ' + mplVer +']' + #26; mplVerLength = 10; mplExtSource = '.mps';