Loading

Paste #pdwqozgkm

  1. diff -r a5e2fda0b31a nml/actions/action2var.py
  2. --- a/nml/actions/action2var.py Tue Sep 09 13:21:01 2014 +0200
  3. +++ b/nml/actions/action2var.py Tue Sep 09 19:12:08 2014 +0200
  4. @@ -956,8 +956,10 @@
  5.      # since we need the variable name later on, a reverse lookup is needed
  6.      # TODO pass the function name along to avoid this
  7.      func60x = lambda value, pos: expression.FunctionPtr(expression.Identifier(generic.reverse_lookup(vars_60x, value), pos), parse_60x_var, value)
  8. +    funcg60x = lambda value, pos: expression.FunctionPtr(expression.Identifier(generic.reverse_lookup(action2var_variables.varact2_globalvars60x, value), pos), parse_60x_var, value)
  9.  
  10.      return expr.reduce(extra_dicts + [(action2var_variables.varact2_globalvars, parse_var), \
  11. +        (action2var_variables.varact2_globalvars60x, funcg60x), \
  12.          (vars_normal, parse_var), \
  13.          (vars_60x, func60x)] + \
  14.          global_constants.const_list)
  15. diff -r a5e2fda0b31a nml/actions/action2var_variables.py
  16. --- a/nml/actions/action2var_variables.py       Tue Sep 09 13:21:01 2014 +0200
  17. +++ b/nml/actions/action2var_variables.py       Tue Sep 09 19:12:08 2014 +0200
  18. @@ -112,6 +112,10 @@
  19.      'current_year'         : {'var': 0x24, 'start':  0, 'size': 32},
  20.  }
  21.  
  22. +varact2_globalvars60x = {
  23. +    'CALL' : {'var': 0x7E, 'start': 0, 'size': 15, 'param_function': lambda name, args, pos, info: (expression.ConstantNumeric(0, pos), [])}, #value_function: <read var 0x1C>, param_function: <convert switch to integer> args[0].get_action2_id(feature)
  24. +}
  25. +
  26.  #
  27.  # Vehicles (features 0x00 - 0x03)
  28.  # A few variables have an implementation that differs per vehicle type
  29. diff -r a5e2fda0b31a regression/013_train_callback.nml
  30. --- a/regression/013_train_callback.nml Tue Sep 09 13:21:01 2014 +0200
  31. +++ b/regression/013_train_callback.nml Tue Sep 09 19:12:08 2014 +0200
  32. @@ -95,7 +95,7 @@
  33.      // no default: instead fail CB and use capacity set in properties (30)
  34.  }
  35.  
  36. -switch (FEAT_TRAINS, SELF, bulk_wagon_cb_weight_switch, cargo_type_in_veh) {
  37. +switch (FEAT_TRAINS, SELF, bulk_wagon_cb_weight_switch, CALL(bulk_wagon_cb_capacity_switch)) {
  38.      COAL: return 18;
  39.      FRUT: return 18;
  40.      FRVG: return 18;

Comments