DRACI: Remove all instances of s(n)printf

This commit is contained in:
Max Horn 2011-06-02 10:46:29 +02:00
parent 59dfd6e859
commit 668ae0363e
5 changed files with 10 additions and 14 deletions

View file

@ -439,10 +439,8 @@ void DraciEngine::syncSoundSettings() {
_music->syncVolume();
}
const char *DraciEngine::getSavegameFile(int saveGameIdx) {
static char buffer[20];
sprintf(buffer, "draci.s%02d", saveGameIdx);
return buffer;
Common::String DraciEngine::getSavegameFile(int saveGameIdx) {
return Common::String::format("draci.s%02d", saveGameIdx);
}
Common::Error DraciEngine::loadGameState(int slot) {

View file

@ -67,7 +67,7 @@ public:
void handleEvents();
static const char *getSavegameFile(int saveGameIdx);
static Common::String getSavegameFile(int saveGameIdx);
virtual Common::Error loadGameState(int slot);
virtual bool canLoadGameStateCurrently();
virtual Common::Error saveGameState(int slot, const char *desc);

View file

@ -934,13 +934,12 @@ void Game::inventorySwitch(int keycode) {
void Game::dialogueMenu(int dialogueID) {
int oldLines, hit;
char tmp[5];
sprintf(tmp, "%d", dialogueID+1);
Common::String ext(tmp);
_dialogueArchive = new BArchive(dialoguePath + ext + ".dfw");
Common::String name;
name = dialoguePath + Common::String::format("%d.dfw", dialogueID + 1);
_dialogueArchive = new BArchive(name);
debugC(4, kDraciLogicDebugLevel, "Starting dialogue (ID: %d, Archive: %s)",
dialogueID, (dialoguePath + ext + ".dfw").c_str());
dialogueID, name.c_str());
_currentDialogue = dialogueID;
oldLines = 255;

View file

@ -86,7 +86,7 @@ void writeSavegameHeader(Common::OutSaveFile *out, const DraciSavegameHeader &he
}
Common::Error saveSavegameData(int saveGameIdx, const Common::String &saveName, DraciEngine &vm) {
const char *filename = vm.getSavegameFile(saveGameIdx);
Common::String filename = vm.getSavegameFile(saveGameIdx);
Common::SaveFileManager *saveMan = g_system->getSavefileManager();
Common::OutSaveFile *f = saveMan->openForSaving(filename);
if (f == NULL)

View file

@ -240,9 +240,8 @@ SoundSample *ZipSoundArchive::getSample(int i, uint freq) {
sample._frequency = freq ? freq : _defaultFreq;
sample._format = _format;
// Read in the file (without the file header)
char file_name[20];
sprintf(file_name, "%d.%s", i+1, _extension);
sample._stream = _archive->createReadStreamForMember(file_name);
Common::String filename = Common::String::format("%d.%s", i+1, _extension);
sample._stream = _archive->createReadStreamForMember(filename);
if (!sample._stream) {
debugC(2, kDraciArchiverDebugLevel, "Doesn't exist");
return NULL;