Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

VP_GetContact() broken in CMO version?

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> VP_GetContact() broken in CMO version? Page: [1]
Login
Message << Older Topic   Newer Topic >>
VP_GetContact() broken in CMO version? - 6/27/2020 5:53:41 AM   
KnightHawk75

 

Posts: 980
Joined: 11/15/2018
Status: online
Another one I've been meaning to ask about for awhile for CMO (at least all recent 114x.x builds tested).

Attached is a scene though just about any scene will do to highlight that VP_GetContact() appears broken due to a case conversion issue on the submitted guid. Load the scene, run the following.

local u = SE_GetUnit({name='Stinger #1', guid='4FH7PU-0HM0LV5RLV4JO'});
print(u.ascontact)
for k,v in pairs(u.ascontact) do
  local c = VP_GetContact({GUID=v.guid}); -- error here, submitted contact guid will be 4FH7PU-0HM0LV5RMAMDN 
  print(c);
end

--If you want to check the contacts for the detecting side you can see this is the valid contact guid.
local s = VP_GetSide({NAME="EC"})
for k,v in pairs(s.contacts) do
 if v.guid == '4FH7PU-0HM0LV5RMAMDN' then
   print(v); 
 end
end
The problem is 4FH7PU-0HM0LV5RMAMDN is being converted to lowercase in the compare, and compare is not flagged as textcompare, one or the other needs to change. For Devs you're looking for the following in the handler function for VP_Contacts inside the first for-each on the sides contact list that will look something like:
if (Operators.CompareString(the contact.guid that is caps, submittedGuid.ToLower(), false) == 0)

The change needed is either remove the .ToLower for CMO, OR change the false param for text compare to true and optionally don't bother with the the case conversion. When set to true in testing the function works as expected and successfully finds the match and returns me the contact. The textcompare param change option strikes me as more likely to work for any version of the code base.

Now there is of course a second attempt to do the match, and that one uses string.equals() with the ordinalIgnoreCase option as it should. However it never gets that far because at least in this case, the for-each is operating on the side's Lazy<ConcurrentDictionary<string,Contact> object which is empty for all sides, and seems to always be during my testing but maybe it's not always the case.

As for when it broke, probably since CMO release is my guess, last time I ran into it some months back I was able to avoid using the function for what I needed and forgot to report it or ask about it after being distracted with another issue.



Attachment (1)

< Message edited by KnightHawk75 -- 6/27/2020 5:54:49 AM >
Post #: 1
RE: VP_GetContact() broken in CMO version? - 6/27/2020 6:14:17 AM   
michaelm75au


Posts: 13197
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
Yea, that has been there always.

_____________________________

Michael

(in reply to KnightHawk75)
Post #: 2
RE: VP_GetContact() broken in CMO version? - 6/27/2020 6:28:09 AM   
michaelm75au


Posts: 13197
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
I'll add it to my list.
Fixed by using the common validation - as you can see from image, it uses either case.

In future buidl




Attachment (1)

< Message edited by michaelm75au -- 6/27/2020 10:23:16 AM >


_____________________________

Michael

(in reply to michaelm75au)
Post #: 3
RE: VP_GetContact() broken in CMO version? - 6/27/2020 12:27:10 PM   
KnightHawk75

 

Posts: 980
Joined: 11/15/2018
Status: online
Thank you sir that was fast!!

(in reply to michaelm75au)
Post #: 4
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> VP_GetContact() broken in CMO version? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.145