aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2015-12-20 17:21:55 +0100
committerWillem Jan Palenstijn2015-12-23 21:35:32 +0100
commitb53735ba064012b3c981d5ef497d5f8c2e974291 (patch)
tree256e3ae0afde08b4cd19bf1e62eeb3b93144c4ab
parent2edd0c51425db5e4407d38dbbeea788173f383b5 (diff)
downloadscummvm-rg350-b53735ba064012b3c981d5ef497d5f8c2e974291.tar.gz
scummvm-rg350-b53735ba064012b3c981d5ef497d5f8c2e974291.tar.bz2
scummvm-rg350-b53735ba064012b3c981d5ef497d5f8c2e974291.zip
LAB: Constify some parameters
-rw-r--r--engines/lab/dispman.cpp15
-rw-r--r--engines/lab/dispman.h12
-rw-r--r--engines/lab/lab.h4
-rw-r--r--engines/lab/resource.cpp25
-rw-r--r--engines/lab/resource.h2
-rw-r--r--engines/lab/savegame.cpp2
-rw-r--r--engines/lab/special.cpp2
7 files changed, 30 insertions, 32 deletions
diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp
index 9dbaf8d374..d493e935c5 100644
--- a/engines/lab/dispman.cpp
+++ b/engines/lab/dispman.cpp
@@ -69,7 +69,6 @@ DisplayMan::~DisplayMan() {
delete[] _displayBuffer;
}
-// From readPict.c. Reads in pictures and animations from disk.
void DisplayMan::loadPict(const Common::String filename) {
freePict();
_curBitmap = _vm->_resource->openDataFile(filename);
@@ -89,11 +88,9 @@ void DisplayMan::loadBackPict(const Common::String fileName, uint16 *highPal) {
_vm->_anim->_noPalChange = false;
}
-void DisplayMan::readPict(Common::String filename, bool playOnce, bool onlyDiffData, byte *memoryBuffer, uint16 maxHeight) {
+void DisplayMan::readPict(const Common::String filename, bool playOnce, bool onlyDiffData, byte *memoryBuffer, uint16 maxHeight) {
_vm->_anim->stopDiff();
-
loadPict(filename);
-
_vm->_music->updateMusic();
if (!_vm->_music->_loopSoundEffect)
@@ -544,7 +541,7 @@ void DisplayMan::closeFont(TextFont **font) {
}
}
-uint16 DisplayMan::textLength(TextFont *font, Common::String text) {
+uint16 DisplayMan::textLength(TextFont *font, const Common::String text) {
uint16 length = 0;
if (font) {
@@ -561,7 +558,7 @@ uint16 DisplayMan::textHeight(TextFont *tf) {
return (tf) ? tf->_height : 0;
}
-void DisplayMan::drawText(TextFont *tf, uint16 x, uint16 y, uint16 color, Common::String text) {
+void DisplayMan::drawText(TextFont *tf, uint16 x, uint16 y, uint16 color, const Common::String text) {
byte *vgaTop = getCurrentDrawingBuffer();
int numChars = text.size();
@@ -730,7 +727,7 @@ void DisplayMan::copyPage(uint16 width, uint16 height, uint16 nheight, uint16 st
}
}
-void DisplayMan::doScrollWipe(Common::String filename) {
+void DisplayMan::doScrollWipe(const Common::String filename) {
_vm->_event->mouseHide();
uint16 width = _vm->_utils->vgaScaleX(320);
uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2);
@@ -824,7 +821,7 @@ void DisplayMan::doScrollBounce() {
_vm->_event->mouseShow();
}
-void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, Common::String filename) {
+void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, const Common::String filename) {
uint16 lastY, linesLast;
if (_vm->_isHiRes) {
@@ -911,7 +908,7 @@ void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, Common::String filename
delete[] bitMapBuffer;
}
-void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *closePtrList, Common::String filename) {
+void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *closePtrList, const Common::String filename) {
switch (transitionType) {
case kTransitionWipe:
case kTransitionTransporter:
diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h
index 1ca58874ca..a88923ee4c 100644
--- a/engines/lab/dispman.h
+++ b/engines/lab/dispman.h
@@ -85,7 +85,7 @@ public:
/**
* Reads in a picture into the display bitmap.
*/
- void readPict(Common::String filename, bool playOnce = true, bool onlyDiffData = false, byte *memoryBuffer = nullptr, uint16 maxHeight = 0);
+ void readPict(const Common::String filename, bool playOnce = true, bool onlyDiffData = false, byte *memoryBuffer = nullptr, uint16 maxHeight = 0);
void freePict();
/**
@@ -97,7 +97,7 @@ public:
/**
* Scrolls the display to a new picture from a black screen.
*/
- void doScrollWipe(Common::String filename);
+ void doScrollWipe(const Common::String filename);
/**
* Does the scroll bounce. Assumes bitmap already in memory.
@@ -107,12 +107,12 @@ public:
/**
* Does the transporter wipe.
*/
- void doTransWipe(CloseDataPtr *closePtrList, Common::String filename);
+ void doTransWipe(CloseDataPtr *closePtrList, const Common::String filename);
/**
* Does a certain number of pre-programmed wipes.
*/
- void doTransition(TransitionType transitionType, CloseDataPtr *closePtrList, Common::String filename);
+ void doTransition(TransitionType transitionType, CloseDataPtr *closePtrList, const Common::String filename);
/**
* Changes the front screen to black.
@@ -259,7 +259,7 @@ public:
/**
* Returns the length of a text in the specified font.
*/
- uint16 textLength(TextFont *font, Common::String text);
+ uint16 textLength(TextFont *font, const Common::String text);
/**
* Returns the height of a specified font.
@@ -269,7 +269,7 @@ public:
/**
* Draws the text to the screen.
*/
- void drawText(TextFont *tf, uint16 x, uint16 y, uint16 color, Common::String text);
+ void drawText(TextFont *tf, uint16 x, uint16 y, uint16 color, const Common::String text);
/**
* Gets a line of text for flowText; makes sure that its length is less than
diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index 295d913d3f..74fbd2a8ae 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -252,7 +252,7 @@ private:
/**
* Does what's necessary for the monitor.
*/
- void doMonitor(Common::String background, Common::String textfile, bool isinteractive, Common::Rect textRect);
+ void doMonitor(const Common::String background, const Common::String textfile, bool isinteractive, Common::Rect textRect);
/**
* Does the things to properly set up the detective notes.
@@ -454,7 +454,7 @@ private:
void performAction(uint16 actionMode, Common::Point curPos, uint16 &curInv);
private:
- bool saveGame(int slot, Common::String desc);
+ bool saveGame(int slot, const Common::String desc);
bool loadGame(int slot);
void writeSaveGameHeader(Common::OutSaveFile *out, const Common::String &saveName);
};
diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp
index a9d8441984..b5ecb0b2bc 100644
--- a/engines/lab/resource.cpp
+++ b/engines/lab/resource.cpp
@@ -164,43 +164,44 @@ void Resource::freeViews(uint16 roomNum) {
freeRule(_vm->_rooms[roomNum]._rules);
}
-Common::String Resource::translateFileName(Common::String filename) {
- filename.toUppercase();
+Common::String Resource::translateFileName(const Common::String filename) {
+ Common::String upperFilename = filename;
+ upperFilename.toUppercase();
Common::String fileNameStrFinal;
- if (filename.hasPrefix("P:") || filename.hasPrefix("F:")) {
+ if (upperFilename.hasPrefix("P:") || upperFilename.hasPrefix("F:")) {
if (_vm->_isHiRes)
fileNameStrFinal = "GAME/SPICT/";
else
fileNameStrFinal = "GAME/PICT/";
if (_vm->getPlatform() == Common::kPlatformAmiga) {
- if (filename.hasPrefix("P:")) {
+ if (upperFilename.hasPrefix("P:")) {
fileNameStrFinal = "PICT/";
} else {
fileNameStrFinal = "LABFONTS/";
- filename += "T"; // all the Amiga fonts have a ".FONT" suffix
+ upperFilename += "T"; // all the Amiga fonts have a ".FONT" suffix
}
}
- } else if (filename.hasPrefix("LAB:")) {
+ } else if (upperFilename.hasPrefix("LAB:")) {
if (_vm->getPlatform() != Common::kPlatformAmiga)
fileNameStrFinal = "GAME/";
- } else if (filename.hasPrefix("MUSIC:")) {
+ } else if (upperFilename.hasPrefix("MUSIC:")) {
if (_vm->getPlatform() != Common::kPlatformAmiga)
fileNameStrFinal = "GAME/MUSIC/";
else
fileNameStrFinal = "MUSIC/";
}
- if (filename.contains(':')) {
- while (filename[0] != ':') {
- filename.deleteChar(0);
+ if (upperFilename.contains(':')) {
+ while (upperFilename[0] != ':') {
+ upperFilename.deleteChar(0);
}
- filename.deleteChar(0);
+ upperFilename.deleteChar(0);
}
- fileNameStrFinal += filename;
+ fileNameStrFinal += upperFilename;
return fileNameStrFinal;
}
diff --git a/engines/lab/resource.h b/engines/lab/resource.h
index f4aa35738e..73757e8247 100644
--- a/engines/lab/resource.h
+++ b/engines/lab/resource.h
@@ -119,7 +119,7 @@ private:
ViewData *readView(Common::File *file);
void freeView(ViewData *view);
void readStaticText();
- Common::String translateFileName(Common::String filename);
+ Common::String translateFileName(const Common::String filename);
Common::String _staticText[48];
};
diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp
index 2ea481d3c2..a0d7fe9667 100644
--- a/engines/lab/savegame.cpp
+++ b/engines/lab/savegame.cpp
@@ -122,7 +122,7 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) {
/**
* Writes the game out to disk.
*/
-bool LabEngine::saveGame(int slot, Common::String desc) {
+bool LabEngine::saveGame(int slot, const Common::String desc) {
Common::String fileName = generateSaveFileName(slot);
Common::SaveFileManager *saveFileManager = g_system->getSavefileManager();
Common::OutSaveFile *file = saveFileManager->openForSaving(fileName);
diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp
index ddc7ea49e4..946277b8f0 100644
--- a/engines/lab/special.cpp
+++ b/engines/lab/special.cpp
@@ -443,7 +443,7 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isIntera
}
}
-void LabEngine::doMonitor(Common::String background, Common::String textfile, bool isinteractive, Common::Rect textRect) {
+void LabEngine::doMonitor(const Common::String background, const Common::String textfile, bool isinteractive, Common::Rect textRect) {
Common::Rect scaledRect = _utils->vgaRectScale(textRect.left, textRect.top, textRect.right, textRect.bottom);
_monitorTextFilename = textfile;