Fix crash upon changing tpt.brushID
This was because brushes are not in an initialized state by default, SetRadius needs to be called on them before they can be used. This is ensured elsewhere but had not been ensured on this code path. This is hilariously bad design and needs to be fixed sometime.
This commit is contained in:
parent
28d86d2859
commit
d2d1fd902f
@ -1455,9 +1455,7 @@ void GameController::Vote(int direction)
|
||||
|
||||
void GameController::ChangeBrush()
|
||||
{
|
||||
auto prev_size = gameModel->GetBrush().GetRadius();
|
||||
gameModel->SetBrushID(gameModel->GetBrushID()+1);
|
||||
gameModel->GetBrush().SetRadius(prev_size);
|
||||
}
|
||||
|
||||
void GameController::ClearSim()
|
||||
|
@ -832,7 +832,9 @@ int GameModel::GetBrushID()
|
||||
|
||||
void GameModel::SetBrushID(int i)
|
||||
{
|
||||
auto prevRadius = brushList[currentBrush]->GetRadius();
|
||||
currentBrush = i%brushList.size();
|
||||
brushList[currentBrush]->SetRadius(prevRadius);
|
||||
notifyBrushChanged();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user