summaryrefslogtreecommitdiff
path: root/client/mapbgfix.py
blob: 8f31915aca01bc66197a093190f5ee4c743ea6b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python3
## This makes sure all maps have a background (required by 4144 on empty map view)

import os
PATH='../../client-data/maps'
for mp in os.listdir(PATH):
    map = '%s/%s' % (PATH, mp)
    if not map.endswith('.tmx'):
        continue
    HASBG=False
    bf=[]
    with open(map) as f:
        for l in f:
            if "background" in l:
                HASBG=True
                break
            bf.append(l)
    if HASBG:
        continue
    with open(map, 'w') as f:
        for l in bf:
            n=f.write(l)
            if '<properties>' in l and not HASBG:
                n=f.write('  <property name="background0image" value="graphics/images/spit23loginwallpaper_800x600.png"/>\n')
                HASBG=True