Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.11 #102

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

0.11 #102

wants to merge 21 commits into from

Conversation

nvs
Copy link
Owner

@nvs nvs commented Jul 4, 2022

No description provided.

This reverts commit af80cd7.

It was found that braces were not properly supported via the frontier
pattern.  So here we are.  Some proper testing would have found this
sooner...
@nvs nvs added this to the 0.11 milestone Jul 4, 2022
@nvs nvs self-assigned this Jul 4, 2022
@nvs nvs linked an issue Jul 4, 2022 that may be closed by this pull request
6 tasks
nvs added 20 commits July 6, 2022 19:09
In an attempt to make the libraries more obvious, all conversions on the
trigger string values are removed (i.e. converting `\r\n' to `\n`).

More noteworthy is the addition of comment support.  Comments within the
WTS file have little impact; however, they can serve as a guide to
identify the purpose of a given trigger string.  Perhaps a user will
find this helpful (e.g. when supporting multiple languages).

```lua
return {
    [1] = {
        value = '',
        comment = ''
    }
}
```
First off, the breaking change:  The output format has changed, and no
longer has objects within the primary table.  The aim here is
future-proofing.  And making library behavior more consistent across
supported file formats.  Or something like that.

```lua
return {
    version = 2,
    objects = {
        -- Objects here.
    }
}
```

And then some formatting changes.  Perhaps look into a tool to
automatically format things?  Crazy, right?
Remove flag to handle metatable and introduce caching to handle cyclical
tables.
Hopefully this streamlines options handling.
Issue: #99

Use of LPeg for `unpack` not only improves performance, but arguably
makes it easier to understand the logic involved.  Plus, it looks nice.
Right?  Right...?

Also support `position` for `unpack`.
The other ids are ordered according to how they are found in their
respective files.  The ones found only in Warcraft III's Lua environment
will be sorted via `table.sort` from now on.
The output format has changed.  Now a list sorted by module names is
returned, with each element containing the module name, path, and, by
default, the module contents.  These modules are iterable via `ipairs`
(i.e. `[1, N]`).  This is a breaking change.

Additionally, the root module is now specified by name instead of path,
and an attempt is made to find it within the provided path.  In the
output, `modules [0]` will represent the root module.
Allow the ability to `pack` the `war3map.lua`, using the following
format to specify modules:

```lua
local input = {
    {
        name = '',
        path = '',
        contents = ''
    },
    -- More modules.
}
```

Modules are expected to be iterable via `ipairs` (i.e. `[1, N]`).  Note
that `modules [0]` will represent the root object, and will be included
at the end of the output file.  The root object should probably contain
`main` and `config`.

Note that the output of `Modules.load` can be passed directly to this
module to produce a usable `war3map.lua`.
Issue: #99

Switching to LPEG should make it easier to properly support the file
format.  In particular, double quoted lists are now handled properly.
Additionally, fewer assumptions regarding values are made.

For unquoted values, everything until the EOL is now returned.  Within
the game files there are cases where trailing comments are not removed.
There are cases where they are.  How are we supposed to know?

For quoted values, both single and double, the quotes are no longer
removed.  There are cases where some values must be double quoted.
Others must be singled quoted.  Again, how are we supposed to know?

So we make less assumptions, and let the user decide.
Issue: #99

Now attempt to automatically determine if the file format is for
Reforged (1.32).  This is done by looking at the flags value.  If it is
a printable character (i.e. greater than `0x20`), then we make the
assumption that it is the latest file format.  Previously, we required
the user to supply a version table.

Furthermore, we adjust a few things, including the output format and
introducing `position` for `unpack`.  This could be considered a
breaking change.
Issue: #99

As with the unit version, we now automatically detect the file format
introduced with Reforged (1.32).  This is done by looking at the byte
that either represents a doodad's flags or skin.  If this byte is a
printable character (i.e. greater than `0x20`), we assume it is a skin,
and thus the latest format.

Other changes include support of `position` in `unpack` and adjustments
to the output format.
Issue: #99

Format `3` of the map is now supported.  The output format for the
module has changed as well.
Issue: #99

We now automatically determine the correct file format in both `unpack`
and `pack`.  This is done by seeing if the entire input is consumed in
`unpack`, and checking for the presence of the new camera values in
`pack`.

Other changes include support of `position` in `unpack`.
Issue: #99

Note that the output format has changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0.11
1 participant