Skip to content

Commit

Permalink
handle wildcard tail lumps properly when saving
Browse files Browse the repository at this point in the history
fixes #28
  • Loading branch information
devinacker committed Feb 21, 2018
1 parent ecc7b8b commit 6be805a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion omg/mapedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def from_lumps(self, lumpgroup):
self.behavior = m["BEHAVIOR"]
# optional script sources
try:
self.scripts = m[m.find("SCRIPT*")[0]]
self.scripts = m[wcinlist(m, "SCRIPT*")[0]]
except IndexError:
self.scripts = Lump()
else:
Expand Down
3 changes: 1 addition & 2 deletions omg/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

from __future__ import print_function
from fnmatch import fnmatchcase as wccmp
from fnmatch import fnmatchcase as wccmp, filter as wcinlist
from struct import pack, unpack, calcsize
from copy import copy, deepcopy
from collections import OrderedDict as od
Expand Down Expand Up @@ -108,7 +108,6 @@ def all(set):
def inwclist(elem, seq):
return any(wccmp(elem, x) for x in seq)


#----------------------------------------------------------------------
#
# Functions for processing lump names and other strings
Expand Down
7 changes: 5 additions & 2 deletions omg/wad.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,11 @@ def save_wadio(self, wadio, use_free=True):
except KeyError:
wadio.insert(h, bytes())
for t in self.tail:
if t in hs:
wadio.insert(t, hs[t].data, use_free=use_free)
try:
name = wcinlist(hs, t)[0]
wadio.insert(name, hs[name].data, use_free=use_free)
except IndexError:
pass


class NameGroup(LumpGroup):
Expand Down

0 comments on commit 6be805a

Please sign in to comment.