More cleanups from clang-tidy.

This commit is contained in:
Stephen Anthony 2019-12-22 22:46:27 -03:30
parent 2944ee7564
commit 8bbabe3c5d
4 changed files with 20 additions and 7 deletions

View File

@ -85,8 +85,8 @@ void FBSurface::line(uInt32 x, uInt32 y, uInt32 x2, uInt32 y2, ColorId color)
// x is major axis // x is major axis
if(dx < 0) if(dx < 0)
{ {
uInt32 tx = x; x = x2; x2 = tx; std::swap(x, x2);
uInt32 ty = y; y = y2; y2 = ty; y = y2;
dx = -dx; dx = -dx;
dy = -dy; dy = -dy;
} }
@ -110,8 +110,8 @@ void FBSurface::line(uInt32 x, uInt32 y, uInt32 x2, uInt32 y2, ColorId color)
// y is major axis // y is major axis
if(dy < 0) if(dy < 0)
{ {
uInt32 tx = x; x = x2; x2 = tx; x = x2;
uInt32 ty = y; y = y2; y2 = ty; std::swap(y, y2);
dx = -dx; dx = -dx;
dy = -dy; dy = -dy;
} }

View File

@ -2420,7 +2420,7 @@ int Thumbulator::execute()
rb = inst & 0xFF; rb = inst & 0xFF;
DO_DISS(statusMsg << "swi 0x" << Base::HEX2 << rb << endl); DO_DISS(statusMsg << "swi 0x" << Base::HEX2 << rb << endl);
if((inst & 0xFF) == 0xCC) if(rb == 0xCC)
{ {
write_register(0, cpsr); write_register(0, cpsr);
return 0; return 0;

View File

@ -88,7 +88,7 @@ TIA::TIA(ConsoleIO& console, ConsoleTimingProvider timingProvider, Settings& set
myMissile1.setTIA(this); myMissile1.setTIA(this);
myBall.setTIA(this); myBall.setTIA(this);
reset(); initialize();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -128,7 +128,7 @@ void TIA::clearFrameManager()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::reset() void TIA::initialize()
{ {
myHctr = 0; myHctr = 0;
myMovementInProgress = false; myMovementInProgress = false;
@ -193,6 +193,14 @@ void TIA::reset()
#endif // DEBUGGER_SUPPORT #endif // DEBUGGER_SUPPORT
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::reset()
{
// Simply call initialize(); mostly to get around calling a virtual method
// from the constructor
initialize();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::install(System& system) void TIA::install(System& system)
{ {

View File

@ -543,6 +543,11 @@ class TIA : public Device
string myFixedColorNames[7]; string myFixedColorNames[7];
private: private:
/**
* Called to initialize all instance variables to known state.
*/
void initialize();
/** /**
* This callback is invoked by FrameManager when a new frame starts. * This callback is invoked by FrameManager when a new frame starts.
*/ */