Skip to content

Commit

Permalink
Begin modernizing CFILE
Browse files Browse the repository at this point in the history
Begin replacing custom string manipulation within CFILE with std::filesystem.
  • Loading branch information
tophyr committed Apr 28, 2024
1 parent 2102b5b commit 65dbd67
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 94 deletions.
4 changes: 2 additions & 2 deletions Descent3/descent.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -576,7 +576,7 @@ void Descent3() {
// Save settings to registry
SaveGameSettings();
} catch (cfile_error *cfe) {
Error(TXT_D3ERROR1, (cfe->read_write == CFE_READING) ? TXT_READING : TXT_WRITING, cfe->file->name, cfe->msg);
Error(TXT_D3ERROR1, (cfe->read_write == CFE_READING) ? TXT_READING : TXT_WRITING, cfe->file->path.c_str(), cfe->msg);
}
}

Expand Down
10 changes: 5 additions & 5 deletions Descent3/multi.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -3680,7 +3680,7 @@ void MultiDoLeaveGame(ubyte *data) {
if (NetPlayers[slot].file_xfer_flags != NETFILE_NONE) {
if (NetPlayers[slot].file_xfer_cfile) {
char delfile[_MAX_PATH * 2];
strcpy(delfile, NetPlayers[slot].file_xfer_cfile->name);
strcpy(delfile, NetPlayers[slot].file_xfer_cfile->path.c_str());
cfclose(NetPlayers[slot].file_xfer_cfile);
NetPlayers[slot].file_xfer_cfile = NULL;
if (NetPlayers[slot].file_xfer_flags == NETFILE_RECEIVING)
Expand Down Expand Up @@ -3720,7 +3720,7 @@ void MultiDoServerQuit(ubyte *data) {
if (NetPlayers[i].file_xfer_flags != NETFILE_NONE) {
if (NetPlayers[i].file_xfer_cfile) {
char delfile[_MAX_PATH * 2];
strcpy(delfile, NetPlayers[i].file_xfer_cfile->name);
strcpy(delfile, NetPlayers[i].file_xfer_cfile->path.c_str());
cfclose(NetPlayers[i].file_xfer_cfile);
NetPlayers[i].file_xfer_cfile = NULL;
if (NetPlayers[i].file_xfer_flags == NETFILE_RECEIVING)
Expand Down Expand Up @@ -3748,7 +3748,7 @@ void MultiDoDisconnect(ubyte *data) {
if (NetPlayers[slot].file_xfer_flags != NETFILE_NONE) {
if (NetPlayers[slot].file_xfer_cfile) {
char delfile[_MAX_PATH * 2];
strcpy(delfile, NetPlayers[slot].file_xfer_cfile->name);
strcpy(delfile, NetPlayers[slot].file_xfer_cfile->path.c_str());
cfclose(NetPlayers[slot].file_xfer_cfile);
NetPlayers[slot].file_xfer_cfile = NULL;
if (NetPlayers[slot].file_xfer_flags == NETFILE_RECEIVING)
Expand Down Expand Up @@ -7941,7 +7941,7 @@ void MultiDoFileCancelled(ubyte *data) {
mprintf((0, "Got a cancelled packet from %d for %d\n", playernum, filewho));
if (NetPlayers[filewho].file_xfer_cfile) {
char delfile[_MAX_PATH * 2];
strcpy(delfile, NetPlayers[filewho].file_xfer_cfile->name);
strcpy(delfile, NetPlayers[filewho].file_xfer_cfile->path.c_str());
cfclose(NetPlayers[filewho].file_xfer_cfile);
NetPlayers[filewho].file_xfer_cfile = NULL;
ddio_DeleteFile(delfile);
Expand Down

0 comments on commit 65dbd67

Please sign in to comment.