Announcement

Collapse
No announcement yet.

BHG - need unit flag help now :)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • BHG - need unit flag help now :)

    Hello again BHG ,

    I have started coding (this time, for a public release) the utlity which you can see here, which is, in fact, the RoN editor. And, a question to Jason:

    The tag in unitrules.xml . If the user has clicked on some checkboxes, how do I need to output the flags into file? Do I need to sort the flag letters alphabetically, by some other means, or no sorting? Going through the file, I saw cases where it seems to be sorted, and where the pattern seems to be random... that's a pretty subtle thing to be obvious through testing, though, so I'm asking you. Also, the same question for tag.

    Thanks in advance .
    Solver, WePlayCiv Co-Administrator
    Contact: solver-at-weplayciv-dot-com
    I can kill you whenever I please... but not today. - The Cigarette Smoking Man

  • #2
    Solver,

    Sorry for the delay. For the "FLAGS" element, the order does NOT matter. Nor does it matter for "OBJ_MASK". Let me know if you need any more info.

    Thanks for the cool work,
    J
    Jason Coleman
    Lead Programmer
    Big Huge Games

    Comment


    • #3
      Thanks Jason .

      Something I've been asked over there in other thread - about renaming units. I understand that I must only allow changing TYPENAME (changes to NAME and GRAPH seem to cause problems). However, whenever TYPENAME is changed in unitrules.xml, do I have to go to typenames.xml and find that string there, also changing it, or what? In other words, I'd appreciate help on how to code unit renaming .

      Outstanding support guys .
      Solver, WePlayCiv Co-Administrator
      Contact: solver-at-weplayciv-dot-com
      I can kill you whenever I please... but not today. - The Cigarette Smoking Man

      Comment


      • #4
        Actually, if you only want a cosmetic change to the name, change the one in typenames.xml. The idea is that unitrules.xml is common to all languages. Any values that get displayed are looked up in typenames.xml. Typenames.xml differs by translation.

        In case you need it, I've included some code for generating the hashes below.

        dword primes[ 50 ] = {
        127, 811, 1597, 2131, 2749, 4759, 5527, 5953, 8117, 9539
        , 10273, 10753, 11159, 12301, 13217, 14207, 15413, 17681, 18661, 19013
        , 21089, 22051, 25111, 25801, 27457, 28057, 29581, 30809, 32611, 34469
        , 36067, 37511, 38723, 40093, 41983, 43321, 45083, 47431, 49667, 50767
        , 53453, 55469, 57193, 59369, 61987, 65071, 73421, 77849, 84223, 89009
        };

        dword num_primes = 50;

        dword generate_hash (const TCHAR*string)
        {
        int curchar;
        dword total = 0;
        TCHAR c;

        if (!string) return 0;

        for ( curchar = (int)_tcslen(string) - 1; curchar >= 0 ; curchar-- ) {
        dword base, base2;
        base = curchar % num_primes;

        c = string[ curchar ];


        base2 = (c % num_primes);
        total += primes[base2] * (curchar+1);
        total += ( primes[ base ] * c );
        }
        return total;
        }
        Jason Coleman
        Lead Programmer
        Big Huge Games

        Comment


        • #5
          Thanks! This is most useful and seems like it helps solve the problems I'm currently having.

          Yet again... the most awesome level of support I have ever seen, now I'm just eager to finish my unit editor .
          Solver, WePlayCiv Co-Administrator
          Contact: solver-at-weplayciv-dot-com
          I can kill you whenever I please... but not today. - The Cigarette Smoking Man

          Comment

          Working...
          X