diff --git a/code/comms.cpp b/code/comms.cpp index a2b3d2c..5b70a62 100644 --- a/code/comms.cpp +++ b/code/comms.cpp @@ -85,7 +85,6 @@ static void createMissionDetailSurface(SDL_Surface *comms, int missionSlot) blevelRect(comms, 0, 0, comms->w - 1, comms->h - 1, 0x00, 0x00, 0x25); - strcpy(string, ""); sprintf(string, "data/brief%d.txt", mission); #if USEPACK diff --git a/code/init.cpp b/code/init.cpp index 998d545..31ce70e 100644 --- a/code/init.cpp +++ b/code/init.cpp @@ -74,7 +74,6 @@ void showErrorAndExit(int errorId, const char *name) switch(errorId) { case 0: - strcpy(string, ""); sprintf(string, "%s was not found in the Starfighter data package", name); drawString(string, -1, 250, FONT_WHITE); drawString("Please try again. If this error persists, contact the authors", -1, 275, FONT_WHITE); diff --git a/code/missions.cpp b/code/missions.cpp index b584be5..3440896 100644 --- a/code/missions.cpp +++ b/code/missions.cpp @@ -380,9 +380,10 @@ static void evaluateRequirement(int type, int id, int *completed, int *targetVal case M_DESTROY_TARGET_TYPE: if ((*targetValue <= 10) || (*targetValue % 10 == 0)) { - sprintf(message, "Destroy %d more...", *targetValue); if ((rand() % 2) == 0) sprintf(message, "%d more to go...", *targetValue); + else + sprintf(message, "Destroy %d more...", *targetValue); } break; case M_DISABLE_TARGET: @@ -480,8 +481,7 @@ Missions 11 and 23 to be exact! static char revealHiddenObjectives() { char allDone = 1; - char string[255]; - strcpy(string, ""); + char string[255] = ""; for (int i = 0 ; i < 3 ; i++) { @@ -733,7 +733,6 @@ void missionBriefScreen() if (currentMission.timeLimit1[0] > 0) { char temp[50]; - strcpy(temp, ""); if (currentGame.area != 24) sprintf(temp, "TIME LIMIT: %d minutes", currentMission.timeLimit1[0]); else @@ -921,7 +920,6 @@ static void loadMissions() for (int i = 0 ; i < MAX_MISSIONS ; i++) { - strcpy(filename, ""); sprintf(filename, "data/mission%.2d.dat", i); #if USEPACK @@ -987,7 +985,6 @@ static void saveMissions() for (int i = 0 ; i < MAX_MISSIONS ; i++) { - strcpy(filename, ""); sprintf(filename, "data/mission%.2d.dat", i); //WRITE MISSION DATA diff --git a/code/resources.cpp b/code/resources.cpp index 47a7e5a..cac920b 100644 --- a/code/resources.cpp +++ b/code/resources.cpp @@ -34,14 +34,13 @@ void loadBackground(const char *filename) void loadGameGraphics() { int index; - char string[75]; + char string[75] = ""; freeGraphics(); shipShape[0] = loadImage("gfx/firefly1.png"); shipShape[1] = loadImage("gfx/firefly2.png"); - strcpy(string, ""); switch(currentGame.system) { case 0: diff --git a/code/script.cpp b/code/script.cpp index 1bb9bc9..f44da94 100644 --- a/code/script.cpp +++ b/code/script.cpp @@ -53,7 +53,6 @@ void loadScriptEvents() setKlineGreeting(); char filename[255]; - strcpy(filename, ""); sprintf(filename, "data/script%d.txt", currentGame.area); FILE *fp; @@ -143,7 +142,6 @@ static void setScene(int scene) float sx, sy, x, y, speed; int index, shape; - strcpy(string, ""); sprintf(string, "data/cutscene%d.dat", scene); #if USEPACK diff --git a/code/shop.cpp b/code/shop.cpp index 8801f2f..9f146e4 100644 --- a/code/shop.cpp +++ b/code/shop.cpp @@ -25,8 +25,7 @@ static signed char shopSelectedItem; static void drawSecondaryWeaponSurface() { - char description[50]; - strcpy(description, ""); + char description[50] = ""; drawString("Secondary Weapon", 10, 3, FONT_WHITE, shopSurface[2]); diff --git a/code/unpack.cpp b/code/unpack.cpp index 78a54c1..397f5a8 100644 --- a/code/unpack.cpp +++ b/code/unpack.cpp @@ -110,14 +110,12 @@ When it is found, return the location. */ int locateDataInPak(const char *file, bool required) { - char packFilename[60]; + char packFilename[60] = ""; int packFSize; int location = 0; FILE *pak; - strcpy(packFilename, ""); - pak = fopen(PACKLOCATION, "rb"); if (pak == NULL) {