Announcement

Collapse
No announcement yet.

Changing a string in the database

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

  • Changing a string in the database

    Is there any easy way to do this? I tried a version of AddStrNode which simply modifies the contents of the node when it finds it existing, but I always get an access violation.

    EDIT: Actually, it simply has no effect.
    Last edited by tombom; February 6, 2005, 12:43.
    Caution! Under no circumstances confuse the mesh with the interleave operator, except under confusing circumstances!
    -Intercal reference manual

    People often remark of me, "You say sorry far to much!". To which my common-sense reply is "I apologise".

  • #2
    Actually I don't get what you are trying to do, if you want to modify the string database, you can use any text editor to modify it. And if you want to modify certain parts of a sentence for instance you use placeholder variables of slic.

    -Martin
    Civ2 military advisor: "No complaints, Sir!"

    Comment


    • #3
      I meant while in the code changing the value of a string already existing in g_theStringDB.
      Caution! Under no circumstances confuse the mesh with the interleave operator, except under confusing circumstances!
      -Intercal reference manual

      People often remark of me, "You say sorry far to much!". To which my common-sense reply is "I apologise".

      Comment


      • #4
        However still I don't get the point why modifying a string in the database, once it is loaded into the game from the textfiles. However AddStrNode can only add a string and can't modify it. The string database is not intended for string manipulation as it looks like.

        -Martin
        Civ2 military advisor: "No complaints, Sir!"

        Comment


        • #5
          I think altering an existing string in the database is contrary to the philosophy of the strings database.

          Comment


          • #6
            While mostly agreeing with the above remarks, I fail to see why modifying AddStrNode does not work, assuming you add some valid code to the "// Key exists: do not add" branch.
            That is, if you are modifying a unique string. Do you know if InsertStr is called after you have modified your string? Before modifying AddStrNode, it would have detected that the string already existed (AddStrNode fails), and would have created a new entry with a different (key) name. After modifying AddStrNode, calling InsertStr may cause AddStrNode to succeed and overwrite the string once more!

            However, you may consider explaining what game effect you want to achieve. Maybe there are more ways to do it than modifiying the text database.

            Comment


            • #7
              Given that the AIs aren't really artificial intelligences, does anyone know what structure the 'databases' take? Are they true DBs (if so what type) or simple flat files?

              Comment


              • #8
                The data of the databases are stored in simple text files, e.g. unit.txt, tileimp.txt, goods.txt, strategies.txt, etc.

                The data is loaded into the program on startup or on game reload. (Necessary for scenarios with different rule sets.)

                For a standart game this means that you can change the rules during the game, but not to extensive, as the game for instance saves which technology you have and that is an index into the database.

                And so far I don't see the sense behind adding or modifing a string during the game, to that database that can be done off-line, since it should be clear before the game which strings will be used.

                -Martin
                Civ2 military advisor: "No complaints, Sir!"

                Comment


                • #9
                  Txs for the speedy reply, Martin.

                  It's what I expected from what I've found so far. It's just that I always worked in environments where databases were databases (DB2 & suchlike) and all other data was held in files. So I was just a little worried when people started talking about databases!

                  I've started trying to get a feel for the coding logic so, hopefully, I'll be better able to contribute to these discussions in future.

                  Comment

                  Working...
                  X