Fix bogue de couleur blanche après des échange d'engins
This commit is contained in:
parent
1d0947770b
commit
6443a16549
@ -460,9 +460,14 @@ void GOLTeamH::setSolidColor(State state, Color const& color)
|
||||
else
|
||||
mDeadColor = color;
|
||||
|
||||
mColorEncoded &= 0; // Clear
|
||||
mColorEncoded |= ((static_cast<uint64_t>(mAliveColor.red) << 16) << 32 * static_cast<uint8_t>(state));
|
||||
mColorEncoded |= ((static_cast<uint64_t>(mAliveColor.green) << 8) << 32 * static_cast<uint8_t>(state));
|
||||
mColorEncoded |= (static_cast<uint64_t>(mAliveColor.blue) << 32 * static_cast<uint8_t>(state));
|
||||
|
||||
mColorEncoded |= ((static_cast<uint64_t>(mDeadColor.red) << 16) * static_cast<uint8_t>(state));
|
||||
mColorEncoded |= ((static_cast<uint64_t>(mDeadColor.green) << 8) * static_cast<uint8_t>(state));
|
||||
mColorEncoded |= (static_cast<uint64_t>(mDeadColor.blue) * static_cast<uint8_t>(state));
|
||||
}
|
||||
|
||||
|
||||
@ -489,7 +494,7 @@ void GOLTeamH::processOneStep()
|
||||
auto const widthNoBorder{ mData.width() - 2 }, heightNoBorder{ mData.height() - 2 };
|
||||
auto const offset{ mData.width() };
|
||||
|
||||
size_t neighboursAliveCount{}, aliveCount{};
|
||||
size_t neighborsAliveCount{}, aliveCount{};
|
||||
|
||||
// On commence à la première case qui n'est pas dans le border
|
||||
// Pointeur du tableau intermédiaire.
|
||||
@ -501,29 +506,29 @@ void GOLTeamH::processOneStep()
|
||||
for (size_t j{ 1 }; j < heightNoBorder + 1; ++j) {
|
||||
for (size_t i{ 1 }; i < widthNoBorder + 1; ++i) {
|
||||
|
||||
neighboursAliveCount = 0;
|
||||
neighborsAliveCount = 0;
|
||||
|
||||
// Top
|
||||
neighboursAliveCount += *ptrGrid;
|
||||
neighborsAliveCount += *ptrGrid;
|
||||
ptrGrid++;
|
||||
neighboursAliveCount += *ptrGrid;
|
||||
neighborsAliveCount += *ptrGrid;
|
||||
ptrGrid++;
|
||||
neighboursAliveCount += *ptrGrid;
|
||||
neighborsAliveCount += *ptrGrid;
|
||||
|
||||
// Milieu
|
||||
ptrGrid += offset - 2;
|
||||
neighboursAliveCount += *ptrGrid;
|
||||
neighborsAliveCount += *ptrGrid;
|
||||
ptrGrid += 2;
|
||||
neighboursAliveCount += *ptrGrid;
|
||||
neighborsAliveCount += *ptrGrid;
|
||||
|
||||
|
||||
// Dessous
|
||||
ptrGrid += offset - 2;
|
||||
neighboursAliveCount += *ptrGrid;
|
||||
neighborsAliveCount += *ptrGrid;
|
||||
ptrGrid++;
|
||||
neighboursAliveCount += *ptrGrid;
|
||||
neighborsAliveCount += *ptrGrid;
|
||||
ptrGrid++;
|
||||
neighboursAliveCount += *ptrGrid;
|
||||
neighborsAliveCount += *ptrGrid;
|
||||
|
||||
// On retourne à une place plus loin qu'à l'origine.
|
||||
ptrGrid -= (2 * offset) + 1;
|
||||
@ -534,8 +539,7 @@ void GOLTeamH::processOneStep()
|
||||
// On accède à la bonne partie des bits et on compare si le bit de survie/réanimation est
|
||||
// présent. Voir GOLTeamH.cpp pour plus de détails.
|
||||
*(ptrGridInt - 1) = static_cast<bool>(
|
||||
(mParsedRule >> static_cast<bool>(*(ptrGrid + offset)) * 16) & (1u << neighboursAliveCount)
|
||||
);
|
||||
(mParsedRule >> *(ptrGrid + offset) * 16) & (1u << neighborsAliveCount));
|
||||
|
||||
if (*(ptrGridInt - 1))
|
||||
aliveCount++;
|
||||
|
Loading…
Reference in New Issue
Block a user