[Scummvm-git-logs] scummvm master -> 8323db565c1f1f9d1990a4156f7e990022753a7d
OMGPizzaGuy
noreply at scummvm.org
Mon Dec 26 16:16:02 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8323db565c ULTIMA8: Replace uses of perr with warning
Commit: 8323db565c1f1f9d1990a4156f7e990022753a7d
https://github.com/scummvm/scummvm/commit/8323db565c1f1f9d1990a4156f7e990022753a7d
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2022-12-26T10:15:29-06:00
Commit Message:
ULTIMA8: Replace uses of perr with warning
Changed paths:
engines/ultima/ultima8/audio/audio_process.cpp
engines/ultima/ultima8/convert/convert_shape.cpp
engines/ultima/ultima8/games/cru_game.cpp
engines/ultima/ultima8/games/game_data.cpp
engines/ultima/ultima8/games/start_u8_process.cpp
engines/ultima/ultima8/games/u8_game.cpp
engines/ultima/ultima8/graphics/fonts/font_manager.cpp
engines/ultima/ultima8/graphics/fonts/font_shape_archive.cpp
engines/ultima/ultima8/graphics/palette_manager.cpp
engines/ultima/ultima8/graphics/shape.cpp
engines/ultima/ultima8/graphics/shape_archive.cpp
engines/ultima/ultima8/graphics/shape_info.cpp
engines/ultima/ultima8/graphics/skf_player.cpp
engines/ultima/ultima8/graphics/type_flags.cpp
engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp
engines/ultima/ultima8/gumps/container_gump.cpp
engines/ultima/ultima8/gumps/item_relative_gump.cpp
engines/ultima/ultima8/kernel/kernel.cpp
engines/ultima/ultima8/kernel/mouse.cpp
engines/ultima/ultima8/kernel/object_manager.cpp
engines/ultima/ultima8/misc/debugger.cpp
engines/ultima/ultima8/misc/debugger.h
engines/ultima/ultima8/misc/id_man.cpp
engines/ultima/ultima8/ultima8.cpp
engines/ultima/ultima8/usecode/uc_machine.cpp
engines/ultima/ultima8/usecode/uc_process.cpp
engines/ultima/ultima8/usecode/uc_stack.cpp
engines/ultima/ultima8/usecode/usecode.cpp
engines/ultima/ultima8/world/actors/actor.cpp
engines/ultima/ultima8/world/actors/actor_anim_process.cpp
engines/ultima/ultima8/world/actors/avatar_death_process.cpp
engines/ultima/ultima8/world/actors/heal_process.cpp
engines/ultima/ultima8/world/actors/main_actor.cpp
engines/ultima/ultima8/world/actors/pathfinder.cpp
engines/ultima/ultima8/world/actors/pathfinder_process.cpp
engines/ultima/ultima8/world/actors/resurrection_process.cpp
engines/ultima/ultima8/world/current_map.cpp
engines/ultima/ultima8/world/fireball_process.cpp
engines/ultima/ultima8/world/item.cpp
engines/ultima/ultima8/world/monster_egg.cpp
engines/ultima/ultima8/world/teleport_egg.cpp
engines/ultima/ultima8/world/world.cpp
diff --git a/engines/ultima/ultima8/audio/audio_process.cpp b/engines/ultima/ultima8/audio/audio_process.cpp
index 2dc7e6244f1..81c0e1c9294 100644
--- a/engines/ultima/ultima8/audio/audio_process.cpp
+++ b/engines/ultima/ultima8/audio/audio_process.cpp
@@ -511,8 +511,10 @@ uint32 AudioProcess::I_playSFX(const uint8 *args, unsigned int argsize) {
}
AudioProcess *ap = AudioProcess::get_instance();
- if (ap) ap->playSFX(sfxNum, priority, objId, 0);
- else perr << "Error: No AudioProcess" << Std::endl;
+ if (ap)
+ ap->playSFX(sfxNum, priority, objId, 0);
+ else
+ warning("No AudioProcess");
return 0;
}
@@ -533,8 +535,10 @@ uint32 AudioProcess::I_playAmbientSFX(const uint8 *args, unsigned int argsize) {
}
AudioProcess *ap = AudioProcess::get_instance();
- if (ap) ap->playSFX(sfxNum, priority, objId, -1, true);
- else perr << "Error: No AudioProcess" << Std::endl;
+ if (ap)
+ ap->playSFX(sfxNum, priority, objId, -1, true);
+ else
+ warning("No AudioProcess");
return 0;
}
@@ -580,8 +584,10 @@ uint32 AudioProcess::I_isSFXPlaying(const uint8 *args, unsigned int argsize) {
ARG_SINT16(sfxNum);
AudioProcess *ap = AudioProcess::get_instance();
- if (ap) return ap->isSFXPlaying(sfxNum);
- else perr << "Error: No AudioProcess" << Std::endl;
+ if (ap)
+ return ap->isSFXPlaying(sfxNum);
+ else
+ warning("No AudioProcess");
return 0;
}
@@ -607,8 +613,10 @@ uint32 AudioProcess::I_setVolumeSFX(const uint8 *args, unsigned int /*argsize*/)
ARG_UINT8(volume);
AudioProcess *ap = AudioProcess::get_instance();
- if (ap) ap->setVolumeSFX(sfxNum, volume);
- else perr << "Error: No AudioProcess" << Std::endl;
+ if (ap)
+ ap->setVolumeSFX(sfxNum, volume);
+ else
+ warning("No AudioProcess");
return 0;
}
@@ -642,8 +650,10 @@ uint32 AudioProcess::I_stopSFX(const uint8 *args, unsigned int argsize) {
}
AudioProcess *ap = AudioProcess::get_instance();
- if (ap) ap->stopSFX(sfxNum, objId);
- else perr << "Error: No AudioProcess" << Std::endl;
+ if (ap)
+ ap->stopSFX(sfxNum, objId);
+ else
+ warning("No AudioProcess");
return 0;
}
@@ -653,7 +663,7 @@ uint32 AudioProcess::I_stopSFXCru(const uint8 *args, unsigned int argsize) {
ARG_ITEM_FROM_PTR(item);
if (!item) {
- perr << "Invalid item in I_stopSFXCru";
+ warning("Invalid item in I_stopSFXCru");
return 0;
}
@@ -663,8 +673,10 @@ uint32 AudioProcess::I_stopSFXCru(const uint8 *args, unsigned int argsize) {
}
AudioProcess *ap = AudioProcess::get_instance();
- if (ap) ap->stopSFX(sfxNum, item->getObjId());
- else perr << "Error: No AudioProcess" << Std::endl;
+ if (ap)
+ ap->stopSFX(sfxNum, item->getObjId());
+ else
+ warning("No AudioProcess");
return 0;
}
@@ -672,8 +684,10 @@ uint32 AudioProcess::I_stopSFXCru(const uint8 *args, unsigned int argsize) {
uint32 AudioProcess::I_stopAllSFX(const uint8 * /*args*/, unsigned int /*argsize*/) {
AudioProcess *ap = AudioProcess::get_instance();
// Not *exactly* the same, but close enough for this intrinsic.
- if (ap) ap->stopAllExceptSpeech();
- else perr << "Error: No AudioProcess" << Std::endl;
+ if (ap)
+ ap->stopAllExceptSpeech();
+ else
+ warning("No AudioProcess");
return 0;
}
diff --git a/engines/ultima/ultima8/convert/convert_shape.cpp b/engines/ultima/ultima8/convert/convert_shape.cpp
index 1b43f64b540..6f45022f17c 100644
--- a/engines/ultima/ultima8/convert/convert_shape.cpp
+++ b/engines/ultima/ultima8/convert/convert_shape.cpp
@@ -64,7 +64,7 @@ void ConvertShape::Read(Common::SeekableReadStream &source, const ConvertShapeFo
source.read(ident, csf->_bytes_ident);
if (memcmp(ident, csf->_ident, csf->_bytes_ident)) {
- perr << "Warning: Corrupt shape!" << Std::endl;
+ warning("Corrupt shape!");
return;
}
}
@@ -94,7 +94,7 @@ void ConvertShape::Read(Common::SeekableReadStream &source, const ConvertShapeFo
// if (_num_frames == 0xFFFF || _num_frames == 0xFFFFFF || _num_frames == -1)
// {
-// perr << "Corrupt shape? " << Std::endl;
+// warning("Corrupt shape?);
// _num_frames = 0;
// _frames = 0;
// return;
@@ -180,8 +180,7 @@ void ConvertShapeFrame::Read(Common::SeekableReadStream &source, const ConvertSh
_height = 0;
_xoff = 0;
_yoff = 0;
- //perr << "Corrupt frame? (frame " << f << ")" << Std::endl;
- perr << "Corrupt frame?" << Std::endl;
+ warning("Corrupt frame?");
}
if (_height) {
@@ -203,7 +202,7 @@ void ConvertShapeFrame::Read(Common::SeekableReadStream &source, const ConvertSh
#ifdef COMP_SHAPENUM
if (_bytes_rle < 0) {
_bytes_rle = 0;
- perr << "Corrupt frame?" << Std::endl;
+ warning("Corrupt frame?");
}
#endif
@@ -298,7 +297,7 @@ void ConvertShapeFrame::ReadCmpFrame(Common::SeekableReadStream &source, const C
}
if (((dlen+extra) << _compression) > 255) {
- perr << "Error! Corrupt Frame. RLE dlen too large" << Std::endl;
+ warning("Corrupt Frame. RLE dlen too large");
}
rlebuf.writeByte((dlen+extra) << _compression);
@@ -707,7 +706,7 @@ void ConvertShape::Write(Common::SeekableWriteStream &dest, const ConvertShapeFo
// Now write _num_frames
if (csf->_bytes_num_frames) writeX(dest, _num_frames, csf->_bytes_num_frames);
else if (!csf->_bytes_num_frames && _num_frames > 1) {
- perr << "Error: Unable to convert multiple frame shapes to " << csf->_name << Std::endl;
+ warning("Error: Unable to convert multiple frame shapes to %s", csf->_name);
return;
}
diff --git a/engines/ultima/ultima8/games/cru_game.cpp b/engines/ultima/ultima8/games/cru_game.cpp
index 0649fd6d41a..dd88f49060c 100644
--- a/engines/ultima/ultima8/games/cru_game.cpp
+++ b/engines/ultima/ultima8/games/cru_game.cpp
@@ -58,7 +58,7 @@ CruGame::~CruGame() {
static bool loadPalette(const char *path, PaletteManager::PalIndex index) {
Common::SeekableReadStream *pf = FileSystem::get_instance()->ReadFile(path);
if (!pf) {
- perr << "Unable to load " << path << Std::endl;
+ warning("Unable to load %s", path);
return false;
}
@@ -187,8 +187,7 @@ void CruGame::playDemoScreen() {
static const Std::string bmp_filename = "static/buyme.dat";
Common::SeekableReadStream *bmprs = FileSystem::get_instance()->ReadFile(bmp_filename);
if (!bmprs) {
- perr << "RemorseGame::playDemoScreen: error opening demo background: "
- << bmp_filename << Std::endl;
+ warning("RemorseGame::playDemoScreen: error opening demo background: %s", bmp_filename.c_str());
return;
}
Gump *gump = new CruDemoGump(bmprs);
@@ -208,13 +207,11 @@ ProcId CruGame::playCreditsNoMenu() {
Common::SeekableReadStream *bmprs = FileSystem::get_instance()->ReadFile(bmp_filename);
if (!txtrs) {
- perr << "RemorseGame::playCredits: error opening credits text: "
- << txt_filename << Std::endl;
+ warning("RemorseGame::playCredits: error opening credits text: %s", txt_filename.c_str());
return 0;
}
if (!bmprs) {
- perr << "RemorseGame::playCredits: error opening credits background: "
- << bmp_filename << Std::endl;
+ warning("RemorseGame::playCredits: error opening credits background: %s", bmp_filename.c_str());
return 0;
}
Gump *creditsgump = new CruCreditsGump(txtrs, bmprs);
diff --git a/engines/ultima/ultima8/games/game_data.cpp b/engines/ultima/ultima8/games/game_data.cpp
index 3866bb90603..ac91aa7f7e8 100644
--- a/engines/ultima/ultima8/games/game_data.cpp
+++ b/engines/ultima/ultima8/games/game_data.cpp
@@ -165,7 +165,7 @@ void GameData::loadTranslation() {
translationfile = "u8japanese.ini";
break;
default:
- perr << "Unknown language." << Std::endl;
+ warning("Unknown language.");
break;
}
}
@@ -219,7 +219,7 @@ FrameID GameData::translate(FrameID f) {
t._flexId = f._flexId;
int n = sscanf(trans.c_str(), "%u,%u", &t._shapeNum, &t._frameNum);
if (n != 2) {
- perr << "Invalid shape translation: " << trans << Std::endl;
+ warning("Invalid shape translation: %s", trans.c_str());
return f;
}
@@ -385,7 +385,7 @@ void GameData::setupJPOverrides() {
Std::vector<Std::string> vals;
SplitString(fontdesc, ',', vals);
if (vals.size() != 2) {
- perr << "Invalid jpfont override: " << fontdesc << Std::endl;
+ warning("Invalid jpfont override: %s", fontdesc.c_str());
continue;
}
@@ -393,8 +393,7 @@ void GameData::setupJPOverrides() {
uint32 col32 = strtol(vals[1].c_str(), 0, 0);
if (!fontmanager->addJPOverride(fontnum, jpfontnum, col32)) {
- perr << "failed to setup jpfont override for font " << fontnum
- << Std::endl;
+ warning("failed to setup jpfont override for font %d", fontnum);
}
}
@@ -418,7 +417,7 @@ void GameData::setupTTFOverrides(const char *category, bool SJIS) {
Std::vector<Std::string> vals;
SplitString(fontdesc, ',', vals);
if (vals.size() != 4) {
- perr << "Invalid ttf override: " << fontdesc << Std::endl;
+ warning("Invalid ttf override: %s", fontdesc.c_str());
continue;
}
@@ -428,9 +427,8 @@ void GameData::setupTTFOverrides(const char *category, bool SJIS) {
int border = atoi(vals[3].c_str());
if (!fontmanager->addTTFOverride(fontnum, filename, pointsize,
- col32, border, SJIS)) {
- perr << "failed to setup ttf override for font " << fontnum
- << Std::endl;
+ col32, border, SJIS)) {
+ warning("failed to setup ttf override for font %d", fontnum);
}
}
}
@@ -453,7 +451,7 @@ SpeechFlex *GameData::getSpeechFlex(uint32 shapeNum) {
char langletter = _gameInfo->getLanguageFileLetter();
if (!langletter) {
- perr << "GameData::getSpeechFlex: Unknown language." << Std::endl;
+ warning("GameData::getSpeechFlex: Unknown language.");
delete s;
return nullptr;
}
diff --git a/engines/ultima/ultima8/games/start_u8_process.cpp b/engines/ultima/ultima8/games/start_u8_process.cpp
index a95b5099c2e..c369a179103 100644
--- a/engines/ultima/ultima8/games/start_u8_process.cpp
+++ b/engines/ultima/ultima8/games/start_u8_process.cpp
@@ -78,7 +78,7 @@ void StartU8Process::run() {
currentmap->areaSearch(&uclist, script, sizeof(script),
0, 256, false, 16188, 7500);
if (uclist.getSize() < 1) {
- perr << "Unable to find FIRST egg!" << Std::endl;
+ warning("Unable to find FIRST egg!");
return;
}
@@ -99,7 +99,7 @@ void StartU8Process::run() {
0, 256, false, 11551, 2079);
if (uclist.getSize() < 1) {
- perr << "Unable to find MUSIC egg!" << Std::endl;
+ warning("Unable to find MUSIC egg!");
} else {
ObjId objid = uclist.getuint16(0);
Item *musicEgg = getItem(objid);
diff --git a/engines/ultima/ultima8/games/u8_game.cpp b/engines/ultima/ultima8/games/u8_game.cpp
index 2fca9173867..da22f0b7de5 100644
--- a/engines/ultima/ultima8/games/u8_game.cpp
+++ b/engines/ultima/ultima8/games/u8_game.cpp
@@ -72,7 +72,7 @@ bool U8Game::loadFiles() {
pout << "Load Palette" << Std::endl;
Common::SeekableReadStream *pf = FileSystem::get_instance()->ReadFile("static/u8pal.pal");
if (!pf) {
- perr << "Unable to load static/u8pal.pal." << Std::endl;
+ warning("Unable to load static/u8pal.pal.");
return false;
}
pf->seek(4); // seek past header
@@ -103,26 +103,26 @@ bool U8Game::startGame() {
Common::SeekableReadStream *savers = FileSystem::get_instance()->ReadFile("savegame/u8save.000");
if (!savers) {
- perr << "Unable to load savegame/u8save.000." << Std::endl;
+ warning("Unable to load savegame/u8save.000.");
return false;
}
U8SaveFile *u8save = new U8SaveFile(savers);
Common::SeekableReadStream *nfd = u8save->getDataSource("NONFIXED.DAT");
if (!nfd) {
- perr << "Unable to load savegame/u8save.000/NONFIXED.DAT." << Std::endl;
+ warning("Unable to load savegame/u8save.000/NONFIXED.DAT.");
return false;
}
World::get_instance()->loadNonFixed(nfd); // deletes nfd
Common::SeekableReadStream *icd = u8save->getDataSource("ITEMCACH.DAT");
if (!icd) {
- perr << "Unable to load savegame/u8save.000/ITEMCACH.DAT." << Std::endl;
+ warning("Unable to load savegame/u8save.000/ITEMCACH.DAT.");
return false;
}
Common::SeekableReadStream *npcd = u8save->getDataSource("NPCDATA.DAT");
if (!npcd) {
- perr << "Unable to load savegame/u8save.000/NPCDATA.DAT." << Std::endl;
+ warning("Unable to load savegame/u8save.000/NPCDATA.DAT.");
delete icd;
return false;
}
@@ -158,7 +158,7 @@ ProcId U8Game::playIntroMovie(bool fade) {
const GameInfo *gameinfo = Ultima8Engine::get_instance()->getGameInfo();
char langletter = gameinfo->getLanguageFileLetter();
if (!langletter) {
- perr << "U8Game::playIntro: Unknown language." << Std::endl;
+ warning("U8Game::playIntro: Unknown language.");
return 0;
}
@@ -192,7 +192,7 @@ void U8Game::playCredits() {
const GameInfo *gameinfo = Ultima8Engine::get_instance()->getGameInfo();
char langletter = gameinfo->getLanguageFileLetter();
if (!langletter) {
- perr << "U8Game::playCredits: Unknown language." << Std::endl;
+ warning("U8Game::playCredits: Unknown language.");
return;
}
Std::string filename = "static/";
@@ -201,8 +201,7 @@ void U8Game::playCredits() {
Common::SeekableReadStream *rs = FileSystem::get_instance()->ReadFile(filename);
if (!rs) {
- perr << "U8Game::playCredits: error opening credits file: "
- << filename << Std::endl;
+ warning("U8Game::playCredits: error opening credits file: %s", filename.c_str());
return;
}
Std::string text = getCreditText(rs);
@@ -222,8 +221,7 @@ void U8Game::playQuotes() {
Common::SeekableReadStream *rs = FileSystem::get_instance()->ReadFile(filename);
if (!rs) {
- perr << "U8Game::playCredits: error opening credits file: "
- << filename << Std::endl;
+ warning("U8Game::playQuotes: error opening quotes file: %s", filename.c_str());
return;
}
const Std::string text = getCreditText(rs);
diff --git a/engines/ultima/ultima8/graphics/fonts/font_manager.cpp b/engines/ultima/ultima8/graphics/fonts/font_manager.cpp
index bd918b3d105..4248216296b 100644
--- a/engines/ultima/ultima8/graphics/fonts/font_manager.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/font_manager.cpp
@@ -100,7 +100,7 @@ Graphics::Font *FontManager::getTTF_Font(const Std::string &filename, int points
Common::SeekableReadStream *fontids;
fontids = FileSystem::get_instance()->ReadFile("data/" + filename);
if (!fontids) {
- perr << "Failed to open TTF: data/" << filename << Std::endl;
+ warning("Failed to open TTF: data/%s", filename.c_str());
return nullptr;
}
@@ -111,7 +111,7 @@ Graphics::Font *FontManager::getTTF_Font(const Std::string &filename, int points
Graphics::Font *font = Graphics::loadTTFFont(*fontids, pointsize, Graphics::kTTFSizeModeCharacter, 0, mode, 0, false);
if (!font) {
- perr << "Failed to open TTF: data/" << filename << Std::endl;
+ warning("Failed to open TTF: data/%s", filename.c_str());
return nullptr;
}
diff --git a/engines/ultima/ultima8/graphics/fonts/font_shape_archive.cpp b/engines/ultima/ultima8/graphics/fonts/font_shape_archive.cpp
index f8f998ce81a..65a10e3bdbb 100644
--- a/engines/ultima/ultima8/graphics/fonts/font_shape_archive.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/font_shape_archive.cpp
@@ -50,7 +50,7 @@ void FontShapeArchive::cache(uint32 shapenum) {
if (!_format) {
delete [] data;
- perr << "Error: Unable to detect shape format for flex." << Std::endl;
+ warning("Unable to detect shape format for flex.");
return;
}
@@ -73,8 +73,7 @@ void FontShapeArchive::setHVLeads() {
Std::vector<Std::string> vals;
SplitString(leaddesc, ',', vals);
if (vals.size() != 2) {
- perr << "Invalid hlead/vlead description: " << leaddesc
- << Std::endl;
+ warning("Invalid hlead/vlead description: %s", leaddesc.c_str());
continue;
}
diff --git a/engines/ultima/ultima8/graphics/palette_manager.cpp b/engines/ultima/ultima8/graphics/palette_manager.cpp
index 7104edb9a7f..58119ff7351 100644
--- a/engines/ultima/ultima8/graphics/palette_manager.cpp
+++ b/engines/ultima/ultima8/graphics/palette_manager.cpp
@@ -298,7 +298,7 @@ void PaletteManager::getTransformMatrix(int16 matrix[12], PalTransforms trans) {
// Unknown
default: {
- perr << "Unknown Palette Transformation: " << trans << Std::endl;
+ warning("Unknown Palette Transformation: %d", trans);
matrix[0] = 0x800;
matrix[1] = 0;
matrix[2] = 0;
diff --git a/engines/ultima/ultima8/graphics/shape.cpp b/engines/ultima/ultima8/graphics/shape.cpp
index a6b2f2f9091..1fa4f9dee82 100644
--- a/engines/ultima/ultima8/graphics/shape.cpp
+++ b/engines/ultima/ultima8/graphics/shape.cpp
@@ -65,7 +65,7 @@ void Shape::loadFrames(const uint8 *data, uint32 size, const ConvertShapeFormat
if (!format) {
// Should be fatal?
- perr << "Error: Unable to detect shape format" << Std::endl;
+ warning("Unable to detect shape format");
return;
}
diff --git a/engines/ultima/ultima8/graphics/shape_archive.cpp b/engines/ultima/ultima8/graphics/shape_archive.cpp
index ee958b04117..d2217665beb 100644
--- a/engines/ultima/ultima8/graphics/shape_archive.cpp
+++ b/engines/ultima/ultima8/graphics/shape_archive.cpp
@@ -59,7 +59,7 @@ void ShapeArchive::cache(uint32 shapenum) {
if (!_format) {
delete [] data;
- perr << "Error: Unable to detect shape format for flex." << Std::endl;
+ warning("Unable to detect shape format for flex.");
return;
}
diff --git a/engines/ultima/ultima8/graphics/shape_info.cpp b/engines/ultima/ultima8/graphics/shape_info.cpp
index 590e0967856..c5ff807b400 100644
--- a/engines/ultima/ultima8/graphics/shape_info.cpp
+++ b/engines/ultima/ultima8/graphics/shape_info.cpp
@@ -79,7 +79,7 @@ bool ShapeInfo::getTypeFlagCrusader(int typeFlag) const {
} else if (typeFlag <= 16) { // _family Byte 1:4-7,2:0 Bits 12-16
return (_family >> (typeFlag - 12)) & 1;
} else if (typeFlag <= 20) { // unknown Byte 2:0-3 Bits 17-20
- perr << "Warning: unknown typeFlag " << typeFlag << " requested." << Std::endl;
+ warning("unknown typeFlag %d requested.", typeFlag);
} else if (typeFlag <= 26) { // x Byte 2:4-7,3:0-1 Bits 21-26
return (_x >> (typeFlag - 21)) & 1;
} else if (typeFlag <= 31) { // y Byte 3:2-6 Bits 27-31
@@ -87,11 +87,11 @@ bool ShapeInfo::getTypeFlagCrusader(int typeFlag) const {
} else if (typeFlag <= 36) { // z Byte 3:7,4:0-3 Bits 32-36
return (_z >> (typeFlag - 32)) & 1;
} else if (typeFlag <= 47) {
- perr << "Warning: unknown typeFlag " << typeFlag << " requested." << Std::endl;
+ warning("unknown typeFlag %d requested.", typeFlag);
} else if (typeFlag <= 55) { // _flags Byte 6: 0-7 Bits 48-55
return (_flags >> (12 + typeFlag - 55)) & 1;
} else if (typeFlag <= 71) {
- perr << "Warning: unknown typeFlag " << typeFlag << " requested." << Std::endl;
+ warning("unknown typeFlag %d requested.", typeFlag);
}
return false;
diff --git a/engines/ultima/ultima8/graphics/skf_player.cpp b/engines/ultima/ultima8/graphics/skf_player.cpp
index 4d001289318..31a0dee7519 100644
--- a/engines/ultima/ultima8/graphics/skf_player.cpp
+++ b/engines/ultima/ultima8/graphics/skf_player.cpp
@@ -70,7 +70,7 @@ SKFPlayer::SKFPlayer(Common::SeekableReadStream *rs, int width, int height, bool
_skf = new RawArchive(rs);
Common::ReadStream *eventlist = _skf->get_datasource(0);
if (!eventlist) {
- perr << "No eventlist found in SKF" << Std::endl;
+ warning("No eventlist found in SKF");
return;
}
diff --git a/engines/ultima/ultima8/graphics/type_flags.cpp b/engines/ultima/ultima8/graphics/type_flags.cpp
index 85e4605a8b1..15cc152aecd 100644
--- a/engines/ultima/ultima8/graphics/type_flags.cpp
+++ b/engines/ultima/ultima8/graphics/type_flags.cpp
@@ -431,8 +431,7 @@ void TypeFlags::loadMonsterInfo() {
if (config->get(category, section, "treasure", treasure)) {
bool ok = treasureLoader.parse(treasure, mi->_treasure);
if (!ok) {
- perr << "failed to parse treasure info for monster '" << section
- << "'" << Std::endl;
+ warning("failed to parse treasure info for monster '%s;", section.c_str());
mi->_treasure.clear();
}
} else {
diff --git a/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp b/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp
index 320fba3fdf6..3e2bf81eee5 100644
--- a/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp
+++ b/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp
@@ -65,7 +65,7 @@ void WpnOvlayDat::load(RawArchive *overlaydat) {
// get Avatar's animation
const AnimAction *anim = msf->getAnim(1, action);
if (!anim) {
- perr << "Skipping wpnovlay action " << action << " because avatar animation doesn't exist." << Std::endl;
+ warning("Skipping wpnovlay action %u because avatar animation doesn't exist.", action);
continue;
}
diff --git a/engines/ultima/ultima8/gumps/container_gump.cpp b/engines/ultima/ultima8/gumps/container_gump.cpp
index e182df029db..ad275297fa0 100644
--- a/engines/ultima/ultima8/gumps/container_gump.cpp
+++ b/engines/ultima/ultima8/gumps/container_gump.cpp
@@ -457,9 +457,8 @@ void ContainerGump::DropItem(Item *item, int mx, int my) {
item->getFlags() & (Item::FLG_DISPOSABLE | Item::FLG_OWNED | Item::FLG_INVISIBLE | Item::FLG_FLIPPED | Item::FLG_FAST_ONLY | Item::FLG_LOW_FRICTION), item->getNpcNum(), item->getMapNum(),
item->getExtFlags() & (Item::EXT_SPRITE | Item::EXT_HIGHLIGHT | Item::EXT_TRANSPARENT), true);
if (!splittarget) {
- perr << "ContainerGump failed to create item ("
- << item->getShape() << "," << item->getFrame()
- << ") while splitting" << Std::endl;
+ warning("ContainerGump failed to create item (%u,%u) while splitting",
+ item->getShape(), item->getFrame());
return;
}
diff --git a/engines/ultima/ultima8/gumps/item_relative_gump.cpp b/engines/ultima/ultima8/gumps/item_relative_gump.cpp
index c3a2f3fafb6..13e1d3f8ad9 100644
--- a/engines/ultima/ultima8/gumps/item_relative_gump.cpp
+++ b/engines/ultima/ultima8/gumps/item_relative_gump.cpp
@@ -131,8 +131,7 @@ void ItemRelativeGump::GetItemLocation(int32 lerp_factor) {
gump = GetRootGump()->FindGump<GameMapGump>();
if (!gump) {
- perr << "ItemRelativeGump::GetItemLocation(): "
- << "Unable to find GameMapGump!?!?" << Std::endl;
+ warning("ItemRelativeGump::GetItemLocation(): Unable to find GameMapGump!");
return;
}
diff --git a/engines/ultima/ultima8/kernel/kernel.cpp b/engines/ultima/ultima8/kernel/kernel.cpp
index 6896dceec69..3e08c5d80f2 100644
--- a/engines/ultima/ultima8/kernel/kernel.cpp
+++ b/engines/ultima/ultima8/kernel/kernel.cpp
@@ -103,7 +103,7 @@ ProcId Kernel::addProcess(Process *proc, bool dispose) {
assert(proc->_pid != 0 && proc->_pid != 0xFFFF);
#if 0
- perr << "[Kernel] Adding process " << proc
+ pout << "[Kernel] Adding process " << proc
<< ", pid = " << proc->_pid << " type " << proc->GetClassType()._className << Std::endl;
#endif
@@ -125,7 +125,7 @@ ProcId Kernel::addProcessExec(Process *proc, bool dispose) {
assert(proc->_pid != 0 && proc->_pid != 0xFFFF);
#if 0
- perr << "[Kernel] Adding process " << proc
+ pout << "[Kernel] Adding process " << proc
<< ", pid = " << proc->_pid << Std::endl;
#endif
@@ -459,7 +459,7 @@ Process *Kernel::loadProcess(Common::ReadStream *rs, uint32 version) {
iter = _processLoaders.find(classname);
if (iter == _processLoaders.end()) {
- perr << "Unknown Process class: " << classname << Std::endl;
+ warning("Unknown Process class: %s", classname.c_str());
return nullptr;
}
diff --git a/engines/ultima/ultima8/kernel/mouse.cpp b/engines/ultima/ultima8/kernel/mouse.cpp
index fac228e1cbe..7d6e96f4d44 100644
--- a/engines/ultima/ultima8/kernel/mouse.cpp
+++ b/engines/ultima/ultima8/kernel/mouse.cpp
@@ -410,7 +410,7 @@ void Mouse::startDragging(int startx, int starty) {
#if 0
Object *obj = ObjectManager::get_instance()->getObject(_dragging_objId);
- perr << "Dragging object " << _dragging_objId << " (class=" << (obj ? obj->GetClassType().class_name : "NULL") << ")" << Std::endl;
+ pout << "Dragging object " << _dragging_objId << " (class=" << (obj ? obj->GetClassType().class_name : "NULL") << ")" << Std::endl;
#endif
pushMouseCursor(MOUSE_NORMAL);
@@ -471,7 +471,7 @@ void Mouse::moveDragging(int mx, int my) {
void Mouse::stopDragging(int mx, int my) {
- // perr << "Dropping object " << _dragging_objId << Std::endl;
+ //pout << "Dropping object " << _dragging_objId << Std::endl;
Gump *gump = getGump(_dragging_objId);
Item *item = getItem(_dragging_objId);
diff --git a/engines/ultima/ultima8/kernel/object_manager.cpp b/engines/ultima/ultima8/kernel/object_manager.cpp
index 1766dfc40f0..dc5a4a52757 100644
--- a/engines/ultima/ultima8/kernel/object_manager.cpp
+++ b/engines/ultima/ultima8/kernel/object_manager.cpp
@@ -266,8 +266,7 @@ bool ObjectManager::load(Common::ReadStream *rs, uint32 version) {
// We also fail loading when we're out of _objIDs since this could
// have caused serious issues when critical _objects haven't been created.
if (_objIDs->isFull()) {
- perr << "Savegame has been corrupted by running out of _objIDs."
- << Std::endl;
+ warning("Savegame has been corrupted by running out of _objIDs.");
return false;
}
unsigned int count = 0;
@@ -336,14 +335,14 @@ Object *ObjectManager::loadObject(Common::ReadStream *rs, Std::string classname,
iter = _objectLoaders.find(classname);
if (iter == _objectLoaders.end()) {
- perr << "Unknown Object class: " << classname << Std::endl;
+ warning("Unknown Object class: %s", classname.c_str());
return nullptr;
}
Object *obj = (*(iter->_value))(rs, version);
if (!obj) {
- perr << "Error loading object of type " << classname << Std::endl;
+ warning("Error loading object of type %s", classname.c_str());
return nullptr;
}
uint16 objid = obj->getObjId();
@@ -356,8 +355,7 @@ Object *ObjectManager::loadObject(Common::ReadStream *rs, Std::string classname,
else
used = _actorIDs->isIDUsed(objid);
if (!used) {
- perr << "Error: object ID " << objid
- << " used but marked available. " << Std::endl;
+ warning("Error: object ID %u used but marked available.", objid);
return nullptr;
}
}
diff --git a/engines/ultima/ultima8/misc/debugger.cpp b/engines/ultima/ultima8/misc/debugger.cpp
index 394c8f04790..fdd6098fdc7 100644
--- a/engines/ultima/ultima8/misc/debugger.cpp
+++ b/engines/ultima/ultima8/misc/debugger.cpp
@@ -63,16 +63,13 @@ namespace Ultima8 {
Debugger *g_debugger;
-// Console out/err pointers
console_ostream<char> *ppout;
-console_err_ostream<char> *pperr;
Debugger::Debugger() : Shared::Debugger() {
g_debugger = this;
// Set output pointers
ppout = &_strOut;
- pperr = &_errOut;
// WARNING: Not only can the methods below be executed directly in the debugger,
// they also act as the methods keybindings are made to. So be wary of changing names
@@ -221,7 +218,6 @@ Debugger::Debugger() : Shared::Debugger() {
Debugger::~Debugger() {
g_debugger = nullptr;
ppout = nullptr;
- pperr = nullptr;
}
diff --git a/engines/ultima/ultima8/misc/debugger.h b/engines/ultima/ultima8/misc/debugger.h
index 9ad588c8ff4..cca6b5fd64b 100644
--- a/engines/ultima/ultima8/misc/debugger.h
+++ b/engines/ultima/ultima8/misc/debugger.h
@@ -91,34 +91,10 @@ class console_ostream : public ConsoleStream {
}
};
-template<class T>
-class console_err_ostream : public ConsoleStream {
-private:
- Common::String _line;
-public:
- uint32 write(const void *dataPtr, uint32 dataSize) override {
- _line += Common::String((const char *)dataPtr, dataSize);
-
- size_t lineEnd;
- while ((lineEnd = _line.find('\n')) != Common::String::npos) {
- if (lineEnd > 0)
- warning("%s", Common::String(_line.c_str(), lineEnd).c_str());
-
- _line = Common::String(_line.c_str() + lineEnd + 1);
- }
-
- return dataSize;
- }
-};
-
// Standard Output Stream Object
extern console_ostream<char> *ppout;
-// Error Output Stream Object
-extern console_err_ostream<char> *pperr;
#define pout (*ppout)
-#define perr (*pperr)
-
/**
* Debugger base class
@@ -127,8 +103,6 @@ class Debugger : public Shared::Debugger {
private:
// Standard Output Stream Object
console_ostream<char> _strOut;
- // Error Output Stream Object
- console_err_ostream<char> _errOut;
private:
const char *strBool(bool flag) {
return flag ? "true" : "false";
diff --git a/engines/ultima/ultima8/misc/id_man.cpp b/engines/ultima/ultima8/misc/id_man.cpp
index d3803a8e739..44379a20553 100644
--- a/engines/ultima/ultima8/misc/id_man.cpp
+++ b/engines/ultima/ultima8/misc/id_man.cpp
@@ -102,7 +102,7 @@ void idMan::expand() {
_ids.resize(_end + 1);
#if 0
- perr << "Expanding idMan from (" << _begin << "-" << old_end << ") to ("
+ pout << "Expanding idMan from (" << _begin << "-" << old_end << ") to ("
<< _begin << "-" << _end << ")" << Std::endl;
#endif
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 087ac565ed2..5b39443b55a 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -552,9 +552,9 @@ Common::Error Ultima8Engine::runGame() {
_desktopGump->run();
}
#if 0
- perr << "--------------------------------------" << Std::endl;
- perr << "NEW FRAME" << Std::endl;
- perr << "--------------------------------------" << Std::endl;
+ pout << "--------------------------------------" << Std::endl;
+ pout << "NEW FRAME" << Std::endl;
+ pout << "--------------------------------------" << Std::endl;
#endif
_inBetweenFrame = false;
@@ -680,7 +680,7 @@ void Ultima8Engine::GraphicSysInit() {
RenderSurface *new_screen = RenderSurface::SetVideoMode(width, height, bpp);
if (!new_screen) {
- perr << Common::String::format("Unable to set new video mode. Trying %dx%dx32", U8_DEFAULT_SCREEN_WIDTH, U8_DEFAULT_SCREEN_HEIGHT) << Std::endl;
+ warning("Unable to set new video mode. Trying %dx%dx32", U8_DEFAULT_SCREEN_WIDTH, U8_DEFAULT_SCREEN_HEIGHT);
new_screen = RenderSurface::SetVideoMode(U8_DEFAULT_SCREEN_WIDTH, U8_DEFAULT_SCREEN_HEIGHT, 32);
}
@@ -1269,7 +1269,7 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
if (!ignore) {
error("%s", message.c_str());
}
- perr << message << Std::endl;
+ pout << message << Std::endl;
#else
delete sg;
return Common::Error(Common::kReadingFailed, message);
diff --git a/engines/ultima/ultima8/usecode/uc_machine.cpp b/engines/ultima/ultima8/usecode/uc_machine.cpp
index b8f8be51f4a..e52b238aee1 100644
--- a/engines/ultima/ultima8/usecode/uc_machine.cpp
+++ b/engines/ultima/ultima8/usecode/uc_machine.cpp
@@ -261,8 +261,7 @@ void UCMachine::execProcess(UCProcess *p) {
ui16b = p->_stack.access2(p->_bp + si8a);
UCList *l = getList(ui16b);
if (!l) {
- perr << "assign element to an invalid list (" << ui16b << ")"
- << Std::endl;
+ warning("assign element to an invalid list (%u)", ui16b);
error = true;
break;
}
@@ -270,8 +269,7 @@ void UCMachine::execProcess(UCProcess *p) {
// what special behaviour do we need here?
// probably just that the overwritten element has to be freed?
if (ui32a != 2) {
- perr << "Unhandled operand " << ui32a << " to pop slist"
- << Std::endl;
+ warning("Unhandled operand %u to pop slist", ui32a);
error = true; // um?
}
l->assign(ui16a, p->_stack.access());
@@ -329,8 +327,7 @@ void UCMachine::execProcess(UCProcess *p) {
LOGPF(("push string\t\"%s\"\n", str));
ui16b = cs->readByte();
if (ui16b != 0) {
- perr << "Zero terminator missing in push string"
- << Std::endl;
+ warning("Zero terminator missing in push string");
error = true;
}
p->_stack.push2(assignString(str));
@@ -383,15 +380,16 @@ void UCMachine::execProcess(UCProcess *p) {
testItem = getItem(testItemId);
delete [] argmem;
}
- perr << "Unhandled intrinsic << " << func << " \'" << _convUse->intrinsics()[func] << "\'? (";
+
+ Common::String info;
if (testItem) {
- perr << "item " << testItem->getObjId();
+ info = Common::String::format("item %u", testItem->getObjId());
if (arg_bytes > 4)
- perr << " + " << arg_bytes - 4 << " bytes";
+ info += Common::String::format(" + %u bytes", arg_bytes - 4);
} else {
- perr << arg_bytes << " bytes";
+ info = Common::String::format("%u bytes", arg_bytes);
}
- perr << ") called" << Std::endl;
+ warning("Unhandled intrinsic %u \'%s\'? (%s) called", func, _convUse->intrinsics()[func], info.c_str());
if (testItem) {
testItem->dumpInfo();
}
@@ -399,7 +397,7 @@ void UCMachine::execProcess(UCProcess *p) {
//!! hackish
if (_intrinsics[func] == UCMachine::I_dummyProcess ||
_intrinsics[func] == UCMachine::I_true) {
-// perr << "Unhandled intrinsic \'" << _convUse->_intrinsics()[func] << "\' (" << ConsoleStream::hex << func << ConsoleStream::dec << ") called" << Std::endl;
+ warning("Unhandled intrinsic %u \'%s\'? called", func, _convUse->intrinsics()[func]);
}
uint8 *argbuf = new uint8[arg_bytes];
p->_stack.pop(argbuf, arg_bytes);
@@ -494,7 +492,7 @@ void UCMachine::execProcess(UCProcess *p) {
ui16a = p->_stack.pop2();
ui16b = p->_stack.pop2();
if (ui16b == 0) {
- perr << "Trying to append to string 0." << Std::endl;
+ warning("Trying to append to string 0.");
error = true;
break;
}
@@ -515,9 +513,8 @@ void UCMachine::execProcess(UCProcess *p) {
if (listB && listA) {
if (listA->getElementSize() != listB->getElementSize()) {
- perr << "Trying to append lists with different element "
- << "sizes (" << listB->getElementSize() << " != "
- << listA->getElementSize() << ")" << Std::endl;
+ warning("Trying to append lists with different element sizes (%u != %u)",
+ listB->getElementSize(), listA->getElementSize());
error = true;
} else {
listB->appendList(*listA);
@@ -549,8 +546,7 @@ void UCMachine::execProcess(UCProcess *p) {
// add two stringlists, removing duplicates
ui32a = cs->readByte();
if (ui32a != 2) {
- perr << "Unhandled operand " << ui32a << " to union slist"
- << Std::endl;
+ warning("Unhandled operand %u to union slist", ui32a);
error = true;
}
ui16a = p->_stack.pop2();
@@ -558,7 +554,7 @@ void UCMachine::execProcess(UCProcess *p) {
UCList *srclist = getList(ui16a);
UCList *dstlist = getList(ui16b);
if (!srclist || !dstlist) {
- perr << "Invalid list param to union slist" << Std::endl;
+ warning("Invalid list param to union slist");
error = true;
} else {
dstlist->unionStringList(*srclist);
@@ -578,7 +574,7 @@ void UCMachine::execProcess(UCProcess *p) {
UCList *srclist = getList(ui16a);
UCList *dstlist = getList(ui16b);
if (!srclist || !dstlist) {
- perr << "Invalid list param to subtract slist" << Std::endl;
+ warning("Invalid list param to subtract slist");
error = true;
} else {
dstlist->subtractStringList(*srclist);
@@ -599,7 +595,7 @@ void UCMachine::execProcess(UCProcess *p) {
UCList *srclist = getList(ui16a);
UCList *dstlist = getList(ui16b);
if (!srclist || !dstlist) {
- perr << "Invalid list param to remove from slist" << Std::endl;
+ warning("Invalid list param to remove from slist");
error = true;
} else {
dstlist->subtractList(*srclist);
@@ -653,7 +649,7 @@ void UCMachine::execProcess(UCProcess *p) {
if (si16a != 0) {
p->_stack.push2(static_cast<uint16>(si16b / si16a));
} else {
- perr.Print("0x20 division by zero.\n");
+ warning("0x20 division by zero.");
p->_stack.push2(0);
}
LOGPF(("div\n"));
@@ -667,7 +663,7 @@ void UCMachine::execProcess(UCProcess *p) {
if (si32a != 0) {
p->_stack.push4(static_cast<uint32>(si32b / si32a));
} else {
- perr.Print("0x21 division by zero.\n");
+ warning("0x21 division by zero.");
p->_stack.push4(0);
}
LOGPF(("div\n"));
@@ -682,7 +678,7 @@ void UCMachine::execProcess(UCProcess *p) {
if (si16a != 0) {
p->_stack.push2(static_cast<uint16>(si16b % si16a));
} else {
- perr.Print("0x22 division by zero.\n");
+ warning("0x22 division by zero.");
p->_stack.push2(0);
}
LOGPF(("mod\n"));
@@ -696,7 +692,7 @@ void UCMachine::execProcess(UCProcess *p) {
if (si32a != 0) {
p->_stack.push4(static_cast<uint32>(si32b % si32a));
} else {
- perr.Print("0x23 division by zero.\n");
+ warning("0x23 division by zero.");
p->_stack.push4(0);
}
LOGPF(("mod long\n"));
@@ -961,12 +957,11 @@ void UCMachine::execProcess(UCProcess *p) {
ui16b = p->_stack.pop2();
UCList *l = getList(ui16b);
if (!l) {
- perr << "Invalid list id " << ui16b << Std::endl;
+ warning("Invalid list id %u", ui16b);
error = true;
} else if (ui32a) { // stringlist
if (ui16a != 2) {
- perr << "Unhandled operand " << ui16a << " to in slist"
- << Std::endl;
+ warning("Unhandled operand %u to in slist", ui16a);
error = true;
}
if (l->stringInList(p->_stack.pop2()))
@@ -1093,7 +1088,7 @@ void UCMachine::execProcess(UCProcess *p) {
} else {
// trying to push non-existent list. Error or not?
// Not: for example, function 01E3::0080, offset 0112
- // perr << "Pushing non-existent list" << Std::endl;
+ // warning("Pushing non-existent list");
// error = true;
}
uint16 newlistid = assignList(l);
@@ -1115,7 +1110,7 @@ void UCMachine::execProcess(UCProcess *p) {
} else {
// trying to push non-existent list. Error or not?
// (Devon's talk code seems to use it; so no error for now)
- // perr << "Pushing non-existent slist" << Std::endl;
+ // warning("Pushing non-existent slist");
// error = true;
}
p->_stack.push2(assignList(l));
@@ -1138,8 +1133,7 @@ void UCMachine::execProcess(UCProcess *p) {
ui16b = p->_stack.pop2(); // list
UCList *l = getList(ui16b);
if (!l) {
-// perr << "push element from invalid list (" << ui16b << ")"
-// << Std::endl;
+// warning("push element from invalid list (%u)", ui16b);
// This is necessary for closing the backpack to work
p->_stack.push0(ui32a);
// error = true;
@@ -1242,8 +1236,7 @@ void UCMachine::execProcess(UCProcess *p) {
_globals->setEntries(ui16a, ui16b, ui32a);
if ((GAME_IS_U8 && (ui32a & ~(((1 << ui16b) - 1)))) || (GAME_IS_CRUSADER && (ui16b > 2))) {
- perr << "Warning: value popped into a flag it doesn't fit in (" << ConsoleStream::hex
- << ui16a << " " << ui16b << " " << ui32a << ")" << Std::endl;
+ warning("Value popped into a flag it doesn't fit in (%04X %04X %04X)", ui16a, ui16b, ui32a);
}
// paranoid :-)
@@ -1351,15 +1344,13 @@ void UCMachine::execProcess(UCProcess *p) {
// until we hit a suspend or return.
go_until_cede = true;
} else {
- perr << "Non-existent process PID (";
if (!proc && !proc2) {
- perr << ui16a << "," << ui16b;
+ warning("Non-existent process PID (%u, %u) in implies.", ui16a, ui16b);
} else if (!proc) {
- perr << ui16b;
+ warning("Non-existent process PID (%u) in implies.", ui16b);
} else {
- perr << ui16a;
+ warning("Non-existent process PID (%u) in implies.", ui16a);
}
- perr << ") in implies." << Std::endl;
// This condition triggers in 057C:1090 when talking
// to a child (class 02C4), directly after the conversation
// Specifically, it occurs because there is no
@@ -1635,8 +1626,7 @@ void UCMachine::execProcess(UCProcess *p) {
UCList *l = new UCList(2);
const UCList *srclist = getList(ui16a);
if (!srclist) {
- perr << "Warning: invalid src list passed to slist copy"
- << Std::endl;
+ warning("Invalid src list passed to slist copy");
ui16b = 0;
delete l;
break;
@@ -1648,8 +1638,7 @@ void UCMachine::execProcess(UCProcess *p) {
case 3: { // list
const UCList *l = getList(ui16a);
if (!l) {
- perr << "Warning: invalid src list passed to list copy"
- << Std::endl;
+ warning("Invalid src list passed to list copy");
ui16b = 0;
break;
}
@@ -1661,8 +1650,7 @@ void UCMachine::execProcess(UCProcess *p) {
break;
default:
ui16b = 0;
- perr << "Error: invalid param _pid change type (" << ui8a
- << ")" << Std::endl;
+ warning("Error: invalid param _pid change type (%u)", ui8a);
error = true;
}
p->_stack.assign2(p->_bp + si8a, ui16b); // assign new index
@@ -1729,7 +1717,7 @@ void UCMachine::execProcess(UCProcess *p) {
// loopscript of 0x20 bytes)
if (scriptsize > 0x20) {
- perr << "Loopscript too long" << Std::endl;
+ warning("Loopscript too long");
error = true;
break;
}
@@ -1764,8 +1752,7 @@ void UCMachine::execProcess(UCProcess *p) {
range, recurse, ix, iy);
} else {
// return error or return empty list?
- perr << "Warning: invalid item " << ui16a << " passed to area search"
- << Std::endl;
+ warning("Invalid item %u passed to area search", ui16a);
}
break;
}
@@ -1782,8 +1769,7 @@ void UCMachine::execProcess(UCProcess *p) {
Container *container = getContainer(ui16b);
if (ui16a != 0xFFFF) {
- perr << "Warning: non-FFFF value passed to "
- << "container search" << Std::endl;
+ warning("non-FFFF value passed to container search");
}
if (container) {
@@ -1791,8 +1777,7 @@ void UCMachine::execProcess(UCProcess *p) {
scriptsize, recurse);
} else {
// return error or return empty list?
- perr << "Warning: invalid container "<< ui16b << " passed to "
- << "container search" << Std::endl;
+ warning("Invalid container %u passed to container search", ui16b);
}
break;
}
@@ -1810,13 +1795,12 @@ void UCMachine::execProcess(UCProcess *p) {
above, below);
} else {
// return error or return empty list?
- perr << "Warning: invalid item passed to surface search"
- << Std::endl;
+ warning("Warning: invalid item passed to surface search");
}
break;
}
default:
- perr << "Unhandled search type " << searchtype << Std::endl;
+ warning("Unhandled search type %u", searchtype);
error = true;
delete[] script;
script = nullptr;
@@ -1853,7 +1837,7 @@ void UCMachine::execProcess(UCProcess *p) {
si16a = static_cast<int16>(p->_stack.access2(sp + 4));
if (!itemlist) {
- perr << "Invalid item list in loopnext!" << Std::endl;
+ warning("Invalid item list in loopnext!");
error = true;
break;
}
@@ -2013,14 +1997,14 @@ void UCMachine::execProcess(UCProcess *p) {
// end of function
// shouldn't happen
LOGPF(("end\n"));
- perr.Print("end of function opcode %02X reached!\n", opcode);
+ warning("end of function opcode %02X reached!", opcode);
error = true;
break;
// 0x7B REGRESS (Unused)
default:
- perr.Print("unhandled opcode %02X\n", opcode);
+ warning("unhandled opcode %02X", opcode);
} // switch(opcode)
@@ -2036,8 +2020,8 @@ void UCMachine::execProcess(UCProcess *p) {
delete cs;
if (error) {
- perr.Print("Process %d caused an error at %04X:%04X (item %d). Killing process.\n",
- p->_pid, p->_classId, p->_ip, p->_itemNum);
+ warning("Process %d caused an error at %04X:%04X (item %d). Killing process.",
+ p->_pid, p->_classId, p->_ip, p->_itemNum);
p->terminateDeferred();
}
}
@@ -2180,8 +2164,7 @@ bool UCMachine::assignPointer(uint32 ptr, const uint8 *data, uint32 size) {
// reference to the stack of _pid 'segment'
if (!proc) {
// segfault :-)
- perr << "Trying to access stack of non-existent "
- << "process (pid: " << segment << ")" << Std::endl;
+ warning("Trying to access stack of non-existent process (pid: %u)", segment);
return false;
} else {
proc->_stack.assign(offset, data, size);
@@ -2199,8 +2182,7 @@ bool UCMachine::assignPointer(uint32 ptr, const uint8 *data, uint32 size) {
CANT_HAPPEN_MSG("Global pointers must be size 1 or 2");
}
} else {
- perr << "Trying to access segment " << ConsoleStream::hex
- << segment << ConsoleStream::dec << Std::endl;
+ warning("Trying to access segment %04X", segment);
return false;
}
@@ -2227,16 +2209,14 @@ bool UCMachine::dereferencePointer(uint32 ptr, uint8 *data, uint32 size) {
// reference to the stack of _pid 'segment'
if (!proc) {
// segfault :-)
- perr << "Trying to access stack of non-existent "
- << "process (pid: " << segment << ")" << Std::endl;
+ warning("Trying to access stack of non-existent process (pid: %u)", segment);
return false;
} else {
memcpy(data, proc->_stack.access(offset), size);
}
} else if (segment == SEG_OBJ) {
if (size != 2) {
- perr << "Trying to read other than 2 bytes from objptr"
- << Std::endl;
+ warning("Trying to read other than 2 bytes from objptr");
return false;
} else {
// push objref
@@ -2257,8 +2237,7 @@ bool UCMachine::dereferencePointer(uint32 ptr, uint8 *data, uint32 size) {
CANT_HAPPEN_MSG("Global pointers must be size 1 or 2");
}
} else {
- perr << "Trying to access segment " << ConsoleStream::hex
- << segment << ConsoleStream::dec << Std::endl;
+ warning("Trying to access segment %04X", segment);
return false;
}
return true;
@@ -2277,13 +2256,11 @@ uint16 UCMachine::ptrToObject(uint32 ptr) {
// reference to the stack of _pid 'segment'
if (!proc) {
// segfault :-)
- perr << "Trying to access stack of non-existent "
- << "process (pid: " << segment << ")" << Std::endl;
+ warning("Trying to access stack of non-existent process (pid: %u)", segment);
return 0;
} else if (proc->_stack.getSize() < (uint32)offset + 2) {
- perr << "Trying to access past end of stack offset " << offset
- << " (size: " << proc->_stack.getSize()
- << ") process (pid: " << segment << ")" << Std::endl;
+ warning("Trying to access past end of stack offset %u (size: %u) process (pid: %u)",
+ offset, proc->_stack.getSize(), segment);
return 0;
} else {
return proc->_stack.access2(offset);
@@ -2293,8 +2270,7 @@ uint16 UCMachine::ptrToObject(uint32 ptr) {
} else if (segment == SEG_GLOBAL) {
return get_instance()->_globals->getEntries(offset, 2);
} else {
- perr << "Trying to access segment " << ConsoleStream::hex
- << segment << ConsoleStream::dec << Std::endl;
+ warning("Trying to access segment %04X", segment);
return 0;
}
}
diff --git a/engines/ultima/ultima8/usecode/uc_process.cpp b/engines/ultima/ultima8/usecode/uc_process.cpp
index fb74bd0b2e6..e5c8d2bd084 100644
--- a/engines/ultima/ultima8/usecode/uc_process.cpp
+++ b/engines/ultima/ultima8/usecode/uc_process.cpp
@@ -48,7 +48,7 @@ UCProcess::~UCProcess() {
void UCProcess::load(uint16 classid, uint16 offset, uint32 this_ptr,
int thissize, const uint8 *args, int argsize) {
if (_usecode->get_class_size(classid) == 0)
- perr << "Class is empty..." << Std::endl;
+ warning("Class is empty.");
_classId = 0xFFFF;
_ip = 0xFFFF;
diff --git a/engines/ultima/ultima8/usecode/uc_stack.cpp b/engines/ultima/ultima8/usecode/uc_stack.cpp
index 6adc6a77b47..7cfd954f75a 100644
--- a/engines/ultima/ultima8/usecode/uc_stack.cpp
+++ b/engines/ultima/ultima8/usecode/uc_stack.cpp
@@ -39,7 +39,7 @@ bool UCStack::load(Common::ReadStream *rs, uint32 version) {
_buf = new uint8[_size];
#else
if (_size > sizeof(_bufArray)) {
- perr << "Error: UCStack _size mismatch (buf_array too small)" << Std::endl;
+ warning("UCStack _size mismatch (buf_array too small)");
return false;
}
_buf = _bufArray;
diff --git a/engines/ultima/ultima8/usecode/usecode.cpp b/engines/ultima/ultima8/usecode/usecode.cpp
index dd866dcf415..96fbab0d826 100644
--- a/engines/ultima/ultima8/usecode/usecode.cpp
+++ b/engines/ultima/ultima8/usecode/usecode.cpp
@@ -31,7 +31,8 @@ uint32 Usecode::get_class_event(uint32 classid, uint32 eventid) {
if (get_class_size(classid) == 0) return 0;
if (eventid >= get_class_event_count(classid)) {
- perr << "eventid too high: " << eventid << " >= " << get_class_event_count(classid) << " for class " << classid << Std::endl;
+ warning("eventid too high: %u >= %u for class %u",
+ eventid, get_class_event_count(classid), classid);
CANT_HAPPEN();
}
diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index 46706d2698c..3db5f80fee0 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -324,8 +324,7 @@ bool Actor::giveTreasure() {
uint32 shapeNum = ti._shapes[0];
const ShapeInfo *si = mainshapes->getShapeInfo(shapeNum);
if (!si) {
- perr << "Trying to create treasure with an invalid shapeNum ("
- << shapeNum << ")" << Std::endl;
+ warning("Trying to create treasure with an invalid shapeNum (%u)", shapeNum);
continue;
}
if (si->hasQuantity()) {
@@ -345,7 +344,7 @@ bool Actor::giveTreasure() {
}
if (ti._shapes.empty() || ti._frames.empty()) {
- perr << "No shape/frame set in treasure" << Std::endl;
+ warning("No shape/frame set in treasure");
continue;
}
@@ -362,8 +361,7 @@ bool Actor::giveTreasure() {
const ShapeInfo *si = GameData::get_instance()->getMainShapes()->
getShapeInfo(shapeNum);
if (!si) {
- perr << "Trying to create treasure with an invalid shapeNum ("
- << shapeNum << ")" << Std::endl;
+ warning("Trying to create treasure with an invalid shapeNum (%u)", shapeNum);
continue;
}
uint16 qual = 0;
@@ -448,7 +446,7 @@ void Actor::teleport(int newmap, int32 newx, int32 newy, int32 newz) {
// Move it to this map
if (newmapnum == World::get_instance()->getCurrentMap()->getNum()) {
#ifdef DEBUG
- perr << "Actor::teleport: " << getObjId() << " to " << newmap << ","
+ pout << "Actor::teleport: " << getObjId() << " to " << newmap << ","
<< newx << "," << newy << "," << newz << Std::endl;
#endif
move(newx, newy, newz);
@@ -464,7 +462,7 @@ void Actor::teleport(int newmap, int32 newx, int32 newy, int32 newz) {
uint16 Actor::doAnim(Animation::Sequence anim, Direction dir, unsigned int steps) {
if (dir < 0 || dir > 16) {
- perr << "Actor::doAnim: Invalid _direction (" << dir << ")" << Std::endl;
+ warning("Actor::doAnim: Invalid _direction (%d)", dir);
return 0;
}
@@ -472,10 +470,8 @@ uint16 Actor::doAnim(Animation::Sequence anim, Direction dir, unsigned int steps
dir = getDir();
#if 0
- if (tryAnim(anim, dir)) {
- perr << "Actor::doAnim: tryAnim = Ok!" << Std::endl;
- } else {
- perr << "Actor::doAnim: tryAnim = bad!" << Std::endl;
+ if (!tryAnim(anim, dir)) {
+ warning("Actor::doAnim: tryAnim = bad!");
}
#endif
@@ -755,8 +751,7 @@ uint16 Actor::setActivityU8(int activity) {
return doAnim(Animation::stand, dir_current);
default:
- perr << "Actor::setActivityU8: invalid activity (" << activity << ")"
- << Std::endl;
+ warning("Actor::setActivityU8: invalid activity (%d)", activity);
}
return 0;
@@ -838,8 +833,7 @@ uint16 Actor::setActivityCru(int activity) {
case 0x72:
return setActivity(getDefaultActivity(2));
default:
- perr << "Actor::setActivityCru: invalid activity (" << activity << ")"
- << Std::endl;
+ warning("Actor::setActivityCru: invalid activity (%d)", activity);
return doAnim(Animation::stand, dir_current);
}
@@ -1979,8 +1973,7 @@ Actor *Actor::createActor(uint32 shape, uint32 frame) {
// set stats
if (!newactor->loadMonsterStats()) {
- perr << "I_createActor failed to set stats for actor (" << shape
- << ")." << Std::endl;
+ warning("I_createActor failed to set stats for actor (%u).", shape);
}
const Actor *av = getMainActor();
@@ -2579,8 +2572,7 @@ uint32 Actor::I_createActor(const uint8 *args, unsigned int /*argsize*/) {
Actor *newactor = createActor(shape, frame);
if (!newactor) {
- perr << "I_createActor failed to create actor (" << shape
- << ")." << Std::endl;
+ warning("I_createActor failed to create actor (%u).", shape);
return 0;
}
uint16 objID = newactor->getObjId();
@@ -2591,7 +2583,7 @@ uint32 Actor::I_createActor(const uint8 *args, unsigned int /*argsize*/) {
UCMachine::get_instance()->assignPointer(ptr, buf, 2);
#if 0
- perr << "I_createActor: created actor #" << objID << " shape "
+ pout << "I_createActor: created actor #" << objID << " shape "
<< shape << " frame " << frame << Std::endl;
#endif
@@ -2629,16 +2621,14 @@ uint32 Actor::I_createActorCru(const uint8 *args, unsigned int /*argsize*/) {
Item::FLG_IN_NPC_LIST | Item::FLG_DISPOSABLE,
0, 0, ext, true);
if (!newactor) {
- perr << "I_createActorCru failed to create actor ("
- << npcData->getShapeNo() << ")." << Std::endl;
+ warning("I_createActorCru failed to create actor (%u).", npcData->getShapeNo());
return 0;
}
// Most of these will be overwritten below, but this is cleaner..
bool loaded = newactor->loadMonsterStats();
if (!loaded) {
- perr << "I_createActorCru failed to load monster stats ("
- << npcData->getShapeNo() << ")." << Std::endl;
+ warning("I_createActorCru failed to load monster stats (%u).", npcData->getShapeNo());
return 0;
}
diff --git a/engines/ultima/ultima8/world/actors/actor_anim_process.cpp b/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
index 3b6b0ebf9d6..7090c194a8a 100644
--- a/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
+++ b/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
@@ -108,9 +108,8 @@ bool ActorAnimProcess::init() {
//! don't do this animation or kill the previous one?
//! Or maybe wait until the previous one finishes?
- perr << "ActorAnimProcess [" << getPid() << "]: ANIMLOCK set on actor "
- << _itemNum << ", skipping anim (" << _action << "," << _dir << ")"
- << Std::endl;
+ warning("ActorAnimProcess [%u]: ANIMLOCK set on actor %u, skipping anim (%d, %d)",
+ getPid(), _itemNum, _action, _dir);
// for now, just don't play this one.
return false;
diff --git a/engines/ultima/ultima8/world/actors/avatar_death_process.cpp b/engines/ultima/ultima8/world/actors/avatar_death_process.cpp
index db05ea0c4b2..47ad2e0110b 100644
--- a/engines/ultima/ultima8/world/actors/avatar_death_process.cpp
+++ b/engines/ultima/ultima8/world/actors/avatar_death_process.cpp
@@ -47,14 +47,14 @@ void AvatarDeathProcess::run() {
MainActor *av = getMainActor();
if (!av) {
- perr << "AvatarDeathProcess: MainActor object missing" << Std::endl;
+ warning("AvatarDeathProcess: MainActor object missing");
// avatar gone??
terminate();
return;
}
if (!av->hasActorFlags(Actor::ACT_DEAD)) {
- perr << "AvatarDeathProcess: MainActor not dead" << Std::endl;
+ warning("AvatarDeathProcess: MainActor not dead");
// avatar not dead?
terminate();
return;
diff --git a/engines/ultima/ultima8/world/actors/heal_process.cpp b/engines/ultima/ultima8/world/actors/heal_process.cpp
index be0e57e5d1e..503ed837ad3 100644
--- a/engines/ultima/ultima8/world/actors/heal_process.cpp
+++ b/engines/ultima/ultima8/world/actors/heal_process.cpp
@@ -99,7 +99,7 @@ uint32 HealProcess::I_feedAvatar(const uint8 *args, unsigned int /*argsize*/) {
Process *p = Kernel::get_instance()->findProcess(0, 0x222); // CONSTANT!
HealProcess *hp = dynamic_cast<HealProcess *>(p);
if (!hp) {
- perr << "I_feedAvatar: unable to find HealProcess!" << Std::endl;
+ warning("I_feedAvatar: unable to find HealProcess!");
return 0;
}
diff --git a/engines/ultima/ultima8/world/actors/main_actor.cpp b/engines/ultima/ultima8/world/actors/main_actor.cpp
index 596abbcb189..cece6763b37 100644
--- a/engines/ultima/ultima8/world/actors/main_actor.cpp
+++ b/engines/ultima/ultima8/world/actors/main_actor.cpp
@@ -371,7 +371,7 @@ void MainActor::teleport(int mapNum, int32 x, int32 y, int32 z) {
// (attempt to) load the new map
if (!world->switchMap(mapNum)) {
- perr << "MainActor::teleport(): switchMap(" << mapNum << ") failed!" << Std::endl;
+ warning("MainActor::teleport(): switchMap(%d) failed!", mapNum);
return;
}
@@ -403,7 +403,7 @@ void MainActor::teleport(int mapNum, int teleport_id) {
// (attempt to) load the new map
if (!world->switchMap(mapNum)) {
- perr << "MainActor::teleport(): switchMap() failed!" << Std::endl;
+ warning("MainActor::teleport(): switchMap() failed!");
setMapNum(oldmap);
return;
}
@@ -411,8 +411,7 @@ void MainActor::teleport(int mapNum, int teleport_id) {
// find destination
TeleportEgg *egg = currentmap->findDestination(teleport_id);
if (!egg) {
- perr << "MainActor::teleport(): destination egg not found!"
- << Std::endl;
+ warning("MainActor::teleport(): destination egg not found!");
teleport(oldmap, oldx, oldy, oldz);
return;
}
diff --git a/engines/ultima/ultima8/world/actors/pathfinder.cpp b/engines/ultima/ultima8/world/actors/pathfinder.cpp
index 535230ed5a6..1551bdcf58b 100644
--- a/engines/ultima/ultima8/world/actors/pathfinder.cpp
+++ b/engines/ultima/ultima8/world/actors/pathfinder.cpp
@@ -397,12 +397,12 @@ void Pathfinder::newNode(PathNode *oldnode, PathfindingState &state,
costHeuristic(newnode);
#if 0
- perr << "trying dir " << state._direction;
+ pout << "trying dir " << state._direction;
if (steps > 0) {
- perr << ", " << steps << " steps";
+ pout << ", " << steps << " steps";
}
- perr << " from ("
+ pout << " from ("
<< oldnode->state._x << "," << oldnode->state._y << ") to ("
<< newnode->state._x << "," << newnode->state._y
<< "), cost = " << newnode->cost << ", heurtotcost = "
diff --git a/engines/ultima/ultima8/world/actors/pathfinder_process.cpp b/engines/ultima/ultima8/world/actors/pathfinder_process.cpp
index ddfe826fcf5..62017fd2bdf 100644
--- a/engines/ultima/ultima8/world/actors/pathfinder_process.cpp
+++ b/engines/ultima/ultima8/world/actors/pathfinder_process.cpp
@@ -49,7 +49,7 @@ PathfinderProcess::PathfinderProcess(Actor *actor, ObjId itemid, bool hit) :
Item *item = getItem(itemid);
if (!item) {
- perr << "PathfinderProcess: non-existent target" << Std::endl;
+ warning("PathfinderProcess: non-existent target");
// can't get there...
_result = PATH_FAILED;
terminateDeferred();
@@ -129,7 +129,7 @@ void PathfinderProcess::run() {
int32 curx, cury, curz;
Item *item = getItem(_targetItem);
if (!item) {
- perr << "PathfinderProcess: target missing" << Std::endl;
+ warning("PathfinderProcess: target missing");
_result = PATH_FAILED;
terminate();
return;
@@ -164,7 +164,7 @@ void PathfinderProcess::run() {
// since the running animation may move the actor, which could break
// the found _path.
if (actor->hasActorFlags(Actor::ACT_ANIMLOCK)) {
- perr << "PathfinderProcess: ANIMLOCK, waiting" << Std::endl;
+ warning("PathfinderProcess: ANIMLOCK, waiting");
return;
}
diff --git a/engines/ultima/ultima8/world/actors/resurrection_process.cpp b/engines/ultima/ultima8/world/actors/resurrection_process.cpp
index b881497e328..92df37197f8 100644
--- a/engines/ultima/ultima8/world/actors/resurrection_process.cpp
+++ b/engines/ultima/ultima8/world/actors/resurrection_process.cpp
@@ -64,8 +64,7 @@ void ResurrectionProcess::run() {
// reload stats
if (!a->loadMonsterStats()) {
- perr << "ResurrectionProcess::run failed to reset stats for actor ("
- << a->getShape() << ")." << Std::endl;
+ warning("ResurrectionProcess::run failed to reset stats for actor (%u).", a->getShape());
}
// go into combat mode
diff --git a/engines/ultima/ultima8/world/current_map.cpp b/engines/ultima/ultima8/world/current_map.cpp
index 090974c55ce..bc1ec5b0cf0 100644
--- a/engines/ultima/ultima8/world/current_map.cpp
+++ b/engines/ultima/ultima8/world/current_map.cpp
@@ -234,8 +234,7 @@ void CurrentMap::addItem(Item *item) {
if (ix < 0 || ix >= _mapChunkSize * MAP_NUM_CHUNKS ||
iy < 0 || iy >= _mapChunkSize * MAP_NUM_CHUNKS) {
- /*perr << "Skipping item " << item->getObjId() << ": out of range ("
- << ix << "," << iy << ")" << Std::endl;*/
+ //warning("Skipping item %u: out of range (%d, %d)", item->getObjId(), ix, iy);
return;
}
@@ -274,8 +273,7 @@ void CurrentMap::addItemToEnd(Item *item) {
if (ix < 0 || ix >= _mapChunkSize * MAP_NUM_CHUNKS ||
iy < 0 || iy >= _mapChunkSize * MAP_NUM_CHUNKS) {
- /*perr << "Skipping item " << item->getObjId() << ": out of range ("
- << ix << "," << iy << ")" << Std::endl;*/
+ //warning("Skipping item %u: out of range (%d, %d)", item->getObjId(), ix, iy);
return;
}
@@ -403,8 +401,7 @@ void CurrentMap::removeItemFromList(Item *item, int32 oldx, int32 oldy) {
if (oldx < 0 || oldx >= _mapChunkSize * MAP_NUM_CHUNKS ||
oldy < 0 || oldy >= _mapChunkSize * MAP_NUM_CHUNKS) {
- /*perr << "Skipping item " << item->getObjId() << ": out of range ("
- << oldx << "," << oldy << ")" << Std::endl;*/
+ //warning("Skipping item %u: out of range (%d, %d)", item->getObjId(), oldx, oldy);
return;
}
@@ -801,10 +798,10 @@ bool CurrentMap::isValidPosition(int32 x, int32 y, int32 z,
#if 0
if (item->getShape() == 145) {
- perr << "Shape 145: (" << ix - ixd << "," << iy - iyd << ","
+ pout << "Shape 145: (" << ix - ixd << "," << iy - iyd << ","
<< iz << ")-(" << ix << "," << iy << "," << iz + izd
<< ")" << Std::endl;
- if (!si->is_solid()) perr << "not solid" << Std::endl;
+ if (!si->is_solid()) pout << "not solid" << Std::endl;
}
#endif
diff --git a/engines/ultima/ultima8/world/fireball_process.cpp b/engines/ultima/ultima8/world/fireball_process.cpp
index faaf3b4b980..45872a82261 100644
--- a/engines/ultima/ultima8/world/fireball_process.cpp
+++ b/engines/ultima/ultima8/world/fireball_process.cpp
@@ -177,11 +177,11 @@ uint32 FireballProcess::I_TonysBalls(const uint8 *args,
Item *ball = ItemFactory::createItem(260, 4, 0, Item::FLG_FAST_ONLY,
0, 0, 0, true);
if (!ball) {
- perr << "I_TonysBalls failed to create item (260, 4)." << Std::endl;
+ warning("I_TonysBalls failed to create item (260, 4).");
return 0;
}
if (!ball->canExistAt(x, y, z)) {
- perr << "I_TonysBalls: failed to create fireball." << Std::endl;
+ warning("I_TonysBalls: failed to create fireball.");
ball->destroy();
return 0;
}
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index c2c88a78fe5..b46efb58909 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -126,7 +126,7 @@ Container *Item::getParentAsContainer() const {
Container *p = getContainer(_parent);
if (!p) {
- perr << "Item " << getObjId() << " _parent (" << _parent << ") is an invalid Container ObjID" << Std::endl;
+ warning("Item %u _parent (%u) is an invalid Container ObjID", getObjId(), _parent);
CANT_HAPPEN();
}
@@ -161,7 +161,7 @@ void Item::move(int32 X, int32 Y, int32 Z) {
int mapChunkSize = map->getChunkSize();
if (getObjId() == 1 && Z < 0) {
- perr.Print("Warning: moving avatar below Z=0. (%d,%d,%d)\n", X, Y, Z);
+ warning("Warning: moving avatar below Z=0. (%d,%d,%d)\n", X, Y, Z);
}
// TODO: In Crusader, if we are moving the avatar the game also checks whether
@@ -183,7 +183,7 @@ void Item::move(int32 X, int32 Y, int32 Z) {
if (p) p->removeItem(this);
}
} else
- perr << "Item " << getObjId() << " FLG_CONTAINED or FLG_EQUIPPED set but item has no _parent" << Std::endl;
+ warning("Item %u FLG_CONTAINED or FLG_EQUIPPED set but item has no _parent", getObjId());
// Clear our owner.
_parent = 0;
@@ -258,7 +258,7 @@ void Item::move(int32 X, int32 Y, int32 Z) {
bool Item::moveToContainer(Container *container, bool checkwghtvol) {
// Null container, report an error message
if (!container) {
- perr << "NULL container passed to Item::moveToContainer" << Std::endl;
+ warning("NULL container passed to Item::moveToContainer");
return false;
}
@@ -289,7 +289,7 @@ bool Item::moveToContainer(Container *container, bool checkwghtvol) {
if (p) p->removeItem(this);
}
} else
- perr << "Item " << getObjId() << " FLG_CONTAINED or FLG_EQUIPPED set but item has no _parent" << Std::endl;
+ warning("Item %u FLG_CONTAINED or FLG_EQUIPPED set but item has no _parent", getObjId());
// Clear our owner.
_parent = 0;
@@ -361,7 +361,7 @@ void Item::moveToEtherealVoid() {
Container *p = getParentAsContainer();
if (p) p->removeItem(this);
} else
- perr << "Item " << getObjId() << " FLG_CONTAINED or FLG_EQUIPPED set but item has no _parent" << Std::endl;
+ warning("Item %u FLG_CONTAINED or FLG_EQUIPPED set but item has no _parent", getObjId());
} else if (_extendedFlags & EXT_INCURMAP) {
World::get_instance()->getCurrentMap()->removeItem(this);
}
@@ -379,7 +379,7 @@ void Item::returnFromEtherealVoid() {
if (_flags & (FLG_CONTAINED | FLG_EQUIPPED)) {
Container *p = getParentAsContainer();
if (!p) {
- perr << "Item " << getObjId() << " FLG_CONTAINED or FLG_EQUIPPED set but item has no valid _parent" << Std::endl;
+ warning("Item %u FLG_CONTAINED or FLG_EQUIPPED set but item has no _parent", getObjId());
CANT_HAPPEN();
}
moveToContainer(p);
@@ -1016,12 +1016,12 @@ bool Item::checkLoopScript(const uint8 *script, uint32 scriptsize) const {
break;
default:
- perr.Print("Unknown loopscript opcode %02X\n", script[i]);
+ warning("Unknown loopscript opcode %02X", script[i]);
}
i++;
}
- perr.Print("Didn't encounter $ in loopscript\n");
+ warning("Didn't encounter $ in loopscript");
return false;
}
@@ -2953,9 +2953,9 @@ uint32 Item::I_getTypeFlag(const uint8 *args, unsigned int /*argsize*/) {
const ShapeInfo *info = item->getShapeInfo();
if (GAME_IS_U8 && typeflag >= 64)
- perr << "Invalid TypeFlag greater than 63 requested (" << typeflag << ") by Usecode" << Std::endl;
+ warning("Invalid TypeFlag greater than 63 requested (%u) by Usecode", typeflag);
if (GAME_IS_CRUSADER && typeflag >= 72)
- perr << "Invalid TypeFlag greater than 72 requested (" << typeflag << ") by Usecode" << Std::endl;
+ warning("Invalid TypeFlag greater than 72 requested (%u) by Usecode", typeflag);
if (info->getTypeFlag(typeflag))
return 1;
@@ -3151,8 +3151,7 @@ uint32 Item::I_legalCreateAtPoint(const uint8 *args, unsigned int /*argsize*/) {
Item *newitem = ItemFactory::createItem(shape, frame, 0, 0, 0, 0, 0, true);
if (!newitem) {
- perr << "I_legalCreateAtPoint failed to create item (" << shape
- << "," << frame << ")." << Std::endl;
+ warning("I_legalCreateAtPoint failed to create item (%u, %u).", shape, frame);
return 0;
}
uint16 objID = newitem->getObjId();
@@ -3185,8 +3184,7 @@ uint32 Item::I_legalCreateAtCoords(const uint8 *args, unsigned int /*argsize*/)
// if yes, create it
Item *newitem = ItemFactory::createItem(shape, frame, 0, 0, 0, 0, 0, true);
if (!newitem) {
- perr << "I_legalCreateAtCoords failed to create item (" << shape
- << "," << frame << ")." << Std::endl;
+ warning("I_legalCreateAtCoords failed to create item (%u, %u).", shape, frame);
return 0;
}
uint16 objID = newitem->getObjId();
@@ -3217,8 +3215,7 @@ uint32 Item::I_legalCreateInCont(const uint8 *args, unsigned int /*argsize*/) {
Item *newitem = ItemFactory::createItem(shape, frame, 0, 0, 0, 0, 0, true);
if (!newitem) {
- perr << "I_legalCreateInCont failed to create item (" << shape
- << "," << frame << ")." << Std::endl;
+ warning("I_legalCreateInCont failed to create item (%u, %u).", shape, frame);
return 0;
}
@@ -3232,8 +3229,7 @@ uint32 Item::I_legalCreateInCont(const uint8 *args, unsigned int /*argsize*/) {
return 1;
} else {
- perr << "I_legalCreateInCont failed to add item to container ("
- << container->getObjId() << ")" << Std::endl;
+ warning("I_legalCreateInCont failed to add item to container (%u)", container->getObjId());
// failed to add; clean up
newitem->destroy();
@@ -3366,7 +3362,7 @@ uint32 Item::I_push(const uint8 *args, unsigned int /*argsize*/) {
return 0;
#if 0
- perr << "Pushing item to ethereal void: id: " << item->getObjId() << " shp: " << item->getShape() << "," << item->getFrame() << Std::endl;
+ pout << "Pushing item to ethereal void: id: " << item->getObjId() << " shp: " << item->getShape() << "," << item->getFrame() << Std::endl;
#endif
item->moveToEtherealVoid();
@@ -3381,8 +3377,7 @@ uint32 Item::I_create(const uint8 *args, unsigned int /*argsize*/) {
Item *newitem = ItemFactory::createItem(shape, frame, 0, 0, 0, 0, 0, true);
if (!newitem) {
- perr << "I_create failed to create item (" << shape
- << "," << frame << ")." << Std::endl;
+ warning("I_create failed to create item (%u, %u).", shape, frame);
return 0;
}
uint16 objID = newitem->getObjId();
@@ -3420,7 +3415,7 @@ uint32 Item::I_pop(const uint8 */*args*/, unsigned int /*argsize*/) {
item->returnFromEtherealVoid();
#if 0
- perr << "Popping item to original location: " << item->getShape() << "," << item->getFrame() << Std::endl;
+ pout << "Popping item to original location: " << item->getShape() << "," << item->getFrame() << Std::endl;
#endif
//! Anything else?
@@ -3458,7 +3453,7 @@ uint32 Item::I_popToCoords(const uint8 *args, unsigned int /*argsize*/) {
item->move(x, y, z);
#if 0
- perr << "Popping item into map: " << item->getShape() << "," << item->getFrame() << " at (" << x << "," << y << "," << z << ")" << Std::endl;
+ pout << "Popping item into map: " << item->getShape() << "," << item->getFrame() << " at (" << x << "," << y << "," << z << ")" << Std::endl;
#endif
//! Anything else?
@@ -3490,15 +3485,15 @@ uint32 Item::I_popToContainer(const uint8 *args, unsigned int /*argsize*/) {
citem->getLocation(pt);
item->move(pt);
} else {
- perr << "Trying to popToContainer to invalid container (" << id_citem << ")" << Std::endl;
+ warning("Trying to popToContainer to invalid container (%u)", id_citem);
item->dumpInfo();
// This object now has no home, destroy it - unless it doesn't think it's
// ethereal, in that case it is somehow there by mistake?
if (item->getFlags() & FLG_ETHEREAL) {
- perr << "Destroying orphaned ethereal object (" << objId << ")" << Std::endl;
+ warning("Destroying orphaned ethereal object (%u)", objId);
item->destroy();
} else {
- perr << "Leaving orphaned ethereal object (" << objId << ")" << Std::endl;
+ warning("Leaving orphaned ethereal object (%u)", objId);
w->etherealRemove(objId);
}
}
@@ -3533,15 +3528,15 @@ uint32 Item::I_popToEnd(const uint8 *args, unsigned int /*argsize*/) {
citem->getLocation(pt);
item->move(pt);
} else {
- perr << "Trying to popToEnd to invalid container (" << id_citem << ")" << Std::endl;
+ warning("Trying to popToEnd to invalid container (%u)", id_citem);
item->dumpInfo();
// This object now has no home, destroy it - unless it doesn't think it's
// ethereal, in that case it is somehow there by mistake?
if (item->getFlags() & FLG_ETHEREAL) {
- perr << "Destroying orphaned ethereal object (" << objId << ")" << Std::endl;
+ warning("Destroying orphaned ethereal object (%u)", objId);
item->destroy();
} else {
- perr << "Leaving orphaned ethereal object (" << objId << ")" << Std::endl;
+ warning("Leaving orphaned ethereal object (%u)", objId);
w->etherealRemove(objId);
}
}
@@ -3566,7 +3561,7 @@ uint32 Item::I_move(const uint8 *args, unsigned int /*argsize*/) {
World_FromUsecodeXY(x, y);
#if 0
- perr << "Moving item: " << item->getShape() << "," << item->getFrame() << " to (" << x << "," << y << "," << z << ")" << Std::endl;
+ pout << "Moving item: " << item->getShape() << "," << item->getFrame() << " to (" << x << "," << y << "," << z << ")" << Std::endl;
#endif
item->move(x, y, z);
diff --git a/engines/ultima/ultima8/world/monster_egg.cpp b/engines/ultima/ultima8/world/monster_egg.cpp
index e03444c29bb..671122d2962 100644
--- a/engines/ultima/ultima8/world/monster_egg.cpp
+++ b/engines/ultima/ultima8/world/monster_egg.cpp
@@ -54,16 +54,14 @@ uint16 MonsterEgg::hatch() {
FLG_FAST_ONLY | FLG_DISPOSABLE | FLG_IN_NPC_LIST,
0, 0, 0, true);
if (!newactor) {
- perr << "MonsterEgg::hatch failed to create actor (" << shapeNum
- << ")." << Std::endl;
+ warning("MonsterEgg::hatch failed to create actor (%d).", shapeNum);
return 0;
}
uint16 objID = newactor->getObjId();
// set stats
if (!newactor->loadMonsterStats()) {
- perr << "MonsterEgg::hatch failed to set stats for actor (" << shapeNum
- << ")." << Std::endl;
+ warning("MonsterEgg::hatch failed to set stats for actor (%d).", shapeNum);
}
if (!newactor->canExistAt(_x, _y, _z)) {
diff --git a/engines/ultima/ultima8/world/teleport_egg.cpp b/engines/ultima/ultima8/world/teleport_egg.cpp
index 005393beb67..85ca12ef4c2 100644
--- a/engines/ultima/ultima8/world/teleport_egg.cpp
+++ b/engines/ultima/ultima8/world/teleport_egg.cpp
@@ -40,7 +40,7 @@ uint16 TeleportEgg::hatch() {
if (!isTeleporter()) return 0; // teleport target
// teleport to destination egg
- perr << "Teleport!!!!!!!!" << Std::endl;
+ pout << "Teleport!!!!!!!!" << Std::endl;
MainActor *av = getMainActor();
av->teleport(_mapNum, getTeleportId());
diff --git a/engines/ultima/ultima8/world/world.cpp b/engines/ultima/ultima8/world/world.cpp
index 432c5556fc3..ffcab1d8f98 100644
--- a/engines/ultima/ultima8/world/world.cpp
+++ b/engines/ultima/ultima8/world/world.cpp
@@ -157,13 +157,13 @@ bool World::switchMap(uint32 newmap) {
uint32 oldmap = _currentMap->getNum();
if (oldmap != 0) {
- perr << "Unloading map " << oldmap << Std::endl;
+ pout << "Unloading map " << oldmap << Std::endl;
assert(oldmap < _maps.size() && _maps[oldmap] != nullptr);
_currentMap->writeback();
- perr << "Unloading Fixed items from map " << oldmap << Std::endl;
+ pout << "Unloading Fixed items from map " << oldmap << Std::endl;
_maps[oldmap]->unloadFixed();
}
More information about the Scummvm-git-logs
mailing list