[Scummvm-git-logs] scummvm master -> 58aee69829654e638a8314ca1041130ac83ae56c
dreammaster
paulfgilbert at gmail.com
Wed Apr 29 04:14:06 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8c15df467c ULTIMA4: Remove using keywords
58aee69829 ULTIMA4: Refactor out MapCoords nowhere static
Commit: 8c15df467c4ca22443683d2c14e8edf14c5b1a87
https://github.com/scummvm/scummvm/commit/8c15df467c4ca22443683d2c14e8edf14c5b1a87
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-04-28T18:58:33-07:00
Commit Message:
ULTIMA4: Remove using keywords
Changed paths:
engines/ultima/ultima4/game/player.h
engines/ultima/ultima4/game/stats.h
engines/ultima/ultima4/gfx/imageloader_fmtowns.cpp
engines/ultima/ultima4/gfx/imageloader_u4.cpp
engines/ultima/ultima4/gfx/imagemgr.cpp
engines/ultima/ultima4/gfx/scale.cpp
engines/ultima/ultima4/map/city.cpp
engines/ultima/ultima4/map/map.h
engines/ultima/ultima4/map/mapmgr.cpp
engines/ultima/ultima4/map/tileanim.cpp
engines/ultima/ultima4/sound/sound.cpp
diff --git a/engines/ultima/ultima4/game/player.h b/engines/ultima/ultima4/game/player.h
index 578a470f80..b7238bc103 100644
--- a/engines/ultima/ultima4/game/player.h
+++ b/engines/ultima/ultima4/game/player.h
@@ -38,8 +38,6 @@ class Armor;
class Party;
class Weapon;
-using Common::String;
-
typedef Std::vector<class PartyMember *> PartyMemberVector;
#define ALL_PLAYERS -1
diff --git a/engines/ultima/ultima4/game/stats.h b/engines/ultima/ultima4/game/stats.h
index c8f45757ae..4f52ef3657 100644
--- a/engines/ultima/ultima4/game/stats.h
+++ b/engines/ultima/ultima4/game/stats.h
@@ -39,8 +39,6 @@ class MenuEvent;
class Party;
class PartyEvent;
-using Common::String;
-
#define STATS_AREA_WIDTH 15
#define STATS_AREA_HEIGHT 8
#define STATS_AREA_X TEXT_AREA_X
diff --git a/engines/ultima/ultima4/gfx/imageloader_fmtowns.cpp b/engines/ultima/ultima4/gfx/imageloader_fmtowns.cpp
index da5215b3d2..e923a960c4 100644
--- a/engines/ultima/ultima4/gfx/imageloader_fmtowns.cpp
+++ b/engines/ultima/ultima4/gfx/imageloader_fmtowns.cpp
@@ -30,8 +30,6 @@
namespace Ultima {
namespace Ultima4 {
-using Std::vector;
-
Image *FMTOWNSImageLoader::load(Common::File *file, int width, int height, int bpp) {
if (width == -1 || height == -1 || bpp == -1) {
error("dimensions not set for fmtowns image");
diff --git a/engines/ultima/ultima4/gfx/imageloader_u4.cpp b/engines/ultima/ultima4/gfx/imageloader_u4.cpp
index 716ea65029..0e7e03b709 100644
--- a/engines/ultima/ultima4/gfx/imageloader_u4.cpp
+++ b/engines/ultima/ultima4/gfx/imageloader_u4.cpp
@@ -31,8 +31,6 @@
namespace Ultima {
namespace Ultima4 {
-using Std::vector;
-
RGBA *U4PaletteLoader::_bwPalette = nullptr;
RGBA *U4PaletteLoader::_egaPalette = nullptr;
RGBA *U4PaletteLoader::_vgaPalette = nullptr;
@@ -201,7 +199,7 @@ RGBA *U4PaletteLoader::loadEgaPalette() {
_egaPalette = new RGBA[16];
- vector<ConfigElement> paletteConf = config->getElement("egaPalette").getChildren();
+ Std::vector<ConfigElement> paletteConf = config->getElement("egaPalette").getChildren();
for (Std::vector<ConfigElement>::iterator i = paletteConf.begin(); i != paletteConf.end(); i++) {
if (i->getName() != "color")
diff --git a/engines/ultima/ultima4/gfx/imagemgr.cpp b/engines/ultima/ultima4/gfx/imagemgr.cpp
index adad9ab615..d2f76a782d 100644
--- a/engines/ultima/ultima4/gfx/imagemgr.cpp
+++ b/engines/ultima/ultima4/gfx/imagemgr.cpp
@@ -32,10 +32,6 @@
namespace Ultima {
namespace Ultima4 {
-using Std::map;
-using Common::String;
-using Std::vector;
-
bool ImageInfo::hasBlackBackground() {
return this->_filetype == "image/x-u4raw";
}
@@ -48,7 +44,7 @@ public:
Common::String _name;
Common::String _location;
Common::String _extends;
- map<Common::String, ImageInfo *> _info;
+ Std::map<Common::String, ImageInfo *> _info;
};
ImageMgr *ImageMgr::_instance = nullptr;
@@ -104,7 +100,7 @@ void ImageMgr::init() {
* register all the images declared in the config files
*/
const Config *config = Config::getInstance();
- vector<ConfigElement> graphicsConf = config->getElement("graphics").getChildren();
+ Std::vector<ConfigElement> graphicsConf = config->getElement("graphics").getChildren();
for (Std::vector<ConfigElement>::iterator conf = graphicsConf.begin(); conf != graphicsConf.end(); conf++) {
if (conf->getName() == "imageset") {
ImageSet *set = loadImageSetFromConf(*conf);
@@ -130,7 +126,7 @@ ImageSet *ImageMgr::loadImageSetFromConf(const ConfigElement &conf) {
set->_location = conf.getString("location");
set->_extends = conf.getString("extends");
- vector<ConfigElement> children = conf.getChildren();
+ Std::vector<ConfigElement> children = conf.getChildren();
for (Std::vector<ConfigElement>::iterator i = children.begin(); i != children.end(); i++) {
if (i->getName() == "image") {
ImageInfo *info = loadImageInfoFromConf(*i);
@@ -163,7 +159,7 @@ ImageInfo *ImageMgr::loadImageInfoFromConf(const ConfigElement &conf) {
info->_fixup = static_cast<ImageFixup>(conf.getEnum("fixup", fixupEnumStrings));
info->_image = nullptr;
- vector<ConfigElement> children = conf.getChildren();
+ Std::vector<ConfigElement> children = conf.getChildren();
for (Std::vector<ConfigElement>::iterator i = children.begin(); i != children.end(); i++) {
if (i->getName() == "subimage") {
SubImage *subimage = loadSubImageFromConf(info, *i);
@@ -672,7 +668,7 @@ void ImageMgr::freeIntroBackgrounds() {
}
}
-const vector<Common::String> &ImageMgr::getSetNames() {
+const Std::vector<Common::String> &ImageMgr::getSetNames() {
return _imageSetNames;
}
diff --git a/engines/ultima/ultima4/gfx/scale.cpp b/engines/ultima/ultima4/gfx/scale.cpp
index bd84dac03a..c21634678c 100644
--- a/engines/ultima/ultima4/gfx/scale.cpp
+++ b/engines/ultima/ultima4/gfx/scale.cpp
@@ -27,8 +27,6 @@
namespace Ultima {
namespace Ultima4 {
-using Common::String;
-
Image *scalePoint(Image *src, int scale, int n);
Image *scale2xBilinear(Image *src, int scale, int n);
Image *scale2xSaI(Image *src, int scale, int N);
diff --git a/engines/ultima/ultima4/map/city.cpp b/engines/ultima/ultima4/map/city.cpp
index 6f252b1512..45802c0bd8 100644
--- a/engines/ultima/ultima4/map/city.cpp
+++ b/engines/ultima/ultima4/map/city.cpp
@@ -31,8 +31,6 @@
namespace Ultima {
namespace Ultima4 {
-using Common::String;
-
City::City() : Map() {
}
diff --git a/engines/ultima/ultima4/map/map.h b/engines/ultima/ultima4/map/map.h
index 063dc61d9e..00f83eac80 100644
--- a/engines/ultima/ultima4/map/map.h
+++ b/engines/ultima/ultima4/map/map.h
@@ -34,8 +34,6 @@
namespace Ultima {
namespace Ultima4 {
-using Common::String;
-
#define MAP_IS_OOB(mapptr, c) (((c).x) < 0 || ((c).x) >= (static_cast<int>((mapptr)->_width)) || ((c).y) < 0 || ((c).y) >= (static_cast<int>((mapptr)->_height)) || ((c).z) < 0 || ((c).z) >= (static_cast<int>((mapptr)->_levels)))
class AnnotationMgr;
diff --git a/engines/ultima/ultima4/map/mapmgr.cpp b/engines/ultima/ultima4/map/mapmgr.cpp
index ae48b93f37..e883017e71 100644
--- a/engines/ultima/ultima4/map/mapmgr.cpp
+++ b/engines/ultima/ultima4/map/mapmgr.cpp
@@ -42,9 +42,6 @@
namespace Ultima {
namespace Ultima4 {
-using Std::vector;
-using Std::pair;
-
MapMgr *MapMgr::_instance = nullptr;
extern bool shrineCanEnter(const Portal *p);
@@ -66,7 +63,7 @@ MapMgr::MapMgr() {
const Config *config = Config::getInstance();
Map *map;
- vector<ConfigElement> maps = config->getElement("maps").getChildren();
+ Std::vector<ConfigElement> maps = config->getElement("maps").getChildren();
for (Std::vector<ConfigElement>::iterator i = maps.begin(); i != maps.end(); i++) {
map = initMapFromConf(*i);
@@ -83,7 +80,7 @@ MapMgr::~MapMgr() {
void MapMgr::unloadMap(MapId id) {
delete _mapList[id];
const Config *config = Config::getInstance();
- vector<ConfigElement> maps = config->getElement("maps").getChildren();
+ Std::vector<ConfigElement> maps = config->getElement("maps").getChildren();
for (Std::vector<ConfigElement>::const_iterator i = maps.begin(); i != maps.end(); ++i) {
if (id == static_cast<MapId>((*i).getInt("id"))) {
@@ -189,7 +186,7 @@ Map *MapMgr::initMapFromConf(const ConfigElement &mapConf) {
map->_tileSet = g_tileSets->get(mapConf.getString("tileset"));
map->_tileMap = g_tileMaps->get(mapConf.getString("tilemap"));
- vector<ConfigElement> children = mapConf.getChildren();
+ Std::vector<ConfigElement> children = mapConf.getChildren();
for (Std::vector<ConfigElement>::iterator i = children.begin(); i != children.end(); i++) {
if (i->getName() == "city") {
City *city = dynamic_cast<City *>(map);
@@ -221,7 +218,7 @@ void MapMgr::initCityFromConf(const ConfigElement &cityConf, City *city) {
city->_type = cityConf.getString("type");
city->_tlkFname = cityConf.getString("tlk_fname");
- vector<ConfigElement> children = cityConf.getChildren();
+ Std::vector<ConfigElement> children = cityConf.getChildren();
for (Std::vector<ConfigElement>::iterator i = children.begin(); i != children.end(); i++) {
if (i->getName() == "personrole")
city->_personRoles.push_back(initPersonRoleFromConf(*i));
@@ -305,7 +302,7 @@ Portal *MapMgr::initPortalFromConf(const ConfigElement &portalConf) {
portal->_exitPortal = portalConf.getBool("exits");
- vector<ConfigElement> children = portalConf.getChildren();
+ Std::vector<ConfigElement> children = portalConf.getChildren();
for (Std::vector<ConfigElement>::iterator i = children.begin(); i != children.end(); i++) {
if (i->getName() == "retroActiveDest") {
portal->_retroActiveDest = new PortalDestination();
diff --git a/engines/ultima/ultima4/map/tileanim.cpp b/engines/ultima/ultima4/map/tileanim.cpp
index 4cacae291d..1fc24302ce 100644
--- a/engines/ultima/ultima4/map/tileanim.cpp
+++ b/engines/ultima/ultima4/map/tileanim.cpp
@@ -32,9 +32,6 @@
namespace Ultima {
namespace Ultima4 {
-using Common::String;
-using Std::vector;
-
TileAnimTransform *TileAnimTransform::create(const ConfigElement &conf) {
TileAnimTransform *transform;
static const char *transformTypeEnumStrings[] = { "invert", "pixel", "scroll", "frame", "pixel_color", nullptr };
@@ -52,7 +49,7 @@ TileAnimTransform *TileAnimTransform::create(const ConfigElement &conf) {
transform = new TileAnimPixelTransform(
conf.getInt("x"), conf.getInt("y"));
- vector<ConfigElement> children = conf.getChildren();
+ Std::vector<ConfigElement> children = conf.getChildren();
for (Std::vector<ConfigElement>::iterator i = children.begin(); i != children.end(); i++) {
if (i->getName() == "color") {
RGBA *rgba = loadColorFromConf(*i);
@@ -75,7 +72,7 @@ TileAnimTransform *TileAnimTransform::create(const ConfigElement &conf) {
conf.getInt("x"), conf.getInt("y"),
conf.getInt("width"), conf.getInt("height"));
- vector<ConfigElement> children = conf.getChildren();
+ Std::vector<ConfigElement> children = conf.getChildren();
for (Std::vector<ConfigElement>::iterator i = children.begin(); i != children.end(); i++) {
if (i->getName() == "color") {
RGBA *rgba = loadColorFromConf(*i);
@@ -237,7 +234,7 @@ TileAnimContext *TileAnimContext::create(const ConfigElement &conf) {
// Add the transforms to the context
if (context) {
- vector<ConfigElement> children = conf.getChildren();
+ Std::vector<ConfigElement> children = conf.getChildren();
for (Std::vector<ConfigElement>::iterator i = children.begin(); i != children.end(); i++) {
if (i->getName() == "transform") {
@@ -271,7 +268,7 @@ bool TileAnimPlayerDirContext::isInContext(Tile *t, MapTile &mapTile, Direction
TileAnimSet::TileAnimSet(const ConfigElement &conf) {
_name = conf.getString("name");
- vector<ConfigElement> children = conf.getChildren();
+ Std::vector<ConfigElement> children = conf.getChildren();
for (Std::vector<ConfigElement>::iterator i = children.begin(); i != children.end(); i++) {
if (i->getName() == "tileanim") {
TileAnim *anim = new TileAnim(*i);
@@ -292,7 +289,7 @@ TileAnim::TileAnim(const ConfigElement &conf) : _random(0) {
if (conf.exists("random"))
_random = conf.getInt("random");
- vector<ConfigElement> children = conf.getChildren();
+ Std::vector<ConfigElement> children = conf.getChildren();
for (Std::vector<ConfigElement>::iterator i = children.begin(); i != children.end(); i++) {
if (i->getName() == "transform") {
TileAnimTransform *transform = TileAnimTransform::create(*i);
diff --git a/engines/ultima/ultima4/sound/sound.cpp b/engines/ultima/ultima4/sound/sound.cpp
index 76d79c5dff..c0f5a69c3d 100644
--- a/engines/ultima/ultima4/sound/sound.cpp
+++ b/engines/ultima/ultima4/sound/sound.cpp
@@ -31,9 +31,6 @@
namespace Ultima {
namespace Ultima4 {
-using Common::String;
-using Std::vector;
-
int soundInit(void) {
return SoundManager::getInstance()->init();
}
@@ -74,9 +71,9 @@ int SoundManager::init() {
_soundFilenames.reserve(SOUND_MAX);
_soundChunk.resize(SOUND_MAX);
- vector<ConfigElement> soundConfs = config->getElement("sound").getChildren();
- vector<ConfigElement>::const_iterator i = soundConfs.begin();
- vector<ConfigElement>::const_iterator theEnd = soundConfs.end();
+ Std::vector<ConfigElement> soundConfs = config->getElement("sound").getChildren();
+ Std::vector<ConfigElement>::const_iterator i = soundConfs.begin();
+ Std::vector<ConfigElement>::const_iterator theEnd = soundConfs.end();
for (; i != theEnd; ++i) {
if (i->getName() != "track")
continue;
Commit: 58aee69829654e638a8314ca1041130ac83ae56c
https://github.com/scummvm/scummvm/commit/58aee69829654e638a8314ca1041130ac83ae56c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-04-28T21:11:21-07:00
Commit Message:
ULTIMA4: Refactor out MapCoords nowhere static
Changed paths:
engines/ultima/ultima4/core/debugger.cpp
engines/ultima/ultima4/map/map.cpp
engines/ultima/ultima4/map/map.h
diff --git a/engines/ultima/ultima4/core/debugger.cpp b/engines/ultima/ultima4/core/debugger.cpp
index 12f28de3ff..a629bd616c 100644
--- a/engines/ultima/ultima4/core/debugger.cpp
+++ b/engines/ultima/ultima4/core/debugger.cpp
@@ -1346,7 +1346,7 @@ bool Debugger::cmdGoto(int argc, const char **argv) {
if (!found) {
MapCoords coords = g_context->_location->_map->getLabel(dest);
- if (coords != MapCoords::nowhere) {
+ if (coords != MapCoords::nowhere()) {
print("%s", dest.c_str());
g_context->_location->_coords = coords;
found = true;
diff --git a/engines/ultima/ultima4/map/map.cpp b/engines/ultima/ultima4/map/map.cpp
index 27c47fe8d6..af89855c07 100644
--- a/engines/ultima/ultima4/map/map.cpp
+++ b/engines/ultima/ultima4/map/map.cpp
@@ -41,11 +41,6 @@
namespace Ultima {
namespace Ultima4 {
-/**
- * MapCoords Class Implementation
- */
-MapCoords MapCoords::nowhere(-1, -1, -1);
-
bool MapCoords::operator==(const MapCoords &a) const {
return (x == a.x) && (y == a.y) && (z == a.z);
}
@@ -681,10 +676,11 @@ void Map::alertGuards() {
}
}
-const MapCoords &Map::getLabel(const Common::String &name) const {
+MapCoords Map::getLabel(const Common::String &name) const {
Std::map<Common::String, MapCoords>::const_iterator i = _labels.find(name);
if (i == _labels.end())
- return MapCoords::nowhere;
+ return MapCoords::nowhere();
+
return i->_value;
}
diff --git a/engines/ultima/ultima4/map/map.h b/engines/ultima/ultima4/map/map.h
index 00f83eac80..82c4ccd3e9 100644
--- a/engines/ultima/ultima4/map/map.h
+++ b/engines/ultima/ultima4/map/map.h
@@ -122,7 +122,12 @@ public:
*/
int distance(const MapCoords &c, const class Map *map = nullptr) const;
- static MapCoords nowhere;
+ /**
+ * Returns true if the co-ordinates point to nowhere
+ */
+ static MapCoords nowhere() {
+ return MapCoords(-1, -1, -1);
+ }
};
/**
@@ -250,7 +255,7 @@ public:
* Alerts the guards that the avatar is doing something bad
*/
void alertGuards();
- const MapCoords &getLabel(const Common::String &name) const;
+ MapCoords getLabel(const Common::String &name) const;
// u4dos compatibility
bool fillMonsterTable();
More information about the Scummvm-git-logs
mailing list