Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize weapon and vehicle kustom #13

Closed
wants to merge 8 commits into from
Closed

Conversation

ziggi
Copy link
Contributor

@ziggi ziggi commented Dec 27, 2017

Optimize weapon and vehicle kustom search algorithm to find the item by part of their name.
This not going through all loop with checking every string. This checks only strings witch starts with the same symbol.

@maddinat0r maddinat0r self-assigned this Dec 27, 2017
@maddinat0r
Copy link
Collaborator

I've got some irregularities here when comparing with the old specifier:

weapon "Night Stick": is 44, should be 3: failed!
weapon "Shovel": is 25, should be 6: failed!
weapon "White Dildo": is -1, should be 11: failed!
weapon "Long White Dildo": is -1, should be 12: failed!
weapon "White Dildo 2": is -1, should be 13: failed!
weapon "Mac 10": is -1, should be 28: failed!
weapon "Missile Launcher": is -1, should be 36: failed!
weapon "Detonator": is 24, should be 40: failed!
weapon "Spray Paint": is 23, should be 41: failed!

There are also a lot of failed or wrong matches with your vehicle kustom specifer. However, I can't get them all listed, as there seem to be multiple "array index out of bound" errors (one of them being caused by the -1 check in line 716, as it's never -1 since you always subtract 400, so it always is -401 instead of -1).

@ziggi
Copy link
Contributor Author

ziggi commented Dec 30, 2017

Some weapons was renamed (dildo's, mac, missle, etc). I use values from the wiki this names is more pretty.

@maddinat0r
Copy link
Collaborator

I've hit another invalid array access at index -400 on line 722 when searching for Hotring Racer. You've probably forgot to add a -1 as the last value at line 469 (same thing on line 480 probably).
Here's the list of mismatches:

weapon "Night Stick": is -1, should be 3
weapon "Shovel": is 25, should be 6
weapon "White Dildo": is -1, should be 11
weapon "Long White Dildo": is -1, should be 12
weapon "White Dildo 2": is -1, should be 13
weapon "Mac 10": is -1, should be 28
weapon "Missile Launcher": is -1, should be 36

vehicle "Stretch": is 570, should be 409
vehicle "BF Injection": is 581, should be 424
vehicle "Premier": is 599, should be 426
vehicle "Predator": is 599, should be 430
vehicle "Article Trailer": is -1, should be 435
vehicle "Previon": is 599, should be 436
vehicle "RC Bandit": is -1, should be 441
vehicle "Article Trailer 2": is -1, should be 450
vehicle "RC Baron": is -1, should be 464
vehicle "RC Raider": is -1, should be 465
vehicle "SAN News Maverick": is -1, should be 488
vehicle "FBI Rancher": is 590, should be 490
vehicle "Hotring Racer": is -1, should be 494
vehicle "Police Maverick": is -1, should be 497
vehicle "RC Goblin": is -1, should be 501
vehicle "Hotring Racer": is -1, should be 494
vehicle "Hotring Racer": is -1, should be 494
vehicle "Stuntplane": is 570, should be 513
vehicle "FBI Truck": is 590, should be 528
vehicle "Firetruck LA": is 407, should be 544
vehicle "Primo": is 599, should be 547
vehicle "Utility Van": is 611, should be 552
vehicle "Monster "A"": is 444, should be 556
vehicle "Monster "B"": is 444, should be 557
vehicle "Elegy": is 507, should be 562
vehicle "Raindance": is -1, should be 563
vehicle "RC Tiger": is -1, should be 564
vehicle "Freight Flat Trailer (Train)": is 537, should be 569
vehicle "AT400": is 435, should be 577
vehicle "Freight Box Trailer (Train)": is 537, should be 590
vehicle "Article Trailer 3": is -1, should be 591
vehicle "RC Cam": is -1, should be 594
vehicle "Police Car (LSPD)": is -1, should be 596
vehicle "Police Car (SFPD)": is -1, should be 597
vehicle "Police Car (LVPD)": is -1, should be 598
vehicle "Police Ranger": is -1, should be 599
vehicle "Glendale Shit": is 466, should be 604
vehicle "Sadler Shit": is 543, should be 605
vehicle "Baggage Trailer "A"": is 485, should be 606
vehicle "Baggage Trailer "B"": is 485, should be 607
vehicle "Tug Stairs Trailer": is 583, should be 608

You should also expect spaces in the string passed to the kustom specifier functions, as this

  1. makes generally more sense from a user input perspective (I highly doubt that someone sees typing /v BaggageTrailerB as more correct than /v Baggage Trailer B), and
  2. won't break the current specifiers, as they all check for spaces already.

As of now the kustom specifier will only take everything until the delimiter character, but this behavior will change to be more in line with the string specifier (see issue #7).

@ziggi
Copy link
Contributor Author

ziggi commented Jan 2, 2018

As I say before: some of names was changed to right values from the wiki.
So, I will wait for space support in kustom's.

@Y-Less
Copy link
Owner

Y-Less commented Mar 28, 2022

I've completely rewritten both of these now using Levenshtein distance comparisons. But if you have more suggestions on how to improve them please do suggest them.

@Y-Less Y-Less closed this Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants