mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
MUTATIONOFJB: Change old-style C casts to static_cast.
This commit is contained in:
parent
959f37dfe4
commit
cf878d8777
@ -317,13 +317,13 @@ Common::String ChangeCommand::getValueAsString() const {
|
||||
case PF:
|
||||
case PL:
|
||||
case PD:
|
||||
return Common::String::format("%d", (int)_value._byteVal);
|
||||
return Common::String::format("%d", static_cast<int>(_value._byteVal));
|
||||
case SX:
|
||||
case SY:
|
||||
case XX:
|
||||
case XL:
|
||||
case WX:
|
||||
return Common::String::format("%d", (int)_value._wordVal);
|
||||
return Common::String::format("%d", static_cast<int>(_value._wordVal));
|
||||
default:
|
||||
return "(unknown)";
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ Command::ExecuteResult TalkCommand::execute(ScriptExecutionContext &scriptExeCtx
|
||||
|
||||
Common::String TalkCommand::debugString() const {
|
||||
const char *modes[] = {"NORMAL", "RAY_AND_BUTTLEG", "CARNIVAL_TICKET_SELLER"};
|
||||
return Common::String::format("TALK %s", modes[(int) _mode]);
|
||||
return Common::String::format("TALK %s", modes[static_cast<int>(_mode)]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ bool Console::cmd_showstartup(int argc, const char **argv) {
|
||||
Script *const script = getScriptFromArg(argv[1]);
|
||||
if (script) {
|
||||
const Startups &startups = script->getStartups();
|
||||
Startups::const_iterator itMacro = startups.find((uint8) atoi(argv[2]));
|
||||
Startups::const_iterator itMacro = startups.find(static_cast<uint8>(atoi(argv[2])));
|
||||
if (itMacro != startups.end()) {
|
||||
if (itMacro->_value) {
|
||||
showCommands(itMacro->_value);
|
||||
|
@ -33,7 +33,7 @@ static bool readString(Common::ReadStream &stream, char *str) {
|
||||
uint8 len = stream.readByte();
|
||||
stream.read(buf, MAX_ENTITY_NAME_LENGTH);
|
||||
|
||||
len = MIN(len, (uint8) MAX_ENTITY_NAME_LENGTH);
|
||||
len = MIN(len, static_cast<uint8>(MAX_ENTITY_NAME_LENGTH));
|
||||
memcpy(str, buf, len);
|
||||
|
||||
return true;
|
||||
@ -110,19 +110,19 @@ bool Scene::loadFromStream(Common::ReadStream &stream) {
|
||||
_delay = stream.readByte();
|
||||
|
||||
_noDoors = stream.readByte();
|
||||
_noDoors = MIN(_noDoors, (uint8) ARRAYSIZE(_doors));
|
||||
_noDoors = MIN(_noDoors, static_cast<uint8>(ARRAYSIZE(_doors)));
|
||||
for (i = 0; i < ARRAYSIZE(_doors); ++i) {
|
||||
_doors[i].loadFromStream(stream);
|
||||
}
|
||||
|
||||
_noObjects = stream.readByte();
|
||||
_noObjects = MIN(_noObjects, (uint8) ARRAYSIZE(_objects));
|
||||
_noObjects = MIN(_noObjects, static_cast<uint8>(ARRAYSIZE(_objects)));
|
||||
for (i = 0; i < ARRAYSIZE(_objects); ++i) {
|
||||
_objects[i].loadFromStream(stream);
|
||||
}
|
||||
|
||||
_noStatics = stream.readByte();
|
||||
_noStatics = MIN(_noStatics, (uint8) ARRAYSIZE(_statics));
|
||||
_noStatics = MIN(_noStatics, static_cast<uint8>(ARRAYSIZE(_statics)));
|
||||
for (i = 0; i < ARRAYSIZE(_statics); ++i) {
|
||||
_statics[i].loadFromStream(stream);
|
||||
}
|
||||
@ -163,7 +163,7 @@ Object *Scene::getObject(uint8 objectId, bool ignoreNo) {
|
||||
}
|
||||
|
||||
Static *Scene::getStatic(uint8 staticId, bool ignoreNo) {
|
||||
if (staticId == 0 || staticId > (!ignoreNo ? MIN(_noStatics, (uint8) ARRAYSIZE(_statics)) : ARRAYSIZE(_statics))) {
|
||||
if (staticId == 0 || staticId > (!ignoreNo ? MIN(_noStatics, static_cast<uint8>(ARRAYSIZE(_statics))) : ARRAYSIZE(_statics))) {
|
||||
warning("Static %d does not exist", staticId);
|
||||
return nullptr;
|
||||
}
|
||||
@ -172,15 +172,15 @@ Static *Scene::getStatic(uint8 staticId, bool ignoreNo) {
|
||||
}
|
||||
|
||||
uint8 Scene::getNoDoors(bool ignoreNo) const {
|
||||
return (!ignoreNo ? MIN(_noDoors, (uint8) ARRAYSIZE(_doors)) : ARRAYSIZE(_doors));
|
||||
return (!ignoreNo ? MIN(_noDoors, static_cast<uint8>(ARRAYSIZE(_doors))) : ARRAYSIZE(_doors));
|
||||
}
|
||||
|
||||
uint8 Scene::getNoObjects(bool ignoreNo) const {
|
||||
return (!ignoreNo ? MIN(_noObjects, (uint8) ARRAYSIZE(_objects)) : ARRAYSIZE(_objects));
|
||||
return (!ignoreNo ? MIN(_noObjects, static_cast<uint8>(ARRAYSIZE(_objects))) : ARRAYSIZE(_objects));
|
||||
}
|
||||
|
||||
uint8 Scene::getNoStatics(bool ignoreNo) const {
|
||||
return (!ignoreNo ? MIN(_noStatics, (uint8) ARRAYSIZE(_statics)) : ARRAYSIZE(_statics));
|
||||
return (!ignoreNo ? MIN(_noStatics, static_cast<uint8>(ARRAYSIZE(_statics))) : ARRAYSIZE(_statics));
|
||||
}
|
||||
|
||||
Door *Scene::findDoor(int16 x, int16 y, int *index) {
|
||||
|
@ -132,7 +132,7 @@ void ConversationTask::showChoicesOrPick() {
|
||||
for (ConversationInfo::ItemGroup::size_type i = 0; i < currentGroup.size(); ++i) {
|
||||
const ConversationInfo::Item &item = currentGroup[i];
|
||||
|
||||
if (scene->isConvItemExhausted(_convInfo._context, (uint8) i + 1, (uint8) _currentGroupIndex + 1)) {
|
||||
if (scene->isConvItemExhausted(_convInfo._context, static_cast<uint8>(i + 1), static_cast<uint8>(_currentGroupIndex + 1))) {
|
||||
continue;
|
||||
}
|
||||
const uint8 toSay = item._question;
|
||||
@ -160,7 +160,7 @@ void ConversationTask::showChoicesOrPick() {
|
||||
const ConversationInfo::Item &item = currentGroup[itemsWithValidQuestions[i]];
|
||||
const ConversationLineList::Line *const line = toSayList.getLine(item._question);
|
||||
const Common::String widgetText = toUpperCP895(line->_speeches[0]._text);
|
||||
widget.setChoice((int) i, widgetText, itemsWithValidQuestions[i]);
|
||||
widget.setChoice(static_cast<int>(i), widgetText, itemsWithValidQuestions[i]);
|
||||
}
|
||||
_substate = IDLE;
|
||||
_currentItem = nullptr;
|
||||
|
@ -67,7 +67,7 @@ void InventoryWidget::draw(Graphics::ManagedSurface &surface) {
|
||||
Inventory &inventory = _gui.getGame().getGameData().getInventory();
|
||||
const Inventory::Items &items = inventory.getItems();
|
||||
surface.fillRect(_area, 0x00);
|
||||
for (int i = 0; i < MIN((int) items.size(), (int) Inventory::VISIBLE_ITEMS); ++i) {
|
||||
for (Inventory::Items::size_type i = 0; i < MIN<Inventory::Items::size_type>(items.size(), Inventory::VISIBLE_ITEMS); ++i) {
|
||||
drawInventoryItem(surface, items[i], i);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user