mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-04 01:07:22 +00:00
LAB: Make string check more readable, remove a useless c_str()
This commit is contained in:
parent
2eeb027604
commit
fa222f0ca8
@ -231,7 +231,7 @@ void DisplayMan::createBox(uint16 y2) {
|
||||
}
|
||||
|
||||
int DisplayMan::longDrawMessage(Common::String str) {
|
||||
if (!str.size())
|
||||
if (str.empty())
|
||||
return 0;
|
||||
|
||||
_vm->_event->attachButtonList(nullptr);
|
||||
@ -256,22 +256,23 @@ void DisplayMan::drawMessage(Common::String str) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (str.size()) {
|
||||
if ((textLength(_vm->_msgFont, str) > _vm->_utils->vgaScaleX(306))) {
|
||||
longDrawMessage(str);
|
||||
_lastMessageLong = true;
|
||||
} else {
|
||||
if (_longWinInFront) {
|
||||
_longWinInFront = false;
|
||||
drawPanel();
|
||||
}
|
||||
if (str.empty())
|
||||
return;
|
||||
|
||||
_vm->_event->mouseHide();
|
||||
createBox(168);
|
||||
drawText(_vm->_msgFont, _vm->_utils->vgaScaleX(7), _vm->_utils->vgaScaleY(155) + _vm->_utils->svgaCord(2), 1, str);
|
||||
_vm->_event->mouseShow();
|
||||
_lastMessageLong = false;
|
||||
if ((textLength(_vm->_msgFont, str) > _vm->_utils->vgaScaleX(306))) {
|
||||
longDrawMessage(str);
|
||||
_lastMessageLong = true;
|
||||
} else {
|
||||
if (_longWinInFront) {
|
||||
_longWinInFront = false;
|
||||
drawPanel();
|
||||
}
|
||||
|
||||
_vm->_event->mouseHide();
|
||||
createBox(168);
|
||||
drawText(_vm->_msgFont, _vm->_utils->vgaScaleX(7), _vm->_utils->vgaScaleY(155) + _vm->_utils->svgaCord(2), 1, str);
|
||||
_vm->_event->mouseShow();
|
||||
_lastMessageLong = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -857,7 +858,7 @@ void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, const Common::String fi
|
||||
setPen(0);
|
||||
} // for j
|
||||
|
||||
if (!filename.size())
|
||||
if (filename.empty())
|
||||
_vm->_curFileName = _vm->getPictName(closePtrList);
|
||||
else if (filename[0] > ' ')
|
||||
_vm->_curFileName = filename;
|
||||
|
@ -127,7 +127,7 @@ void LabEngine::drawRoomMessage(uint16 curInv, CloseDataPtr closePtr) {
|
||||
}
|
||||
|
||||
if (_alternate) {
|
||||
if ((curInv <= _numInv) && _conditions->in(curInv) && _inventory[curInv]._bitmapName != "") {
|
||||
if ((curInv <= _numInv) && _conditions->in(curInv) && !_inventory[curInv]._bitmapName.empty()) {
|
||||
if ((curInv == kItemLamp) && _conditions->in(kCondLampOn))
|
||||
// LAB: Labyrinth specific
|
||||
drawStaticMessage(kTextkLampOn);
|
||||
@ -374,7 +374,7 @@ void LabEngine::decIncInv(uint16 *curInv, bool decreaseFl) {
|
||||
interfaceOff();
|
||||
|
||||
while (newInv && (newInv <= _numInv)) {
|
||||
if (_conditions->in(newInv) && _inventory[newInv]._bitmapName != "") {
|
||||
if (_conditions->in(newInv) && !_inventory[newInv]._bitmapName.empty()) {
|
||||
_nextFileName = getInvName(newInv);
|
||||
*curInv = newInv;
|
||||
break;
|
||||
@ -968,7 +968,7 @@ void LabEngine::processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonI
|
||||
curInv++;
|
||||
}
|
||||
|
||||
if ((curInv <= _numInv) && _conditions->in(curInv) && _inventory[curInv]._bitmapName != "")
|
||||
if ((curInv <= _numInv) && _conditions->in(curInv) && !_inventory[curInv]._bitmapName.empty())
|
||||
_nextFileName = getInvName(curInv);
|
||||
|
||||
break;
|
||||
@ -1066,7 +1066,7 @@ void LabEngine::performAction(uint16 actionMode, Common::Point curPos, uint16 &c
|
||||
if (_closeDataPtr == tmpClosePtr) {
|
||||
if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2)))
|
||||
drawStaticMessage(kTextNothing);
|
||||
} else if (tmpClosePtr->_graphicName != "") {
|
||||
} else if (!tmpClosePtr->_graphicName.empty()) {
|
||||
_anim->_doBlack = true;
|
||||
_closeDataPtr = tmpClosePtr;
|
||||
} else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2)))
|
||||
|
@ -212,7 +212,7 @@ Common::String LabEngine::generateSaveFileName(uint slot) {
|
||||
}
|
||||
|
||||
void LabEngine::drawStaticMessage(byte index) {
|
||||
_graphics->drawMessage(_resource->getStaticText((StaticText)index).c_str());
|
||||
_graphics->drawMessage(_resource->getStaticText((StaticText)index));
|
||||
}
|
||||
|
||||
void LabEngine::changeVolume(int delta) {
|
||||
|
@ -381,7 +381,7 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fad
|
||||
_graphics->flowText(_msgFont, 0, 5, 3, true, true, true, true, _utils->vgaRectScale(14, 75, 134, 97), textPrt);
|
||||
}
|
||||
|
||||
if (_rooms[curMsg]._roomMsg != "")
|
||||
if (!_rooms[curMsg]._roomMsg.empty())
|
||||
_graphics->flowText(_msgFont, 0, 5, 3, true, true, true, true, _utils->vgaRectScale(14, 148, 134, 186), _rooms[curMsg]._roomMsg.c_str());
|
||||
|
||||
if (fadeIn)
|
||||
@ -509,7 +509,7 @@ void LabEngine::processMap(uint16 curRoom) {
|
||||
}
|
||||
|
||||
if (oldMsg != curMsg) {
|
||||
if (_rooms[curMsg]._roomMsg != "")
|
||||
if (!_rooms[curMsg]._roomMsg.empty())
|
||||
_resource->readViews(curMsg);
|
||||
|
||||
const char *sptr;
|
||||
|
@ -63,7 +63,7 @@ bool LabEngine::checkConditions(int16 *condition) {
|
||||
}
|
||||
|
||||
ViewData *LabEngine::getViewData(uint16 roomNum, uint16 direction) {
|
||||
if (_rooms[roomNum]._roomMsg == "")
|
||||
if (!_rooms[roomNum]._roomMsg.empty())
|
||||
_resource->readViews(roomNum);
|
||||
|
||||
ViewData *view = _rooms[roomNum]._view[direction];
|
||||
@ -131,17 +131,15 @@ Common::String LabEngine::getPictName(CloseDataPtr *closePtrList) {
|
||||
}
|
||||
|
||||
void LabEngine::drawDirection(CloseDataPtr closePtr) {
|
||||
if (closePtr && closePtr->_message != "") {
|
||||
_graphics->drawMessage(closePtr->_message.c_str());
|
||||
if (closePtr && !closePtr->_message.empty()) {
|
||||
_graphics->drawMessage(closePtr->_message);
|
||||
return;
|
||||
}
|
||||
|
||||
Common::String message;
|
||||
|
||||
if (_rooms[_roomNum]._roomMsg != "") {
|
||||
message = Common::String(_rooms[_roomNum]._roomMsg).c_str();
|
||||
message += ", ";
|
||||
}
|
||||
if (!_rooms[_roomNum]._roomMsg.empty())
|
||||
message = _rooms[_roomNum]._roomMsg + ", ";
|
||||
|
||||
if (_direction == NORTH)
|
||||
message += _resource->getStaticText(kTextFacingNorth);
|
||||
@ -152,7 +150,7 @@ void LabEngine::drawDirection(CloseDataPtr closePtr) {
|
||||
else if (_direction == WEST)
|
||||
message += _resource->getStaticText(kTextFacingWest);
|
||||
|
||||
_graphics->drawMessage(message.c_str());
|
||||
_graphics->drawMessage(message);
|
||||
}
|
||||
|
||||
uint16 LabEngine::processArrow(uint16 curDirection, uint16 arrow) {
|
||||
@ -201,7 +199,7 @@ void LabEngine::setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, b
|
||||
else
|
||||
target = _utils->rectScale(closePtr->_x1, closePtr->_y1, closePtr->_x2, closePtr->_y2);
|
||||
|
||||
if (target.contains(pos) && closePtr->_graphicName != "") {
|
||||
if (target.contains(pos) && !closePtr->_graphicName.empty()) {
|
||||
*closePtrList = closePtr;
|
||||
return;
|
||||
}
|
||||
@ -267,7 +265,7 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) {
|
||||
break;
|
||||
|
||||
case LOADDIFF:
|
||||
if (actionList->_messages[0].size())
|
||||
if (!actionList->_messages[0].empty())
|
||||
// Puts a file into memory
|
||||
_graphics->loadPict(actionList->_messages[0]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user