/vqdr/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/vqdr/trunk

« back to all changes in this revision

Viewing changes to src/libvqdr/operator/dice_operator_token.vala

  • Committer: Gustav Hartvigsson
  • Date: 2022-06-01 12:30:01 UTC
  • mfrom: (52.1.3 int64)
  • Revision ID: gustav.hartvigsson@gmail.com-20220601123001-b5xs60wwym810hg1
Merged: lp:~gustav.hartvigsson/vqdr/int64

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
namespace VQDR.Expression {
24
24
  public class DiceOperatorToken : OperatorToken, UnaryOperator {
25
25
    
26
 
    public DiceOperatorToken (int position) {
 
26
    public DiceOperatorToken (int32 position) {
27
27
      base (position);
28
28
    }
29
29
    
32
32
    public override void evaluate_self (Context instance) throws GLib.Error {
33
33
      Dice dice;
34
34
      
35
 
      int l_result;
36
 
      long l_max_result;
37
 
      long l_min_result;
 
35
      int32 l_result;
 
36
      int64 l_max_result;
 
37
      int64 l_min_result;
38
38
      
39
39
      var r_child = get_left_child ();
40
40
      var l_child = get_right_child ();
41
41
      
42
42
      if (! is_unary) {
43
43
        l_child.evaluate (instance);
44
 
        l_result = (int) l_child.result_value.number;
 
44
        l_result = (int32) l_child.result_value.number;
45
45
        l_max_result = l_child.result_max_value.number;
46
46
        l_min_result = l_child.result_min_value.number;
47
47
      } else {
54
54
        l_min_result =  1;
55
55
      }
56
56
      
57
 
      dice = new Dice (l_result, (int) r_child.result_value.number);
 
57
      dice = new Dice (l_result, (int32) r_child.result_value.number);
58
58
      result_value = FastNumber (dice.roll ());
59
59
      
60
60
      /*Max Result: The max of the dice faces multiplied my the max of the dice