Skip to content

Commit

Permalink
fix virtual calls from constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
jdratlif committed Sep 17, 2022
1 parent aa1e40b commit fa45817
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 30 deletions.
15 changes: 4 additions & 11 deletions source/model/gbggrawcode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,11 @@

using namespace ggencoder;

GBGGRawCode::GBGGRawCode(int address, int value, int compare) {
setAddress(address);
setValue(value);
setCompare(compare);
}

GBGGRawCode::GBGGRawCode(int address, int value) {
setAddress(address);
setValue(value);
GBGGRawCode::GBGGRawCode(int address, int value, int compare)
: RawCode{address & 0xFFFF, value & 0xFF}, CompareRawCode{compare} {}

compare = -1;
}
GBGGRawCode::GBGGRawCode(int address, int value)
: RawCode{address & 0xFFFF, value & 0xFF}, CompareRawCode{-1} {}

void GBGGRawCode::setAddress(int address) {
this->address = (address & 0xFFFF);
Expand Down
6 changes: 2 additions & 4 deletions source/model/genesisrawcode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@

using namespace ggencoder;

GenesisRawCode::GenesisRawCode(int address, int value) {
setAddress(address);
setValue(value);
}
GenesisRawCode::GenesisRawCode(int address, int value)
: RawCode{address & 0xFFFFFF, value & 0xFFFF} {}

void GenesisRawCode::setAddress(int address) {
this->address = (address & 0xFFFFFF);
Expand Down
15 changes: 4 additions & 11 deletions source/model/nesrawcode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,11 @@

using namespace ggencoder;

NESRawCode::NESRawCode(int address, int value, int compare) {
setAddress(address);
setValue(value);
setCompare(compare);
}

NESRawCode::NESRawCode(int address, int value) {
setAddress(address);
setValue(value);
NESRawCode::NESRawCode(int address, int value, int compare)
: RawCode{address & 0xFFFF, value & 0xFF}, CompareRawCode{compare} {}

compare = -1;
}
NESRawCode::NESRawCode(int address, int value)
: RawCode{address & 0xFFFF, value & 0xFF}, CompareRawCode{-1} {}

void NESRawCode::setAddress(int address) {
this->address = (address & 0xFFFF);
Expand Down
6 changes: 2 additions & 4 deletions source/model/snesrawcode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@

using namespace ggencoder;

SNESRawCode::SNESRawCode(int address, int value) {
setAddress(address);
setValue(value);
}
SNESRawCode::SNESRawCode(int address, int value)
: RawCode{address & 0xFFFFFF, value & 0xFF} {}

void SNESRawCode::setAddress(int address) {
this->address = (address & 0xFFFFFF);
Expand Down

0 comments on commit fa45817

Please sign in to comment.