Skip to content

Commit

Permalink
Merge pull request #51 from winterheart/clang-format
Browse files Browse the repository at this point in the history
Clang format
  • Loading branch information
winterheart authored Apr 17, 2024
2 parents 494d588 + d83acc2 commit b36325c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 158 deletions.
137 changes: 0 additions & 137 deletions #.clang-format#

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/[email protected]
with:
clang-format-version: '17'
clang-format-version: '18'
4 changes: 2 additions & 2 deletions Descent3/Mission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1836,8 +1836,8 @@ bool mn3_Open(const char *mn3file) {
// concatanate the mn3 extension if it isn't there.
char tempMn3File[PSPATHNAME_LEN];
if (!IS_MN3_FILE(mn3file)) {
strncpy(tempMn3File, mn3file, sizeof(tempMn3File) - 1);
tempMn3File[sizeof(tempMn3File) - 1] = 0;
strncpy(tempMn3File, mn3file, sizeof(tempMn3File) - 1);
tempMn3File[sizeof(tempMn3File) - 1] = 0;
strcat(tempMn3File, ".mn3");
mn3file = tempMn3File;
}
Expand Down
12 changes: 6 additions & 6 deletions Descent3/cockpit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,12 @@
#define BUFFET_PERIOD 0.25f
#define COCKPIT_SHIFT_DELTA 0.02f
typedef struct tCockpitCfgInfo {
char modelname[PSFILENAME_LEN+1];
char shieldrings[NUM_SHIELD_GAUGE_FRAMES][PSFILENAME_LEN+1];
char shipimg[PSFILENAME_LEN+1];
char burnimg[PSFILENAME_LEN+1];
char energyimg[PSFILENAME_LEN+1];
char invpulseimg[PSFILENAME_LEN+1];
char modelname[PSFILENAME_LEN + 1];
char shieldrings[NUM_SHIELD_GAUGE_FRAMES][PSFILENAME_LEN + 1];
char shipimg[PSFILENAME_LEN + 1];
char burnimg[PSFILENAME_LEN + 1];
char energyimg[PSFILENAME_LEN + 1];
char invpulseimg[PSFILENAME_LEN + 1];
} tCockpitCfgInfo;
typedef struct tCockpitInfo {
int state; // current state of cockpit on screen.
Expand Down
2 changes: 1 addition & 1 deletion Descent3/gamesave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ void QuickSaveGame() {
SaveGameDialog();
} else {
// verify savegame still exists in the appropriate slot, if not just run dialog, if so then save
char filename[PSFILENAME_LEN+1];
char filename[PSFILENAME_LEN + 1];
char pathname[PSPATHNAME_LEN];
char desc[GAMESAVE_DESCLEN + 1];
FILE *fp;
Expand Down
2 changes: 1 addition & 1 deletion Descent3/scorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void AddScorch(int roomnum, int facenum, vector *pos, int texture_handle, float
float size = (float)sp->size / 16.0;

// Increment count, and stop drawing if hit limit
if (sp->roomface == roomface) { // Found one!
if (sp->roomface == roomface) { // Found one!
count += std::max((int)size, 1); // count large marks more
if (count >= MAX_VIS_COUNT)
return;
Expand Down
8 changes: 4 additions & 4 deletions lib/hogfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ typedef struct tHogHeader {
} tHogHeader;

typedef struct tHogFileEntry {
char name[HOG_FILENAME_LEN]; // file name
unsigned flags; // extra info
unsigned len; // length of file
unsigned long timestamp; // time of file.
char name[HOG_FILENAME_LEN]; // file name
unsigned flags; // extra info
unsigned len; // length of file
unsigned long timestamp; // time of file.
} tHogFileEntry;

#define HOGMAKER_ERROR 0 // Incorrect number of files passed in
Expand Down
12 changes: 6 additions & 6 deletions model/newstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1158,19 +1158,19 @@ float ComputeDefaultSizeFunc(int handle, float *size_ptr, vector *offset_ptr, bo
vector max_xyz;
bool first_pnt = true;

for(frame_index = start_frame; frame_index <= end_frame; frame_index++) {
for (frame_index = start_frame; frame_index <= end_frame; frame_index++) {
// Because size changes with animation, we need the worst case point -- so, check every keyframe
// NOTE: This code does not currently account for all $turret and $rotate positions

SetNormalizedTimeAnim(frame_index, normalized_time, pm);

SetModelAnglesAndPos(pm, normalized_time);

for (model_index = 0;model_index < pm->n_models; model_index++) {
for (model_index = 0; model_index < pm->n_models; model_index++) {
bsp_info *sm = &pm->submodel[model_index];

// For every vertex
for(sm_vert_index = 0; sm_vert_index < sm->nverts; sm_vert_index++) {
for (sm_vert_index = 0; sm_vert_index < sm->nverts; sm_vert_index++) {
vector pnt;
int mn;

Expand Down Expand Up @@ -1228,19 +1228,19 @@ float ComputeDefaultSizeFunc(int handle, float *size_ptr, vector *offset_ptr, bo
*offset_ptr = geometric_center;
}

for(frame_index = start_frame; frame_index <= end_frame; frame_index++) {
for (frame_index = start_frame; frame_index <= end_frame; frame_index++) {
// Because size changes with animation, we need the worst case point -- so, check every keyframe
// NOTE: This code does not currently account for all $turret and $rotate positions

SetNormalizedTimeAnim(frame_index, normalized_time, pm);

SetModelAnglesAndPos(pm, normalized_time);

for(model_index = 0; model_index < pm->n_models; model_index++) {
for (model_index = 0; model_index < pm->n_models; model_index++) {
bsp_info *sm = &pm->submodel[model_index];

// For every vertex
for(sm_vert_index = 0; sm_vert_index < sm->nverts; sm_vert_index++) {
for (sm_vert_index = 0; sm_vert_index < sm->nverts; sm_vert_index++) {
vector pnt;
int mn;

Expand Down

0 comments on commit b36325c

Please sign in to comment.