wesnoth-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-dev] A WML idea: import


From: David White
Subject: [Wesnoth-dev] A WML idea: import
Date: Sun, 08 May 2005 15:22:20 -0500
User-agent: Mozilla Thunderbird 0.8 (Windows/20040913)

Perhaps we can add a simple module system to Wesnoth very easily: by adding a WML command called 'import'. It would work something like this,

import "path"

and would have the effect of loading the WML document at 'path' and inserting it into the current document. This would be similiar to

{path}

but have some important differences:

- 'import' is a WML-level command, not a pre-processor command. So, importation comes *after* pre-processing. - the document in 'path' is first parsed as an independent WML document, and then attached to the current document - the document in 'path' must be a valid WML document on its own. If there is an error in it, an error message will be logged, but the original document can still be loaded, just without the import occurring. - the 'path' given to 'import' could contain wild cards, which would be expanded into a list of paths, each of which would be imported one after the other.

We could then fairly simply put this in game.cfg to try to import user-campaigns:

import "~/campaigns/*.cfg"

This idea isn't nearly as sophisticated as silene's module system proposal some time ago, but on the other hand I think it is much easier to implement. The main thing it does provide is assurance against being unable to load the game's core WML document because a user campaign has an error.

Any thoughts?

David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]