minetest/minetest — pull request #905 by kahrl (2013-09-05 06:37:02+00:00)
Title: Add ISimpleTextureSource for cleaning up main menu resources

This patch adds an interface ISimpleTextureSource which is a single-method texture source. ITextureSource and IWritableTextureSource continue to exist and they extend ISimpleTextureSource.

There is an implementation of ISimpleTextureSource (MenuTextureSource) used for the main menu.

The point of this endeavor is to simplify GUIFormSpecMenu. Currently whenever the formspec menu needs some texture, it checks whether a game is running or the main menu is active, and respectively asks IGameDef or IVideoDriver for the texture. The unified ISimpleTextureSource interface removes the need for those checks. Also, textures loaded by the mainmenu formspec are now unloaded before starting the game - previously the formspec menu just called getTexture but never removeTexture.

Other notable changes:
- Texture names must now be escaped in formspec elements image[], background[], image_button[], image_button_exit[]. The patch contains required changes in builtin.
- Fixed an off-by-one bug in unescape_string; it caused requests for a texture called "\0".