Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
verify Namespace Reference

Data Structures

class  MyCondition
 
class  Traverser
 

Functions

def isType
 
def EndNode
 
def IsEnd
 
def IsSuperimposition
 
def ValidMissions
 
def IsFinished
 

Variables

list traverser = []
 
 progress = False
 
list variables = []
 
list var = traverser[i]
 

Function Documentation

def verify.EndNode (   node)

Definition at line 27 of file verify.py.

References campaign_lib.CampaignEndNode().

27 
28 def EndNode(node):
return CampaignEndNode(node.campaign).subnodes[0]
def verify.IsEnd (   node)

Definition at line 29 of file verify.py.

References campaign_lib.CampaignEndNode(), and sre_parse.dir.

29 
30 def IsEnd(node):
31  precond=CampaignEndNode(node.campaign).subnodes[0].preconditions[0]
32  try:
33  if (len(node.preconditions)!=1):
34  return False
35  except:
36  print node
37  print dir(node)
38  print node.preconditions
39 # Ignore this, don't try and replace it with isinstance because it won't work!
40  if (node.preconditions[0].__init__.im_func!=precond.__init__.im_func):
41  return False
return node.preconditions[0].system==precond.system and node.preconditions[0].dockedshipname==precond.dockedshipname
def verify.IsFinished ( )

Definition at line 166 of file verify.py.

References IsEnd().

167 def IsFinished():
168  global traverser
169  for i in range(len(traverser)-1,-1,-1):
170 
171  if IsEnd(traverser[i].node):
172  del traverser[i]
173 
return len(traverser)>0
def verify.IsSuperimposition (   node)

Definition at line 42 of file verify.py.

42 
43 def IsSuperimposition(node):
44  precons=node.preconditions
45  currnodesys=[]
46  currnodeship=[]
47  for pc in precons:
48  if isinstance(pc,InSystemCondition):
49  currnodesys.append(pc.system)
50  currnodeship.append(pc.dockedshipname)
51  if not len(currnodesys):
52  return False
53  if len(currnodesys)>1:
54  print "Two system checks for the same node. Impossible to evaluate as True."
55  return True
56  selector=node.script
57  if selector is None:
58  return False
59  elif isinstance(selector,TrueSubnode):
60  pass#print "TrueSubnode found ... evaluating."
61  else:
62  return False
63  subnodes=node.subnodes
64  snp=[]
65  for i in range(len(subnodes)):
66  snp=snp+subnodes[i].preconditions
67  subnodesys=[]
68  subnodeship=[]
69  for pc in snp:
70  if isinstance(pc,InSystemCondition):
71  subnodesys.append(pc.system)
72  subnodeship.append(pc.dockedshipname)
73  if len(subnodesys)<1:
74  return False
75  valid=True
76  for i in range(len(subnodesys)):
77  if subnodesys[i] != currnodesys[0]:
78  valid=False
79  break
80  elif not (currnodeship[0] is None or subnodeship[i] is None or currnodeship[0] == subnodeship[i]):
81  valid=False
82  break
83  if valid:
84  return False
85  else:
86  print currnodesys+currnodeship
87  print subnodesys+subnodeship
return True
def verify.isType (   a,
  typ 
)

Definition at line 7 of file verify.py.

7 
8 def isType(a,typ):
9  return a.__init__.im_func==typ.__init__.im_func
10 exnonescript=None
def verify.ValidMissions (   node)

Definition at line 88 of file verify.py.

References verify_missions.verifyMission().

88 
89 def ValidMissions(node):
90  missions=[]
91  sc=node.script
92  while True:
93  if sc==None:
94  break
95  if isinstance(sc,LoadMission):
96  missions.append(sc)
97  sc=sc.nextscript
98  if missions == []:
99  return True
100  valid = True
101  for m in missions:
102 # print m.mname + " :: " + str(m.args) + " :: " + m.name
103  print " ++ Mission '%s'"%m.mname
104  if not verify_missions.verifyMission(m.mname,m.args):
105  valid = False
return valid

Variable Documentation

progress = False

Definition at line 181 of file verify.py.

list traverser = []

Definition at line 6 of file verify.py.

list var = traverser[i]

Definition at line 184 of file verify.py.

variables = []

Definition at line 182 of file verify.py.