This follows the previous patch (https://gna.org/patch/?3604) that introduced square bracket expansions for file lists when dealing with animations.

The first attached patch converts the '-' to '~' to be more in line with existing conventions (say for offsets), but also for future use within frames. This patch also optimizes the string_utils.cpp split and related functions by introducing a stip_end function that is used in places where the beginning of a string of text is known to be already white space free. This idea is that if the flags are set to strip white spaces, each time a split function hits a separator it starts after skipping all the spaces -- so at the end it only needs to strip the end spaces. I've replaced the search for a space with the more generic space, newline,and return character function that was already included in this file.

The second patch applies the square split function to sound. This simplifies a great deal sound_utils.cfg macros and some of the elf healing units. Together with the split function for halos, by my testing this saves about .9 Mb of RAM on loading wesnoth (out of 54.8 Mb), and about 3-5 Mb when loading multiplayer with eras. Not much, but if I get if I also get a patch for the unit frames, it may all start to add up to a discernable faster loading time and smaller cache.

Hopefully that all makes sense. I'm happy to clarify anything here or change anything, in case I've broken anything with this (altough I think I've tested reasonably well each aspect).

Copyright (C) 2004-2006, the Gna! people. Posted items are owned by whoever posted them.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.