mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
GRIFFON: Don't use unsafe strcat and strcpy
This commit is contained in:
parent
f26ce1e4ff
commit
0a0d21b904
@ -553,7 +553,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
|
|||||||
int fcol;
|
int fcol;
|
||||||
|
|
||||||
if (damage == 0) {
|
if (damage == 0) {
|
||||||
strcpy(line, "miss!");
|
Common::strcpy_s(line, "miss!");
|
||||||
fcol = 2;
|
fcol = 2;
|
||||||
} else {
|
} else {
|
||||||
int ratio = 0;
|
int ratio = 0;
|
||||||
@ -1021,7 +1021,7 @@ void GriffonEngine::damagePlayer(int damage) {
|
|||||||
|
|
||||||
sprintf(line, "-%i", damage);
|
sprintf(line, "-%i", damage);
|
||||||
if (damage == 0)
|
if (damage == 0)
|
||||||
strcpy(line, "miss!");
|
Common::strcpy_s(line, "miss!");
|
||||||
|
|
||||||
addFloatText(line, _player.px + 12 - 4 * strlen(line), _player.py + 16, 4);
|
addFloatText(line, _player.px + 12 - 4 * strlen(line), _player.py + 16, 4);
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ void GriffonEngine::configMenu() {
|
|||||||
int vol = (i ==18 ? config.musicVol : config.effectsVol) * 9 / 255;
|
int vol = (i ==18 ? config.musicVol : config.effectsVol) * 9 / 255;
|
||||||
vol = CLIP(vol, 0, 9);
|
vol = CLIP(vol, 0, 9);
|
||||||
|
|
||||||
strcpy(line, "[----------]");
|
Common::strcpy_s(line, "[----------]");
|
||||||
line[vol + 1] = 'X';
|
line[vol + 1] = 'X';
|
||||||
optionValues[i] = line;
|
optionValues[i] = line;
|
||||||
} else if (i > 21)
|
} else if (i > 21)
|
||||||
@ -579,7 +579,7 @@ void GriffonEngine::renderSaveStates() {
|
|||||||
drawString(_videoBuffer2, line, sx, sy, cc);
|
drawString(_videoBuffer2, line, sx, sy, cc);
|
||||||
|
|
||||||
if (_playera.level == 22)
|
if (_playera.level == 22)
|
||||||
strcpy(line, "Level: MAX");
|
Common::strcpy_s(line, "Level: MAX");
|
||||||
else
|
else
|
||||||
sprintf(line, "Level: %i", _playera.level);
|
sprintf(line, "Level: %i", _playera.level);
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ void GriffonEngine::drawHud() {
|
|||||||
|
|
||||||
sprintf(line, "Level : %i", _player.level);
|
sprintf(line, "Level : %i", _player.level);
|
||||||
if (_player.level == _player.maxLevel)
|
if (_player.level == _player.maxLevel)
|
||||||
strcpy(line, "Level : MAX");
|
Common::strcpy_s(line, "Level : MAX");
|
||||||
drawString(_videoBuffer, line, sx, sy + 8, 0);
|
drawString(_videoBuffer, line, sx, sy + 8, 0);
|
||||||
|
|
||||||
// experience
|
// experience
|
||||||
|
@ -58,7 +58,7 @@ void GriffonEngine::addFloatText(const char *stri, float xloc, float yloc, int c
|
|||||||
_floatText[i].x = xloc;
|
_floatText[i].x = xloc;
|
||||||
_floatText[i].y = yloc;
|
_floatText[i].y = yloc;
|
||||||
_floatText[i].col = col;
|
_floatText[i].col = col;
|
||||||
strcpy(_floatText[i].text, stri);
|
Common::strcpy_s(_floatText[i].text, 64, stri);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1637,20 +1637,20 @@ void GriffonEngine::updateSpells() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char line[256];
|
char line[256];
|
||||||
strcpy(line, "Found... nothing...");
|
Common::strcpy_s(line, "Found... nothing...");
|
||||||
|
|
||||||
for (int f1 = 0; f1 < 5; f1++) {
|
for (int f1 = 0; f1 < 5; f1++) {
|
||||||
if (foundel[f1] && !_player.foundSpell[f1]) {
|
if (foundel[f1] && !_player.foundSpell[f1]) {
|
||||||
_player.foundSpell[f1] = 1;
|
_player.foundSpell[f1] = 1;
|
||||||
_player.spellCharge[f1] = 0;
|
_player.spellCharge[f1] = 0;
|
||||||
if (f1 == 1)
|
if (f1 == 1)
|
||||||
strcpy(line, "Found... Water Essence");
|
Common::strcpy_s(line, "Found... Water Essence");
|
||||||
if (f1 == 2)
|
if (f1 == 2)
|
||||||
strcpy(line, "Found... Metal Essence");
|
Common::strcpy_s(line, "Found... Metal Essence");
|
||||||
if (f1 == 3)
|
if (f1 == 3)
|
||||||
strcpy(line, "Found... Earth Essence");
|
Common::strcpy_s(line, "Found... Earth Essence");
|
||||||
if (f1 == 4)
|
if (f1 == 4)
|
||||||
strcpy(line, "Found... Fire Essence");
|
Common::strcpy_s(line, "Found... Fire Essence");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user