Changeset 1246


Ignore:
Timestamp:
05/20/23 16:33:27 (19 months ago)
Author:
Maciej Komosinski
Message:

Optionally normalize the four "biological" properties when propagating them along sticks (only to test legacy code, now normalization is no longer used)

Location:
cpp/frams/genetics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/geneprops.cpp

    r1242 r1246  
    136136}
    137137
    138 void GeneProps::propagateAlong(bool use_f1_muscle_reset_range)
     138void GeneProps::propagateAlong(bool use_f1_muscle_reset_range, GenePropsOps* ops)
    139139{
    140140        length = 0.5 * length + 0.5 * standard_values.length;
     
    149149        muscle_power = 0.8 * muscle_power + 0.2 * standard_values.muscle_power;
    150150
    151         normalizeBiol4();
     151        if (ops == NULL)
     152                ops = getStandardOps();
     153        if (ops->use_normalizebiol4) normalizeBiol4();
    152154
    153155        if (use_f1_muscle_reset_range)
     
    267269        use_normalizebiol4 = false;
    268270        auto fields = { length,curvedness,weight,friction,muscle_power,assimilation,stamina,ingestion,twist,energy,cred,cgreen,cblue };
    269         for (auto x : fields)
    270         {
    271                 auto xx = dynamic_cast<GenePropsOp_Old*>(x);
    272                 if (xx)
    273                         xx->change = xx->revchange = 0.5;
     271        for (auto f : fields)
     272        {
     273                auto f_gpo = dynamic_cast<GenePropsOp_Old*>(f);
     274                if (f_gpo)
     275                        f_gpo->change = f_gpo->revchange = 0.5;
    274276        }
    275277}
  • cpp/frams/genetics/geneprops.h

    r1245 r1246  
    162162         * @param use_reset_range true if this method should modify muscle_bend_range (used in f1 conversion).
    163163         */
    164         void propagateAlong(bool use_f1_muscle_reset_range);
     164        void propagateAlong(bool use_f1_muscle_reset_range, GenePropsOps* ops = NULL);
    165165};
    166166
Note: See TracChangeset for help on using the changeset viewer.