[Scummvm-git-logs] scummvm master -> 7492854c6548f653116fcf16da337ada09f2fa0a
mduggan
mgithub at guarana.org
Tue May 19 01:45:44 UTC 2020
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:
7492854c65 ULTIMA8: Remove custom error type
Commit: 7492854c6548f653116fcf16da337ada09f2fa0a
https://github.com/scummvm/scummvm/commit/7492854c6548f653116fcf16da337ada09f2fa0a
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-05-19T10:41:41+09:00
Commit Message:
ULTIMA8: Remove custom error type
It was only used in 2 places and not checked even in those places.
Changed paths:
R engines/ultima/ultima8/graphics/graphics_errors.h
R engines/ultima/ultima8/misc/errors.h
engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
engines/ultima/ultima8/graphics/base_soft_render_surface.h
engines/ultima/ultima8/graphics/render_surface.h
engines/ultima/ultima8/graphics/skf_player.cpp
engines/ultima/ultima8/misc/pent_include.h
diff --git a/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp b/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
index e985b1586e..386e4b77d0 100644
--- a/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
+++ b/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
@@ -248,7 +248,7 @@ BaseSoftRenderSurface::~BaseSoftRenderSurface() {
// Desc: Prepare the surface for drawing this frame (in effect lock it for drawing)
// Returns: Non Zero on error
//
-ECode BaseSoftRenderSurface::BeginPainting() {
+bool BaseSoftRenderSurface::BeginPainting() {
if (!_lockCount) {
if (_surface) {
@@ -259,8 +259,8 @@ ECode BaseSoftRenderSurface::BeginPainting() {
_pitch = _surface->pitch;
if (_flipped) _pitch = -_pitch;
} else {
- ECode ret = GenericLock();
- if (ret.failed()) return ret;
+ if (!GenericLock())
+ return false;
}
}
@@ -269,14 +269,14 @@ ECode BaseSoftRenderSurface::BeginPainting() {
if (_pixels00 == nullptr) {
// TODO: SetLastError(GR_SOFT_ERROR_LOCKED_NULL_PIXELS, "Surface Locked with NULL BaseSoftRenderSurface::_pixels pointer!");
perr << "Error: Surface Locked with NULL BaseSoftRenderSurface::_pixels pointer!" << Std::endl;
- return GR_SOFT_ERROR_LOCKED_NULL_PIXELS;
+ return false;
}
// Origin offset pointers
SetPixelsPointer();
// No error
- return P_NO_ERROR;
+ return true;
}
@@ -286,12 +286,12 @@ ECode BaseSoftRenderSurface::BeginPainting() {
// Desc: Prepare the surface for drawing this frame (in effect lock it for drawing)
// Returns: Non Zero on error
//
-ECode BaseSoftRenderSurface::EndPainting() {
+bool BaseSoftRenderSurface::EndPainting() {
// Already Unlocked
if (!_lockCount) {
// TODO: SetLastError(GR_SOFT_ERROR_BEGIN_END_MISMATCH, "BeginPainting()/EndPainting() Mismatch!");
perr << "Error: BeginPainting()/EndPainting() Mismatch!" << Std::endl;
- return GR_SOFT_ERROR_BEGIN_END_MISMATCH;
+ return false;
}
// Decrement counter
@@ -308,13 +308,13 @@ ECode BaseSoftRenderSurface::EndPainting() {
screen->update();
} else {
- ECode ret = GenericUnlock();
- if (ret.failed()) return ret;
+ if (!GenericUnlock())
+ return false;
}
}
// No error
- return P_NO_ERROR;
+ return true;
}
//
diff --git a/engines/ultima/ultima8/graphics/base_soft_render_surface.h b/engines/ultima/ultima8/graphics/base_soft_render_surface.h
index 790487748e..6aba7db8b6 100644
--- a/engines/ultima/ultima8/graphics/base_soft_render_surface.h
+++ b/engines/ultima/ultima8/graphics/base_soft_render_surface.h
@@ -77,11 +77,11 @@ protected:
// Create Generic
BaseSoftRenderSurface(int w, int h, int bpp, int rsft, int gsft, int bsft, int asft);
BaseSoftRenderSurface(int w, int h, uint8 *buf);
- virtual ECode GenericLock() {
- return P_NO_ERROR;
+ virtual bool GenericLock() {
+ return true;
}
- virtual ECode GenericUnlock() {
- return P_NO_ERROR;
+ virtual bool GenericUnlock() {
+ return true;
}
// Update the Pixels Pointer
@@ -110,11 +110,11 @@ public:
// Begin painting to the buffer. MUST BE CALLED BEFORE DOING ANYTHING TO THE SURFACE!
// Can be called multiple times
// Returns Error Code on error. Check return code.....
- ECode BeginPainting() override;
+ bool BeginPainting() override;
// Finish paining to the buffer. MUST BE CALLED FOR EACH CALL TO BeginPainting()
// Returns Error Code on error. Check return code.....
- ECode EndPainting() override;
+ bool EndPainting() override;
// Get the surface as a Texture. Only valid for SecondaryRenderSurfaces
Texture *GetSurfaceAsTexture() override;
diff --git a/engines/ultima/ultima8/graphics/graphics_errors.h b/engines/ultima/ultima8/graphics/graphics_errors.h
deleted file mode 100644
index bef47ed1d7..0000000000
--- a/engines/ultima/ultima8/graphics/graphics_errors.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef ULTIMA8_GRAPHICS_GRAPHICSERRORS_H
-#define ULTIMA8_GRAPHICS_GRAPHICSERRORS_H
-
-
-////////////////////////////////////
-// //
-// Graphics Subsystem Error Codes //
-// //
-////////////////////////////////////
-
-#include "ultima/ultima8/misc/errors.h"
-
-namespace Ultima {
-namespace Ultima8 {
-
-//
-// Graphics Error Code Bases
-//
-
-// Software Rendering Error Code Base
-#define GR_SOFT_ERROR_BASE (GRAPHICS_ERROR_BASE-0x1000)
-
-// OpenGL Rendering Error Code Base
-#define GR_OGL_ERROR_BASE (GRAPHICS_ERROR_BASE-0x2000)
-
-// Texture Error Code Base
-#define GR_TEX_ERROR_BASE (GRAPHICS_ERROR_BASE-0x3000)
-
-
-//
-// Generic Graphics Errors
-//
-
-
-//
-// SoftRenderSurface Error Codes
-//
-
-// Surface Locked with NULL SoftRenderSurface::pixels pointer
-#define GR_SOFT_ERROR_LOCKED_NULL_PIXELS (GR_SOFT_ERROR_BASE-1)
-
-// BeginPainting()/EndPainting() Mismatch
-#define GR_SOFT_ERROR_BEGIN_END_MISMATCH (GR_SOFT_ERROR_BASE-3)
-
-
-//
-// OpenGL Error Codes
-//
-
-
-
-//
-// Texturing Error Codes
-//
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima8/graphics/render_surface.h b/engines/ultima/ultima8/graphics/render_surface.h
index daf4b806d7..d28daeb9f4 100644
--- a/engines/ultima/ultima8/graphics/render_surface.h
+++ b/engines/ultima/ultima8/graphics/render_surface.h
@@ -23,7 +23,6 @@
#ifndef ULTIMA8_GRAPHICS_RENDERSURFACE_H
#define ULTIMA8_GRAPHICS_RENDERSURFACE_H
-#include "ultima/ultima8/graphics/graphics_errors.h"
#include "graphics/pixelformat.h"
#include "graphics/managed_surface.h"
@@ -88,13 +87,13 @@ public:
//! Begin painting to the buffer. MUST BE CALLED BEFORE DOING ANYTHING TO THE SURFACE!
// \note Can be called multiple times
- // \return Error Code on error. Check return code.....
- virtual ECode BeginPainting() = 0;
+ // \return true on success, false on failure
+ virtual bool BeginPainting() = 0;
//! Finish paining to the buffer.
// \note MUST BE CALLED FOR EACH CALL TO BeginPainting()
- // \return Error Code on error. Check return code.....
- virtual ECode EndPainting() = 0;
+ // \return true on success, false on failure
+ virtual bool EndPainting() = 0;
//! Get the surface as a Texture. Only valid for SecondaryRenderSurfaces
// \note Do not delete the texture.
diff --git a/engines/ultima/ultima8/graphics/skf_player.cpp b/engines/ultima/ultima8/graphics/skf_player.cpp
index 977550b94e..424d762a3b 100644
--- a/engines/ultima/ultima8/graphics/skf_player.cpp
+++ b/engines/ultima/ultima8/graphics/skf_player.cpp
@@ -204,7 +204,7 @@ void SKFPlayer::run() {
if (musicproc) musicproc->playMusic(_events[_curEvent]->_data);
break;
case SKF_SlowStopMusic:
- POUT("SlowStopMusic");
+// pout << "SlowStopMusic" << Std::endl;
if (musicproc && !_introMusicHack) musicproc->playMusic(0);
break;
case SKF_PlaySFX:
@@ -216,7 +216,7 @@ void SKFPlayer::run() {
if (audioproc) audioproc->stopSFX(_events[_curEvent]->_data, 0);
break;
case SKF_SetSpeed:
- POUT("SetSpeed " << _events[_curEvent]->_data);
+// pout << "SetSpeed " << _events[_curEvent]->_data << Std::endl;
// _frameRate = _events[_curEvent]->_data;
break;
case SKF_PlaySound: {
diff --git a/engines/ultima/ultima8/misc/errors.h b/engines/ultima/ultima8/misc/errors.h
deleted file mode 100644
index 266a7fc201..0000000000
--- a/engines/ultima/ultima8/misc/errors.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef ULTIMA8_MISC_ERRORS_H
-#define ULTIMA8_MISC_ERRORS_H
-
-namespace Ultima {
-namespace Ultima8 {
-
-////////////////////////////////
-// //
-// Pentagram Base Error Codes //
-// //
-////////////////////////////////
-
-// Base Error Code type
-struct ECode {
- int32 _error;
-
- ECode() : _error(0) { }
- ECode(int32 _e) : _error(_e) { }
-
- bool failed() const {
- return _error != 0;
- }
- bool succeded() const {
- return _error == 0;
- }
-
- ECode &operator = (const int32 &_e) {
- _error = _e;
- return (*this);
- }
-
- ECode &operator = (const ECode &_e) {
- _error = _e._error;
- return (*this);
- }
-
- bool operator != (const int32 &_e) const {
- return _error != _e;
- }
-
- friend bool operator != (const int32 &_e, const ECode &_e2) {
- return _e2._error != _e;
- }
-
- bool operator == (const int32 &_e) const {
- return _error == _e;
- }
-
- friend bool operator == (int32 &_e, ECode &_e2) {
- return _e2._error == _e;
- }
-};
-
-
-//
-// Helper Macros
-//
-
-// Checks to see if a return code is an _error
-#define P_FAILED(e) ((e)!=0)
-
-// Checks to see if an _error code indicates success
-#define P_SUCCEDED(e) ((e)==0)
-
-
-//
-// Error Code Bases
-//
-
-// Kernel Error Code Base
-#define KERNEL_ERROR_BASE (-0x10000)
-
-// Usecode Error Code Base
-#define UESCODE_ERROR_BASE (-0x20000)
-
-// FileSystem Error Code Base
-#define FILESYS_ERROR_BASE (-0x30000)
-
-// Graphics Error Code Base
-#define GRAPHICS_ERROR_BASE (-0x40000)
-
-// Gump Error Code Base
-#define GUMPS_ERROR_BASE (-0x50000)
-
-// Convert Error Code Base
-#define CONVERT_ERROR_BASE (-0x60000)
-
-// World Error Code Base
-#define WORLD_ERROR_BASE (-0x70000)
-
-// Audio Error Code Base
-#define AUDIO_ERROR_BASE (-0x80000)
-
-// Misc Error Code Base
-#define MISC_ERROR_BASE (-0x90000)
-
-
-//
-// Basic Error Codes
-//
-
-// No Error
-#define P_NO_ERROR (0)
-
-// Generic Error
-#define P_GENERIC_ERROR (-1)
-
-// Undefined Error
-#define P_UNDEFINED_ERROR (-2)
-
-// Memory Allocation Error
-#define P_MEMORY_ALLOC_ERRO (-3)
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima8/misc/pent_include.h b/engines/ultima/ultima8/misc/pent_include.h
index f8a8173328..f17795bf4b 100644
--- a/engines/ultima/ultima8/misc/pent_include.h
+++ b/engines/ultima/ultima8/misc/pent_include.h
@@ -38,40 +38,19 @@
//
// Strings
//
-
#include "ultima/ultima8/misc/istring.h"
-//
-// Base Errors
-//
-
-#include "ultima/ultima8/misc/errors.h"
-
//
// The Debugger
//
-
#include "ultima/ultima8/misc/debugger.h"
-//
-// Debugging
-//
-#ifdef DEBUG
-# define POUT(x) do { pout << x << Std::endl; pout.flush(); } while (0)
-# define PERR(x) do { perr << x << Std::endl; perr.flush(); } while (0)
-#else
-# define POUT(x) do { } while(0)
-# define PERR(x) do { } while(0)
-#endif
-
// Two very useful macros that one should use instead of pure delete; they
// will additionally set the old object pointer to 0, thus helping prevent
// double deletes (note that "delete 0" is a no-op).
#define FORGET_OBJECT(x) do { delete x; x = 0; } while(0)
-#define FORGET_ARRAY(x) do { delete [] x; x = 0; } while(0)
-
//
// Can't happen.
@@ -79,13 +58,6 @@
//
#define CANT_HAPPEN() do { assert(false); } while(0)
-//
-// Can't happen return.
-// If we're guaranteed to return before this, but we want to shut the
-// compiler warning up.
-//
-#define CANT_HAPPEN_RETURN() do { assert(false); return 0; } while(0)
-
//
// Can't happen with a message
//
More information about the Scummvm-git-logs
mailing list