Skip to content

Commit

Permalink
QDENGINE: Force file offsets to be 'int' in debug messages
Browse files Browse the repository at this point in the history
This fixes annpying portability issue, generating tons of warnings,
since printing int64s is still platform-dependent.
  • Loading branch information
sev- committed Sep 7, 2024
1 parent 090e347 commit 539bbd3
Show file tree
Hide file tree
Showing 21 changed files with 113 additions and 113 deletions.
8 changes: 4 additions & 4 deletions engines/qdengine/qdcore/qd_animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ Vect2i qdAnimation::remove_edges() {
}

bool qdAnimation::load_data(Common::SeekableReadStream &fh, int save_version) {
debugC(3, kDebugSave, " qdAnimation::load_data(): before %ld", fh.pos());
debugC(3, kDebugSave, " qdAnimation::load_data(): before: %d", (int)fh.pos());

if (!qdNamedObject::load_data(fh, save_version))
return false;
Expand Down Expand Up @@ -985,12 +985,12 @@ bool qdAnimation::load_data(Common::SeekableReadStream &fh, int save_version) {
_status = st;
_is_finished = (finished) ? true : false;

debugC(2, kDebugSave, " qdAnimation::load_data(): after %ld", fh.pos());
debugC(2, kDebugSave, " qdAnimation::load_data(): after: %d", (int)fh.pos());
return true;
}

bool qdAnimation::save_data(Common::WriteStream &fh) const {
debugC(3, kDebugSave, " qdAnimation::save_data(): before %ld", fh.pos());
debugC(3, kDebugSave, " qdAnimation::save_data(): before: %d", (int)fh.pos());

if (!qdNamedObject::save_data(fh)) return false;

Expand All @@ -1008,7 +1008,7 @@ bool qdAnimation::save_data(Common::WriteStream &fh) const {
fh.writeFloatLE(_cur_time);
fh.writeFloatLE(_length);

debugC(3, kDebugSave, " qdAnimation::save_data(): after %ld", fh.pos());
debugC(3, kDebugSave, " qdAnimation::save_data(): after: %d", (int)fh.pos());
return true;
}

Expand Down
8 changes: 4 additions & 4 deletions engines/qdengine/qdcore/qd_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ const sGridCell *qdCamera::get_cell(const Vect2s &cell_pos) const {
}

bool qdCamera::load_data(Common::SeekableReadStream &fh, int save_version) {
debugC(3, kDebugSave, " qdCamera::load_data(): before %ld", fh.pos());
debugC(3, kDebugSave, " qdCamera::load_data(): before: %d", (int)fh.pos());

int x, y;
char flag;
Expand Down Expand Up @@ -977,12 +977,12 @@ bool qdCamera::load_data(Common::SeekableReadStream &fh, int save_version) {
_default_object = dynamic_cast<qdGameObjectAnimated *>(qdGameDispatcher::get_dispatcher()->get_named_object(&ref));
}

debugC(3, kDebugSave, " qdCamera::load_data(): after %ld", fh.pos());
debugC(3, kDebugSave, " qdCamera::load_data(): after: %d", (int)fh.pos());
return true;
}

bool qdCamera::save_data(Common::WriteStream &fh) const {
debugC(3, kDebugSave, " qdCamera::save_data(): before %ld", fh.pos());
debugC(3, kDebugSave, " qdCamera::save_data(): before: %d", (int)fh.pos());
fh.writeSint32LE(_scrCenter.x);
fh.writeSint32LE(_scrCenter.y);
fh.writeSint32LE(_GSX);
Expand All @@ -1009,7 +1009,7 @@ bool qdCamera::save_data(Common::WriteStream &fh) const {
fh.writeByte(char(0));
}

debugC(3, kDebugSave, " qdCamera::save_data(): after %ld", fh.pos());
debugC(3, kDebugSave, " qdCamera::save_data(): after: %d", (int)fh.pos());
return true;
}

Expand Down
8 changes: 4 additions & 4 deletions engines/qdengine/qdcore/qd_camera_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ bool qdCameraMode::save_script(Common::WriteStream &fh, int indent) const {
}

bool qdCameraMode::load_data(Common::SeekableReadStream &fh, int save_version) {
debugC(4, kDebugSave, " qdCameraMode::load_data(): before %ld", fh.pos());
debugC(4, kDebugSave, " qdCameraMode::load_data(): before: %d", (int)fh.pos());
/*int mode = */fh.readSint32LE();
_work_time = fh.readFloatLE();
_scrolling_speed = fh.readFloatLE();
Expand All @@ -104,13 +104,13 @@ bool qdCameraMode::load_data(Common::SeekableReadStream &fh, int save_version) {

char switch_flag = fh.readByte();
_smooth_switch = (switch_flag) ? true : false;
debugC(4, kDebugSave, " qdCameraMode::load_data(): after %ld", fh.pos());
debugC(4, kDebugSave, " qdCameraMode::load_data(): after: %d", (int)fh.pos());

return true;
}

bool qdCameraMode::save_data(Common::WriteStream &fh) const {
debugC(4, kDebugSave, " qdCameraMode::save_data(): before %ld", fh.pos());
debugC(4, kDebugSave, " qdCameraMode::save_data(): before: %d", (int)fh.pos());

fh.writeSint32LE((int)_camera_mode);
fh.writeFloatLE(_work_time);
Expand All @@ -126,7 +126,7 @@ bool qdCameraMode::save_data(Common::WriteStream &fh) const {
fh.writeByte(0);
}

debugC(4, kDebugSave, " qdCameraMode::save_data(): after %ld", fh.pos());
debugC(4, kDebugSave, " qdCameraMode::save_data(): after: %d", (int)fh.pos());
return true;
}

Expand Down
8 changes: 4 additions & 4 deletions engines/qdengine/qdcore/qd_condition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ void qdCondition::quant(float dt) {
}

bool qdCondition::load_data(Common::SeekableReadStream &fh, int save_version) {
debugC(5, kDebugSave, " qdCondition::load_data(): before %ld", fh.pos());
debugC(5, kDebugSave, " qdCondition::load_data(): before: %d", (int)fh.pos());
if (_type == CONDITION_TIMER) {
int state;
float timer;
Expand All @@ -416,12 +416,12 @@ bool qdCondition::load_data(Common::SeekableReadStream &fh, int save_version) {
if (!put_value(TIMER_RND, state, 1)) return false;
}

debugC(5, kDebugSave, " qdCondition::load_data(): after %ld", fh.pos());
debugC(5, kDebugSave, " qdCondition::load_data(): after: %d", (int)fh.pos());
return true;
}

bool qdCondition::save_data(Common::WriteStream &fh) const {
debugC(5, kDebugSave, " qdCondition::save_data(): before %ld", fh.pos());
debugC(5, kDebugSave, " qdCondition::save_data(): before: %d", (int)fh.pos());
if (_type == CONDITION_TIMER) {
float timer;
if (!get_value(TIMER_PERIOD, timer, 1)) {
Expand All @@ -437,7 +437,7 @@ bool qdCondition::save_data(Common::WriteStream &fh) const {
fh.writeSint32LE(state);
}

debugC(5, kDebugSave, " qdCondition::save_data(): after %ld", fh.pos());
debugC(5, kDebugSave, " qdCondition::save_data(): after: %d", (int)fh.pos());
return true;
}

Expand Down
8 changes: 4 additions & 4 deletions engines/qdengine/qdcore/qd_conditional_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,27 +198,27 @@ void qdConditionalObject::conditions_quant(float dt) {
}

bool qdConditionalObject::load_data(Common::SeekableReadStream &fh, int save_version) {
debugC(4, kDebugSave, " qdConditionalObject::load_data(): before %ld", fh.pos());
debugC(4, kDebugSave, " qdConditionalObject::load_data(): before: %d", (int)fh.pos());
if (!qdNamedObject::load_data(fh, save_version))
return false;

for (auto &it : _conditions)
it.load_data(fh, save_version);

debugC(4, kDebugSave, " qdConditionalObject::load_data(): after %ld", fh.pos());
debugC(4, kDebugSave, " qdConditionalObject::load_data(): after: %d", (int)fh.pos());
return true;
}

bool qdConditionalObject::save_data(Common::WriteStream &fh) const {
debugC(4, kDebugSave, " qdConditionalObject::save_data(): before %ld", fh.pos());
debugC(4, kDebugSave, " qdConditionalObject::save_data(): before: %d", (int)fh.pos());
if (!qdNamedObject::save_data(fh)) {
return false;
}

for (auto &it : _conditions)
it.save_data(fh);

debugC(4, kDebugSave, " qdConditionalObject::save_data(): after %ld", fh.pos());
debugC(4, kDebugSave, " qdConditionalObject::save_data(): after: %d", (int)fh.pos());
return true;
}

Expand Down
8 changes: 4 additions & 4 deletions engines/qdengine/qdcore/qd_coords_animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ void qdCoordsAnimation::set_time_rel(float tm) {
}

bool qdCoordsAnimation::load_data(Common::SeekableReadStream &fh, int save_version) {
debugC(4, kDebugSave, " qdCoordsAnimation::load_data(): before %ld", fh.pos());
debugC(4, kDebugSave, " qdCoordsAnimation::load_data(): before: %d", (int)fh.pos());

if (!qdNamedObject::load_data(fh, save_version)) return false;

Expand Down Expand Up @@ -449,12 +449,12 @@ bool qdCoordsAnimation::load_data(Common::SeekableReadStream &fh, int save_versi
vec.z = fh.readFloatLE();
_start_point.set_dest_pos(vec);

debugC(4, kDebugSave, " qdCoordsAnimation::load_data(): after %ld", fh.pos());
debugC(4, kDebugSave, " qdCoordsAnimation::load_data(): after: %d", (int)fh.pos());
return true;
}

bool qdCoordsAnimation::save_data(Common::WriteStream &fh) const {
debugC(4, kDebugSave, " qdCoordsAnimation::save_data(): before %ld", fh.pos());
debugC(4, kDebugSave, " qdCoordsAnimation::save_data(): before: %d", (int)fh.pos());
if (!qdNamedObject::save_data(fh)) return false;

fh.writeSint32LE(static_cast<int>(_status));
Expand All @@ -474,7 +474,7 @@ bool qdCoordsAnimation::save_data(Common::WriteStream &fh) const {
fh.writeFloatLE(_start_point.dest_pos().x);
fh.writeFloatLE(_start_point.dest_pos().y);
fh.writeFloatLE(_start_point.dest_pos().z);
debugC(4, kDebugSave, " qdCoordsAnimation::save_data(): after %ld", fh.pos());
debugC(4, kDebugSave, " qdCoordsAnimation::save_data(): after: %d", (int)fh.pos());
return true;
}
} // namespace QDEngine
8 changes: 4 additions & 4 deletions engines/qdengine/qdcore/qd_counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ bool qdCounter::save_script(Common::WriteStream &fh, int indent) const {
}

bool qdCounter::load_data(Common::SeekableReadStream &fh, int save_version) {
debugC(3, kDebugSave, " qdCounter::load_data(): before %ld", fh.pos());
debugC(3, kDebugSave, " qdCounter::load_data(): before: %d", (int)fh.pos());
int sz;
_value = fh.readSint32LE();
sz = fh.readSint32LE();
Expand All @@ -281,20 +281,20 @@ bool qdCounter::load_data(Common::SeekableReadStream &fh, int save_version) {
for (auto &it : _elements)
it.load_data(fh, save_version);

debugC(3, kDebugSave, " qdCounter::load_data(): after %ld", fh.pos());
debugC(3, kDebugSave, " qdCounter::load_data(): after: %d", (int)fh.pos());
return true;
}

bool qdCounter::save_data(Common::WriteStream &fh) const {
debugC(3, kDebugSave, " qdCounter::save_data(): before %ld", fh.pos());
debugC(3, kDebugSave, " qdCounter::save_data(): before: %d", (int)fh.pos());
fh.writeSint32LE(_value);
fh.writeSint32LE(_elements.size());

for (auto &it : _elements) {
it.save_data(fh);
}

debugC(3, kDebugSave, " qdCounter::save_data(): after %ld", fh.pos());
debugC(3, kDebugSave, " qdCounter::save_data(): after: %d", (int)fh.pos());
return true;
}

Expand Down
Loading

0 comments on commit 539bbd3

Please sign in to comment.