Hello Javier!
13 Jun 97 21:19, Javier Kohen wrote to All:
JK> Could you please make any suggestions that you can have about this
JK> code??? (I mean the code part, not the algorithm)
Let me suggest some corrections to this code concerning a style.
JK> void MouseInfo::setButtons(int but)
JK> {
JK> if (but != -1) {
JK> installed = True;
JK> buttons = but;
JK> } else {
JK> installed = False;
JK> buttons = -1;
JK> }
JK> }
I'd write instead:
void MouseInfo::setButtons(int but)
{
installed = (buttons = but) + 1 ? False : True;
}
JK> void Mouse::reset(Reset resetType)
JK> {
JK> if (resetType == Hard) {
JK> regs.x.ax = 0x0000;
JK> } else {
JK> regs.x.ax = 0x0021;
JK> }
By the same manner:
regs.x.ax = resetType == Hard ? 0 : 0x21;
JK> switch (regs.x.bx) {
JK> case 0x0000:
JK> setButtons(0);
JK> break;
JK> case 0x0002:
JK> setButtons(2);
JK> break;
JK> case 0x0003:
JK> setButtons(3);
JK> break;
JK> case 0xFFFF:
JK> setButtons(2);
JK> break;
JK> default:
JK> setButtons(regs.x.bx);
JK> }
As I see, the only following string replaces this switch:
setButtons (regs.x.bx == 0xffff ? 2 : regs.x.bx);
Vadim
--- GoldED 2.41+
---------------
* Origin: ---- * BackSpace * St.Petersburg * Russia * ---- (2:5030/122.72)
|