Coder Social home page Coder Social logo

Comments (12)

Misiur avatar Misiur commented on May 29, 2024

I'm not certain what the cause is, it might either be PAWN specific, y_hashmap limitaton, or something completely different. I don't have much time lately, so I'm not certain if I'll get around to it. Also, do you know if this bug was present in YSI 3?

from ysi-includes.

Misiur avatar Misiur commented on May 29, 2024

Found it: This is the root cause.

from ysi-includes.

Y-Less avatar Y-Less commented on May 29, 2024

I don't actually think that's the root cause. I've only had a quick glance since I'm trying to help less and just encourage others to get to know the code, but looking at it this is my fault. "Command_AddAlt" hashes the string (using bernstein, that comment you highlighted only applies for compile-time string hashes and the first character of a string at run-time), but "Command_ReProcess" does a slightly different hash. It converts:

rádióhangolás

To:

rdihangols@s4ai1u

Using standard punycode, but with "@" instead of "-", while hashing that result. So "Command_AddAlt" needs to do that encoding instead. This is because y_commands has a feature so secret that even I forgot about it! You can declare commands with punycode:

YCMD:rdihangols@s4ai1u(playerid, params[], help)
{
}

Is equivalent to:

YCMD:rádióhangolás(playerid, params[], help)
{
}

But will compile.

from ysi-includes.

Y-Less avatar Y-Less commented on May 29, 2024

There are punycode converters online, but most will prefix the result with "xn--" and separate the two parts with "-", because that is how they are used in internationalised domain names.

from ysi-includes.

Misiur avatar Misiur commented on May 29, 2024

Welp, I'm wrong again. Being puny human ain't easy. So, applying Puny_EncodeHash into addalt is the way to go?

from ysi-includes.

Y-Less avatar Y-Less commented on May 29, 2024

Probably, as I said that was just a cursory glance.

from ysi-includes.

MadRoxx avatar MadRoxx commented on May 29, 2024

Hello again, i tested with This version of YSI and now works.

from ysi-includes.

Misiur avatar Misiur commented on May 29, 2024

Ok, just keep in mind that master is 3, and there are many improvements in 4 (though as we can see with occasional bugs). Keep an eye on this issue, and upgrade when we resolve this.

from ysi-includes.

MadRoxx avatar MadRoxx commented on May 29, 2024

Ok, i wait for updates, and thanks for the help :)

from ysi-includes.

MadRoxx avatar MadRoxx commented on May 29, 2024

something? ❓

from ysi-includes.

Misiur avatar Misiur commented on May 29, 2024

Well, I tried a lot of stuff today, but I can't seem to get it working properly. One major problem is with Command_Find, as from simple hashmap lookup it went to

foreign Command_Find(string:cmd[]);

global Command_Find(string:cmd[])
{
    static
        sCmd[64] = "",
        sHash;

    Puny_EncodeHash(sCmd, cmd, sHash, .delimiter = '@');

    return HashMap_GetWithHash(YSI_g_sCommandMap, sCmd, sHash);
}

This is not something we want for every command lookup (performance wise). I'll fiddle with it some more tommorow, maybe I've overlooked something.

from ysi-includes.

Misiur avatar Misiur commented on May 29, 2024

Ok, tests pass so I guess Misiur@e0a9051 solves this for you. In case performance deteriorates too much we'll have to think more about this.

from ysi-includes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.