Reply To: MWEdit

Home Forums Projects MWEdit Reply To: MWEdit

#4016

The IsModified() function in the GUI classes can be optmized.

This is an example of what we have currently:

if (m_IDText.GetModify()) {
	m_Modified = true;
}

if (m_NameText.GetModify()) {
	m_Modified = true;
}

Right now, it checks each condition even though m_Modified is already true so we can change it to else-ifs after the initial if with a default return value of false. That will save a lot of checks when the program goes through those functions

Edit:

There are also blocks like this:

if (pInfoData->Disposition < 0) {
	pInfoData->Disposition = 0;
}

if (pInfoData->Disposition > 100) {
	pInfoData->Disposition = 100;
}

They can also be optimized into else-ifs. If the first if succeeds, then we already know the second one doesn’t apply.

Side note: still deleting all of the extra newlines.