Hi. I found some error.
When I tried create recursive function with Sequence and Callfunc. Sometimes Callfunc dosen’t starting.
because ActionInterval::isDone() function changed _elapsed >= _duration to _elapsed +FLT_EPSILON >= _duration in 3.15.1.
but Sequence::update(dt) has checking t < _split and set toaction[1]. t is different to _split so dosen’t changed to action[1] and sequence is stopped.
Here my code.
MyCode
startBall(nullptr, 1000); // call function
void DevScene::startBall(Ref* sender, int num)`
{
DelayTime* delay = DelayTime::create(0.05f);
CallFunc* fun = CallFunc::create(CC_CALLBACK_0(DevScene::startBall, this, nullptr, num - 1));
Sequence* seq = Sequence::create(delay, fun, NULL);
this->runAction(seq);
cocos2d::log("num %d", num);
}
This is CCActionInterval.cpp
CCActionInterval.cpp
void Sequence::update(float t)
{
int found = 0;
float new_t = 0.0f;
CCLOG("1 found %d, last %d split %16.8e, t %16.8e, %s", found, _last, _split, t, t < _split ? "true" : "false");
if( t < _split )
{
// action[0]
found = 0;
if( _split != 0 )
new_t = t / _split;
else
new_t = 1;
}
else
{
// action[1]
found = 1;
CCLOG("set found 1");
if ( _split == 1 )
new_t = 1;
else
new_t = (t-_split) / (1 - _split );
}
CCLOG("2 found %d, last %d split %16.8e, t %16.8e, %s", found, _last, _split, t, t < _split ? "true" : "false");
....
This is Wrong Log
Summary
run action : Sequence, DelayTime, Callfunc
[Before Calfunc] is done : 0.050045, 0.050000, 0.050045
[Before Calfunc] stop action
Sequencestop action
1 found 0, last -1 split 1.00000000e+00, t 0.00000000e+00, true
2 found 0, last -1 split 1.00000000e+00, t 0.00000000e+00, true
DelayTime start action
Sequence is done : 0.000000, 0.050000, 0.000000
1 found 0, last 0 split 1.00000000e+00, t 3.34499985e-01, true
2 found 0, last 0 split 1.00000000e+00, t 3.34499985e-01, true
DelayTime is done : 0.000000, 0.050000, 0.000000
Sequence is done : 0.016725, 0.050000, 0.016725
1 found 0, last 0 split 1.00000000e+00, t 6.65439963e-01, true
2 found 0, last 0 split 1.00000000e+00, t 6.65439963e-01, true
DelayTime is done : 0.000000, 0.050000, 0.000000
Sequence is done : 0.033272, 0.050000, 0.033272
1 found 0, last 0 split 1.00000000e+00, t 9.99999940e-01, true // Here shoud changed action[1] but dosen’t changed
2 found 0, last 0 split 1.00000000e+00, t 9.99999940e-01, true
6174742080 is done : 0.000000, 0.050000, 0.000000
DelayTime is done : 0.050000, 0.050000, 0.050000
DelayTime stop action
Sequence stop action