News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

[Script AI] Fahrzeugwahl

Started by Frank, March 27, 2017, 09:33:39 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Frank

Existiert ein Anhänger, dann wird immer diese Kombi genommen, auch wenn es einen besseren LKW ohne Anhänger gibt. Selbst dann, wenn die Kombi mit Anhänger veraltet ist.

sqai - prototyper.nut Zeile 175 rum


Quote...
         if (test.can_be_last()  &&  !c.missing_freight  &&  c.min_top_speed >= min_speed) {
            // TODO valuate this candidate
            //if (valuate) {
               local value = valuate.call(getroottable(), c)
//                print(" === " + value)
               //if (best==null  ||  value > best_value) {
                  if (best==null) {
              best = c 
              best_value = value
            } else {
              if (c.max_speed > best.max_speed && c.capacity > best.capacity) {   //max_speed
            //if (c.capacity > 5) {     //c.capacity > best.capacity
                best = c 
                best_value = value
              } else if (c.max_speed > best.max_speed) {
                best = c 
                best_value = value
              } else if (c.capacity > best.capacity) {
                best = c 
                best_value = value
              }
            }
               //}
            //}
            //else {
               // no valuator function -> take first valid convoy and return
               //best = c;
               //break
            //}

//             print("..... ***")
         }
...