Fixed loading conf, medals will no longer disappear if you put an extra newline at the end, import won't crash if you have two newlines, etc.
This commit is contained in:
parent
cd2c4b637b
commit
df1a9c837b
|
@ -28,6 +28,8 @@ def load_conf():
|
|||
a=open(confp).read()
|
||||
for n in a.split('\n\n'):
|
||||
lines=n.split('\n')
|
||||
lines=list(filter(lambda x:x,lines))
|
||||
if not lines: continue
|
||||
header=lines[0].split(' ')
|
||||
nhash=int(header[0]); names=set(header[1:]) # Makes deduping way easier
|
||||
medals={}
|
||||
|
@ -128,7 +130,8 @@ def generate(officer=None,name=None):
|
|||
pieces[0]='wm'
|
||||
else: gun=''
|
||||
out=[]
|
||||
rank,cap=12,12
|
||||
if len(pieces)==6: rank=cap=int(pieces.pop(-1))
|
||||
else: rank,cap=12,12
|
||||
for n in zip(pieces,tables.displays_nogun,tables.displays_nogun_str):
|
||||
ind=lookup_piece(n[0],n[1])
|
||||
rank,cap=min(rank,pro[n[2]][ind][0]),min(cap,pro[n[2]][ind][1])
|
||||
|
|
|
@ -71,6 +71,6 @@ def adjust_rank(rank,cap=-1, key=False,moh=False,pcc=False):
|
|||
|
||||
def rand(seed,clas):
|
||||
if seed>-1: n=seed
|
||||
else: n=int(random.random()*4)*2
|
||||
else: n=int(random.random()*5)*2
|
||||
if clas>9: return n+1,clas-10
|
||||
return n,clas
|
Loading…
Reference in New Issue
Block a user