Skip to content

Commit

Permalink
fix RegisterAutoAssemblerCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrinzPlayer committed Jan 19, 2016
1 parent 5ba83aa commit 665e013
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cheat Engine/LuaStrings.pas
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function strings_remove(L: Plua_State): integer; cdecl; //compat with ce 6
if lua_gettop(L)>=1 then
begin
s:=lua_tostring(L, -1);
strings.Delete(strings.IndexOf(s));
if strings.IndexOf(s)<>-1 then strings.Delete(strings.IndexOf(s));
end;
end;

Expand Down
2 changes: 1 addition & 1 deletion Cheat Engine/SynHighlighterAA.pas
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ procedure aa_RemoveExtraCommand(command:pchar);
begin
if extracommands<>nil then
begin
extracommands.Delete(extracommands.IndexOf(command));
if extracommands.IndexOf(command)<>-1 then extracommands.Delete(extracommands.IndexOf(command));
if extracommands.Count=0 then
freeandnil(extracommands);
end;
Expand Down
11 changes: 2 additions & 9 deletions Cheat Engine/autoassembler.pas
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,9 @@ procedure RegisterAutoAssemblerCommand(command: string; callback: TAutoAssembler
if registeredAutoAssemblerCommands=nil then
registeredAutoAssemblerCommands:=TList.Create;

command:=uppercase(command);
for i:=0 to registeredAutoAssemblerCommands.Count-1 do
if TRegisteredAutoAssemblerCommand(registeredAutoAssemblerCommands[i]).command=command then
begin
//update
CleanupLuaCall(tmethod(TRegisteredAutoAssemblerCommand(registeredAutoAssemblerCommands[i]).callback));
TRegisteredAutoAssemblerCommand(registeredAutoAssemblerCommands[i]).callback:=nil;//TAutoAssemblerCallback(callback);
exit;
end;
UnregisterAutoAssemblerCommand(command);

command:=uppercase(command);
c:=TRegisteredAutoAssemblerCommand.create;
c.command:=command;
c.callback:=callback;
Expand Down

0 comments on commit 665e013

Please sign in to comment.