* At the only place where these ID numbers where used (scrValDefSave and scrValDefLoad), use the key-string instead (e.g. "ZNULLBODY" instead of 17)
* Rename function strresGetStringByID to strresGetString
* Increment event save file version to 4 (version of savegame.es files)
* Reject loading of savegames that need to load non-NULL ST_TEXTSTRING variables from version < 4
NOTE: This may break current savegames of games that use scripts with variables of type TEXTSTRING in them (AFAIK currently only ''some'' campaign and tutorial savegames have these).
This closes ticket:19
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5685 4a71c877-e1ca-e34f-864e-861f7616d084
* Don't maintain a secondary linked list of strings in strres.c
* Add the string that's tracked and it's ID number to the TREAP_NODE structure
* Let the treap code manage its own memory
* Have the treap code perform reverse lookups using either the resource string (i.e. not the "key" string) or associated ID number
NOTE: Searching a treap for anything else than the key is O(n), but that's no worse than a linked list, which is O(n) as well. Walking a treap has O(log n) as memory requirement, whereas walking a linked list has O(1) as memory requirement (stack size). So the only disadvantage is that searching the treap has a (highly remote!) possibility of stack overflows.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5666 4a71c877-e1ca-e34f-864e-861f7616d084
* Replace the only use of strresGetIDString with a call to function strresGetStringByID, which will also return NULL on failure to find the given ID string
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5663 4a71c877-e1ca-e34f-864e-861f7616d084
* Get rid of function strresGetIDNum with its inconvenient API and use strresGetStringByID instead
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5661 4a71c877-e1ca-e34f-864e-861f7616d084
* Instead use strdup() where a non-const reference to these strings is used
* NOTE: This may introduce memory leaks, but I'd rather have memory leaks than double-frees, of which I'm frankly surprised that they don't occur ''much'' more often
* Change FindDroidTemplate to take its parameter as const
* Don't multi-purpose the parameters of FindDroidTemplate as local variables
* Store string variables in getName as const
* scrvGetString:
* Directly return the string it retrieved and use NULL to indicate failure
* Return the string as `const'
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5658 4a71c877-e1ca-e34f-864e-861f7616d084
* Allocate STR_ID structures in such a way that a single free() call on it will suffice as cleanup
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5657 4a71c877-e1ca-e34f-864e-861f7616d084
* Change allocateName to do as the name suggests and actually ''allocate'' a string!
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5656 4a71c877-e1ca-e34f-864e-861f7616d084
* Instead pass the current STR_RES* pointer to work on to the parser function
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5654 4a71c877-e1ca-e34f-864e-861f7616d084
In any case I ''think'' these ASSERTs always hold true, (and for the testing I've done so far they do). But I'd like some more certainty and confirmation, hence why I'm committing this (before I make changes that rely on that assertion holding true), so other people get a chance to test this and prove my assertion wrong.
Thus, ''if'', these ASSERTs are triggered, please open a bugreport or otherwise notify me of it (e-mail, IRC, text message, postal mail, phone call, etc.)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5649 4a71c877-e1ca-e34f-864e-861f7616d084
* Add a forward declaration for STR_RES to strres.h (so that we can still declare pointers to this type)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5645 4a71c877-e1ca-e34f-864e-861f7616d084
* Return the STR_RES* pointer from strresCreate and use NULL to indicate failure
* Use size_t to store memory sizes in instead of UDWORD
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5644 4a71c877-e1ca-e34f-864e-861f7616d084
* Use calloc instead of a malloc followed by memset(0)
* Check the return value from malloc&calloc for ''all'' invocations of it
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5643 4a71c877-e1ca-e34f-864e-861f7616d084
* Use an unsigned int instead of UDWORD as we don't depend on the size guarantee
* Move the definition of aUsage into #ifdef DEBUG_CHECK_FOR_UNUSED_STRINGS, because that's the only place where it's used
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5630 4a71c877-e1ca-e34f-864e-861f7616d084
* Replace use of the forwarding macro TREAP_ADD with a direct call to treapAdd
* Remove treap debugging code (actually that's what the above changes effectively accomplished)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5627 4a71c877-e1ca-e34f-864e-861f7616d084
* Replace use of the forwarding macro TREAP_CREATE with a direct call to treapCreate
* Return the TREAP* pointer directly from treapCreate and use NULL as an indicator for failure
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5626 4a71c877-e1ca-e34f-864e-861f7616d084
Because the treap management code is only used by the code for string resources, make it specific for these string resources and don't use casting back & forth from void* all over the place. This simplifies the interaction of string resource code with treap code.
This will allow an easier cleanup and eventually a removal of string resource code. As the string resource code can eventually be replaced with gettext code instead.
This closes#18
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5586 4a71c877-e1ca-e34f-864e-861f7616d084
* Get rid of lexer function strresGetErrorData and use strres_get_lineno() and strres_get_text() instead
* Don't call abort() in function strres_error as the parser will return an error anyway (causing strresLoad to return false)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5084 4a71c877-e1ca-e34f-864e-861f7616d084
* Don't bother to check whether we're in a comment when reaching the end of a string resource file
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5083 4a71c877-e1ca-e34f-864e-861f7616d084
* Turn some signed integers ("int" or "SDWORD") into unsigned integers where it made more sence (and signed integers caused warnings about comparing signed with unsigned integers)
* At some places cast to an unsigned integer (where the type of the expression is a signed integer but the result of it logically _always_ is an absolute value)
* Remove unused struct-type EVENT_INIT
* Convert use of malloc->memcpy->free to one single realloc call (and now make sure to actually check realloc's return value, which wasn't done with the malloc call)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3037 4a71c877-e1ca-e34f-864e-861f7616d084
* Use decent assertion expressions for some asserts (e.g. !"string", so that debuggers actually display something more interesting than 'FALSE')
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1815 4a71c877-e1ca-e34f-864e-861f7616d084
This patch will create crashes where the code expects FREE to set the pointer to NULL! (Those problems should be fixed anyway.)
The only occassion where I saw this is when quiting a game, so it is not too much of an issue.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1459 4a71c877-e1ca-e34f-864e-861f7616d084