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(); _music->syncVolume();
} }
const char *DraciEngine::getSavegameFile(int saveGameIdx) { Common::String DraciEngine::getSavegameFile(int saveGameIdx) {
static char buffer[20]; return Common::String::format("draci.s%02d", saveGameIdx);
sprintf(buffer, "draci.s%02d", saveGameIdx);
return buffer;
} }
Common::Error DraciEngine::loadGameState(int slot) { Common::Error DraciEngine::loadGameState(int slot) {

View file

@ -67,7 +67,7 @@ public:
void handleEvents(); void handleEvents();
static const char *getSavegameFile(int saveGameIdx); static Common::String getSavegameFile(int saveGameIdx);
virtual Common::Error loadGameState(int slot); virtual Common::Error loadGameState(int slot);
virtual bool canLoadGameStateCurrently(); virtual bool canLoadGameStateCurrently();
virtual Common::Error saveGameState(int slot, const char *desc); 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) { void Game::dialogueMenu(int dialogueID) {
int oldLines, hit; int oldLines, hit;
char tmp[5]; Common::String name;
sprintf(tmp, "%d", dialogueID+1); name = dialoguePath + Common::String::format("%d.dfw", dialogueID + 1);
Common::String ext(tmp); _dialogueArchive = new BArchive(name);
_dialogueArchive = new BArchive(dialoguePath + ext + ".dfw");
debugC(4, kDraciLogicDebugLevel, "Starting dialogue (ID: %d, Archive: %s)", debugC(4, kDraciLogicDebugLevel, "Starting dialogue (ID: %d, Archive: %s)",
dialogueID, (dialoguePath + ext + ".dfw").c_str()); dialogueID, name.c_str());
_currentDialogue = dialogueID; _currentDialogue = dialogueID;
oldLines = 255; 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) { 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::SaveFileManager *saveMan = g_system->getSavefileManager();
Common::OutSaveFile *f = saveMan->openForSaving(filename); Common::OutSaveFile *f = saveMan->openForSaving(filename);
if (f == NULL) if (f == NULL)

View file

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