From 8a88ad861d68bd4c5a1a932d9da2518569ecc4ff Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 May 2012 00:43:02 +1000 Subject: TONY: Converted object passing to use const reference where appropriate. This should cut down on the number of redunndant creations of temporary objects. --- engines/tony/font.cpp | 14 +++++++------- engines/tony/font.h | 18 +++++++++--------- engines/tony/game.cpp | 10 +++++----- engines/tony/game.h | 10 +++++----- engines/tony/gfxengine.cpp | 2 +- engines/tony/gfxengine.h | 2 +- engines/tony/inventory.cpp | 18 +++++++++--------- engines/tony/inventory.h | 18 +++++++++--------- engines/tony/loc.cpp | 28 ++++++++++++++-------------- engines/tony/loc.h | 30 +++++++++++++++--------------- engines/tony/tonychar.h | 2 +- engines/tony/utils.cpp | 10 +++++----- engines/tony/utils.h | 12 ++++++------ engines/tony/window.cpp | 1 - 14 files changed, 87 insertions(+), 88 deletions(-) diff --git a/engines/tony/font.cpp b/engines/tony/font.cpp index 5712014bf2..2f8c0c5065 100644 --- a/engines/tony/font.cpp +++ b/engines/tony/font.cpp @@ -171,7 +171,7 @@ void RMFont::Close(void) { Unload(); } -int RMFont::StringLen(RMString text) { +int RMFont::StringLen(const RMString &text) { int len, i; len = 0; @@ -1859,7 +1859,7 @@ void RMText::RemoveThis(CORO_PARAM, bool &result) { } -void RMText::WriteText(RMString text, int nFont, int *time) { +void RMText::WriteText(const RMString &text, int nFont, int *time) { // Inizializza i font (una volta sola) if (m_fonts[0] == NULL) { m_fonts[0] = new RMFontParla; m_fonts[0]->Init(); @@ -1876,7 +1876,7 @@ void RMText::WriteText(RMString text, int nFont, int *time) { } -void RMText::WriteText(RMString text, RMFontColor *font, int *time) { +void RMText::WriteText(const RMString &text, RMFontColor *font, int *time) { RMGfxPrimitive *prim; char *p, *old_p; int i, j, x, y; @@ -2077,14 +2077,14 @@ void RMTextDialog::Hide(CORO_PARAM) { m_bShowed = false; } -void RMTextDialog::WriteText(RMString text, int font, int *time) { +void RMTextDialog::WriteText(const RMString &text, int font, int *time) { RMText::WriteText(text,font,&m_time); if (time != NULL) *time = m_time; } -void RMTextDialog::WriteText(RMString text, RMFontColor *font, int *time) { +void RMTextDialog::WriteText(const RMString &text, RMFontColor *font, int *time) { RMText::WriteText(text,font,&m_time); if (time != NULL) @@ -2434,10 +2434,10 @@ void RMDialogChoice::SetNumChoices(int num) { } } -void RMDialogChoice::AddChoice(RMString string) { +void RMDialogChoice::AddChoice(const RMString &string) { // Si disegna la stringa assert(m_curAdded < m_numChoices); - m_drawedStrings[m_curAdded++].WriteText(string,0); + m_drawedStrings[m_curAdded++].WriteText(string, 0); } void RMDialogChoice::Prepare(CORO_PARAM) { diff --git a/engines/tony/font.h b/engines/tony/font.h index 7c766e5d01..a63c90638d 100644 --- a/engines/tony/font.h +++ b/engines/tony/font.h @@ -118,8 +118,8 @@ public: RMGfxPrimitive *MakeLetterPrimitive(byte bChar, int& nLength); // Lunghezza in pixel di una stringa con il font corrente - int StringLen(RMString text); - int StringLen(char bChar, char bNext=0); + int StringLen(const RMString &text); + int StringLen(char bChar, char bNext = 0); }; @@ -225,8 +225,8 @@ public: void SetMaxLineLength(int max); // Scrive un testo - void WriteText(RMString text, int font, int *time = NULL); - void WriteText(RMString text, RMFontColor* font, int *time = NULL); + void WriteText(const RMString &text, int font, int *time = NULL); + void WriteText(const RMString &text, RMFontColor *font, int *time = NULL); // Overloading della funzione ereditata da RMGfxTask per decidere // quando eliminare un oggetto dalla OTLIST @@ -263,8 +263,8 @@ class RMTextDialog : public RMText { virtual ~RMTextDialog(); // Scrive un testo - void WriteText(RMString text, int font, int *time=NULL); - void WriteText(RMString text, RMFontColor* font, int *time=NULL); + void WriteText(const RMString &text, int font, int *time = NULL); + void WriteText(const RMString &text, RMFontColor *font, int *time = NULL); // Overloading della funzione ereditata da RMGfxTask per decidere // quando eliminare un oggetto dalla OTLIST @@ -278,7 +278,7 @@ class RMTextDialog : public RMText { virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); // Setta la posizione - void SetPosition(RMPoint pt) { dst=pt; } + void SetPosition(const RMPoint &pt) { dst = pt; } // Aspetta che venga finita la visualizzazione void WaitForEndDisplay(CORO_PARAM); @@ -331,7 +331,7 @@ public: RMTextItemName(); virtual ~RMTextItemName(); - void SetMouseCoord(RMPoint m) { m_mpos=m; } + void SetMouseCoord(const RMPoint &m) { m_mpos = m; } void DoFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv); virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); @@ -385,7 +385,7 @@ public: void SetNumChoices(int num); // Aggiunge una stringa con la scelta - void AddChoice(RMString string); + void AddChoice(const RMString &string); // Mostra e nasconde la scelta, con eventuali animazioni // NOTA: Se non viene passato parametro alla Show(), è obbligo del diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp index 7378826a71..d579ac34a3 100644 --- a/engines/tony/game.cpp +++ b/engines/tony/game.cpp @@ -180,7 +180,7 @@ RMOptionButton::RMOptionButton(uint32 dwRes, RMPoint pt, bool bDoubleState) { m_bDoubleState = bDoubleState; } -RMOptionButton::RMOptionButton(RMRect pt) { +RMOptionButton::RMOptionButton(const RMRect &pt) { m_rect = pt; m_bActive = false; m_bHasGfx = false; @@ -192,7 +192,7 @@ RMOptionButton::~RMOptionButton() { delete m_buf; } -bool RMOptionButton::DoFrame(RMPoint mousePos, bool bLeftClick, bool bRightClick) { +bool RMOptionButton::DoFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick) { if (!m_bDoubleState) { if (m_rect.PtInRect(mousePos)) { if (!m_bActive) { @@ -201,7 +201,7 @@ bool RMOptionButton::DoFrame(RMPoint mousePos, bool bLeftClick, bool bRightClick } } else { if (m_bActive) { - m_bActive=false; + m_bActive = false; return true; } } @@ -241,7 +241,7 @@ void RMOptionButton::AddToList(RMGfxTargetBuffer &bigBuf) { * Metodi di RMOptionSlide \****************************************************************************/ -RMOptionSlide::RMOptionSlide(RMPoint pt, int nRange, int nStartValue, int slideSize) { +RMOptionSlide::RMOptionSlide(const RMPoint &pt, int nRange, int nStartValue, int slideSize) { RMResRaw *raw; m_pos = pt; @@ -283,7 +283,7 @@ RMOptionSlide::~RMOptionSlide() { m_PushRight = NULL; } -bool RMOptionSlide::DoFrame(RMPoint mousePos, bool bLeftClick, bool bRightClick) { +bool RMOptionSlide::DoFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick) { bool bRefresh = false; // Doframe dei bottoni diff --git a/engines/tony/game.h b/engines/tony/game.h index 554279c13f..8cd64ec7d2 100644 --- a/engines/tony/game.h +++ b/engines/tony/game.h @@ -138,7 +138,7 @@ public: virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); // Sets the current co-ordinates - void SetCoord(RMPoint pt) { m_pos = pt; } + void SetCoord(const RMPoint &pt) { m_pos = pt; } // Overloading of the method to see if rising from the list virtual void RemoveThis(CORO_PARAM, bool &result); @@ -170,10 +170,10 @@ public: public: RMOptionButton(uint32 dwRes, RMPoint pt, bool bDoubleState = false); - RMOptionButton(RMRect pt); + RMOptionButton(const RMRect &pt); virtual ~RMOptionButton(); - bool DoFrame(RMPoint mousePos, bool bLeftClick, bool bRightClick); + bool DoFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick); virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); void AddToList(RMGfxTargetBuffer &bigBuf); bool IsActive() { return m_bActive; } @@ -195,10 +195,10 @@ private: int m_nStep; public: - RMOptionSlide(RMPoint pt, int m_nRange=100, int m_nStartValue=0, int slideSize=300); + RMOptionSlide(const RMPoint &pt, int m_nRange = 100, int m_nStartValue = 0, int slideSize = 300); virtual ~RMOptionSlide(); - bool DoFrame(RMPoint mousePos, bool bLeftClick, bool bRightClick); + bool DoFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick); virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); void AddToList(RMGfxTargetBuffer& bigBuf); diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index bbb6eb8f3e..1b09e00956 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -437,7 +437,7 @@ void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) { */ -void RMGfxEngine::SelectLocation(RMPoint ptTonyStart, RMPoint start) { +void RMGfxEngine::SelectLocation(const RMPoint &ptTonyStart, const RMPoint &start) { #if 0 OPENFILENAME ofn; char lpszFileName[512]; diff --git a/engines/tony/gfxengine.h b/engines/tony/gfxengine.h index 41255229b8..3f90d41ad7 100644 --- a/engines/tony/gfxengine.h +++ b/engines/tony/gfxengine.h @@ -150,7 +150,7 @@ public: void LoadState(CORO_PARAM, const char *fn); // Selects a location - void SelectLocation(RMPoint ptTonyStart=RMPoint(-1,-1), RMPoint start=RMPoint(-1,-1)); + void SelectLocation(const RMPoint &ptTonyStart = RMPoint(-1, -1), const RMPoint &start = RMPoint(-1,-1)); // Pauses sound void PauseSound(bool bPause); diff --git a/engines/tony/inventory.cpp b/engines/tony/inventory.cpp index b5c28506a9..b4eef0ac0d 100644 --- a/engines/tony/inventory.cpp +++ b/engines/tony/inventory.cpp @@ -83,7 +83,7 @@ RMInventory::~RMInventory() { g_system->deleteMutex(m_csModifyInterface); } -bool RMInventory::CheckPointInside(RMPoint &pt) { +bool RMInventory::CheckPointInside(const RMPoint &pt) { if (!bCfgInvUp) return pt.y > RM_SY - 70; else @@ -343,7 +343,7 @@ bool RMInventory::MiniActive(void) { return m_state == SELECTING; } -bool RMInventory::HaveFocus(RMPoint mpos) { +bool RMInventory::HaveFocus(const RMPoint &mpos) { // In fase di combine abbiamo il focus solo se siamo su una freccia (per poter scrollare) if (m_state == OPENED && m_bCombining && CheckPointInside(mpos) && (mpos.x < 64 || mpos.x > RM_SX - 64)) return true; @@ -363,7 +363,7 @@ void RMInventory::EndCombine(void) { m_bCombining = false; } -bool RMInventory::LeftClick(RMPoint mpos, int& nCombineObj) { +bool RMInventory::LeftClick(const RMPoint &mpos, int& nCombineObj) { int n; // Il click sinistro prende in mano un oggetto dell'inventario per utilizzarlo con lo sfondo @@ -427,7 +427,7 @@ bool RMInventory::LeftClick(RMPoint mpos, int& nCombineObj) { } -void RMInventory::RightClick(RMPoint mpos) { +void RMInventory::RightClick(const RMPoint &mpos) { int n; assert(CheckPointInside(mpos)); @@ -488,7 +488,7 @@ void RMInventory::RightClick(RMPoint mpos) { } } -bool RMInventory::RightRelease(RMPoint mpos, RMTonyAction& curAction) { +bool RMInventory::RightRelease(const RMPoint &mpos, RMTonyAction& curAction) { if (m_state == SELECTING) { m_state = OPENED; @@ -701,14 +701,14 @@ void RMInventory::DoFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo } -bool RMInventory::ItemInFocus(RMPoint mpt) { +bool RMInventory::ItemInFocus(const RMPoint &mpt) { if ((m_state == OPENED || m_state == OPENING) && CheckPointInside(mpt)) return true; else return false; } -RMItem *RMInventory::WhichItemIsIn(RMPoint mpt) { +RMItem *RMInventory::WhichItemIsIn(const RMPoint &mpt) { int n; if (m_state == OPENED) { @@ -847,7 +847,7 @@ void RMInterface::DoFrame(RMGfxTargetBuffer &bigBuf, RMPoint mousepos) { m_mpos = mousepos; } -void RMInterface::Clicked(RMPoint mousepos) { +void RMInterface::Clicked(const RMPoint &mousepos) { m_bActive = true; m_openPos = mousepos; @@ -865,7 +865,7 @@ void RMInterface::Clicked(RMPoint mousepos) { _vm->PlayUtilSFX(0); } -bool RMInterface::Released(RMPoint mousepos, RMTonyAction &action) { +bool RMInterface::Released(const RMPoint &mousepos, RMTonyAction &action) { if (!m_bActive) return false; diff --git a/engines/tony/inventory.h b/engines/tony/inventory.h index e2143bb24b..86eaa6801e 100644 --- a/engines/tony/inventory.h +++ b/engines/tony/inventory.h @@ -104,7 +104,7 @@ protected: // Controlla se la posizione Y del mouse è corretta, anche in base // alla posizione dell'inventario su schermo - bool CheckPointInside(RMPoint &pt); + bool CheckPointInside(const RMPoint &pt); public: RMInventory(); @@ -125,17 +125,17 @@ public: virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); // Metodo per determinare se l'inventario sta comandando gli input - bool HaveFocus(RMPoint mpos); + bool HaveFocus(const RMPoint &mpos); // Metodo per determinare se la mini interfaccia è attiva bool MiniActive(void); // Gestisce il click sinistro del mouse (solo quando c'ha focus) - bool LeftClick(RMPoint mpos, int &nCombineObj); + bool LeftClick(const RMPoint &mpos, int &nCombineObj); // Gestisce il tasto destro del mouse (solo quando c'ha focus) - void RightClick(RMPoint mpos); - bool RightRelease(RMPoint mpos, RMTonyAction &curAction); + void RightClick(const RMPoint &mpos); + bool RightRelease(const RMPoint &mpos, RMTonyAction &curAction); // Avverte che è finito il combine void EndCombine(void); @@ -151,8 +151,8 @@ public: void RemoveItem(int code); // Siamo sopra un oggetto? - RMItem* WhichItemIsIn(RMPoint mpt); - bool ItemInFocus(RMPoint mpt); + RMItem *WhichItemIsIn(const RMPoint &mpt); + bool ItemInFocus(const RMPoint &mpt); // Cambia l'icona di un oggetto void ChangeItemStatus(uint32 dwCode, uint32 dwStatus); @@ -197,8 +197,8 @@ public: void Reset(void); // Avverte dei click e rilasci del mouse - void Clicked(RMPoint mousepos); - bool Released(RMPoint mousepos, RMTonyAction &action); + void Clicked(const RMPoint &mousepos); + bool Released(const RMPoint &mousepos, RMTonyAction &action); // Attiva o disattiva il quinto verbo void SetPalesati(bool bOn); diff --git a/engines/tony/loc.cpp b/engines/tony/loc.cpp index 7a51386a1c..d805e9ee82 100644 --- a/engines/tony/loc.cpp +++ b/engines/tony/loc.cpp @@ -576,7 +576,7 @@ RMGfxSourceBuffer *RMItem::NewItemSpriteBuffer(int dimx, int dimy, bool bPreRLE) return new RMGfxSourceBuffer16; } -bool RMItem::IsIn(RMPoint pt, int *size) { +bool RMItem::IsIn(const RMPoint &pt, int *size) { RMRect rc; if (!m_bIsActive) @@ -701,7 +701,7 @@ RMGfxPrimitive *RMItem::NewItemPrimitive() { return new RMGfxPrimitive(this); } -void RMItem::SetScrollPosition(RMPoint scroll) { +void RMItem::SetScrollPosition(const RMPoint &scroll) { m_curScroll = scroll; } @@ -810,7 +810,7 @@ void RMItem::SetPattern(int nPattern, bool bPlayP0) { } -bool RMItem::GetName(RMString& name) +bool RMItem::GetName(RMString &name) { char buf[256]; @@ -887,7 +887,7 @@ void RMItem::WaitForEndPattern(CORO_PARAM, uint32 hCustomSkip) { CORO_END_CODE; } -void RMItem::ChangeHotspot(RMPoint pt) { +void RMItem::ChangeHotspot(const RMPoint &pt) { m_hot = pt; } @@ -1246,7 +1246,7 @@ RMPoint RMCharacter::Searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoin } -RMPoint RMCharacter::NearestPoint(RMPoint punto) { +RMPoint RMCharacter::NearestPoint(const RMPoint &punto) { /* RMPoint tofind; signed short difx,dify; @@ -1273,7 +1273,7 @@ RMPoint RMCharacter::NearestPoint(RMPoint punto) { } -short RMCharacter::ScanLine(RMPoint punto) { +short RMCharacter::ScanLine(const RMPoint &punto) { int Ldx, Ldy, Lcount; float Lfx, Lfy, Lslope; RMPoint Lstart, Lend, Lscan; @@ -1321,7 +1321,7 @@ short RMCharacter::ScanLine(RMPoint punto) { } // Calcola intersezioni tra la traiettoria rettilinea ed il più vicino BBOX -RMPoint RMCharacter::InvScanLine(RMPoint punto) { +RMPoint RMCharacter::InvScanLine(const RMPoint &punto) { int Ldx, Ldy, Lcount; float Lfx, Lfy, Lslope; RMPoint Lstart, Lend, Lscan; @@ -1617,8 +1617,8 @@ void RMCharacter::Stop(CORO_PARAM) { CORO_END_CODE; } -inline int RMCharacter::InWhichBox(RMPoint pt) { - return theBoxes->WhichBox(curLocation,pt); +inline int RMCharacter::InWhichBox(const RMPoint &pt) { + return theBoxes->WhichBox(curLocation, pt); } @@ -1699,7 +1699,7 @@ void RMCharacter::Move(CORO_PARAM, RMPoint pt, bool *result) { CORO_END_CODE; } -void RMCharacter::SetPosition(RMPoint pt, int newloc) { +void RMCharacter::SetPosition(const RMPoint &pt, int newloc) { RMBoxLoc *box; minpath = 0; @@ -1912,7 +1912,7 @@ RMBoxLoc *RMGameBoxes::GetBoxes(int nLoc) { return m_allBoxes[nLoc]; } -bool RMGameBoxes::IsInBox(int nLoc, int nBox, RMPoint pt) { +bool RMGameBoxes::IsInBox(int nLoc, int nBox, const RMPoint &pt) { RMBoxLoc *cur = GetBoxes(nLoc); if ((pt.x >= cur->boxes[nBox].left) && (pt.x <= cur->boxes[nBox].right) && @@ -1922,7 +1922,7 @@ bool RMGameBoxes::IsInBox(int nLoc, int nBox, RMPoint pt) { return false; } -int RMGameBoxes::WhichBox(int nLoc, RMPoint punto) { +int RMGameBoxes::WhichBox(int nLoc, const RMPoint &punto) { int i; RMBoxLoc *cur = GetBoxes(nLoc); @@ -2311,7 +2311,7 @@ RMItem *RMLocation::GetItemFromCode(uint32 dwCode) { return NULL; } -RMItem *RMLocation::WhichItemIsIn(RMPoint pt) { +RMItem *RMLocation::WhichItemIsIn(const RMPoint &pt) { int found = -1; int foundSize = 0; int size; @@ -2351,7 +2351,7 @@ void RMLocation::Unload(void) { } } -void RMLocation::UpdateScrolling(RMPoint ptShowThis) { +void RMLocation::UpdateScrolling(const RMPoint &ptShowThis) { RMPoint oldScroll = m_curScroll; if (m_curScroll.x + 250 > ptShowThis.x) { diff --git a/engines/tony/loc.h b/engines/tony/loc.h index bbe37778c0..d81ecb45d5 100644 --- a/engines/tony/loc.h +++ b/engines/tony/loc.h @@ -262,7 +262,7 @@ public: bool DoFrame(RMGfxTargetBuffer *bigBuf, bool bAddToList = true); // Setta la posizione corrente di scrolling - void SetScrollPosition(RMPoint scroll); + void SetScrollPosition(const RMPoint &scroll); // Overloading della funzione per la rimozione da ot list virtual void RemoveThis(CORO_PARAM, bool &result); @@ -282,9 +282,9 @@ public: // Setta un nuovo status. void SetStatus(int nStatus); - bool IsIn(RMPoint pt, int* size=NULL); + bool IsIn(const RMPoint &pt, int *size = NULL); RMPoint Hotspot() { return m_hot; } - bool GetName(RMString& name); + bool GetName(RMString &name); int MpalCode() { return m_mpalCode; } // Scarica l'item @@ -294,7 +294,7 @@ public: void WaitForEndPattern(CORO_PARAM, uint32 hCustomSkip = CORO_INVALID_PID_VALUE); // Setta un nuovo hotspot per l'oggetto - void ChangeHotspot(RMPoint pt); + void ChangeHotspot(const RMPoint &pt); void SetInitCurPattern(bool status) { m_bInitCurPattern=status; } @@ -375,10 +375,10 @@ public: RMBoxLoc *GetBoxes(int nLoc); // Calcola in quale box si trova il punto - int WhichBox(int nLoc, RMPoint pt); + int WhichBox(int nLoc, const RMPoint &pt); // Controlla che il punto sia dentro un certo box - bool IsInBox(int nLoc, int nBox, RMPoint pt); + bool IsInBox(int nLoc, int nBox, const RMPoint &pt); // Cambia lo stato di un box void ChangeBoxStatus(int nLoc, int nBox, int status); @@ -432,15 +432,15 @@ private: RMPoint m_fixedScroll; private: - int InWhichBox(RMPoint pt); + int InWhichBox(const RMPoint &pt); short FindPath(short source, short destination); RMPoint Searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoint punto); - RMPoint NearestPoint(RMPoint punto); + RMPoint NearestPoint(const RMPoint &punto); void GoTo(CORO_PARAM, RMPoint destcoord, bool bReversed=false); - short ScanLine(RMPoint punto); - RMPoint InvScanLine(RMPoint punto); + short ScanLine(const RMPoint &punto); + RMPoint InvScanLine(const RMPoint &punto); RMPoint NearestHotSpot(int sourcebox, int destbox); void NewBoxEntered(int nBox); @@ -478,13 +478,13 @@ public: void Move(CORO_PARAM, RMPoint pt, bool *result = NULL); // Posiziona il personaggio a una certa posizione SENZA farlo muovere - void SetPosition(RMPoint pt, int newloc=-1); + void SetPosition(const RMPoint &pt, int newloc = -1); // Aspetta la fine del movimento void WaitForEndMovement(CORO_PARAM); - void SetFixedScroll(RMPoint fix) { m_fixedScroll = fix; } - void SetSpeed(int speed) { curSpeed=speed; } + void SetFixedScroll(const RMPoint &fix) { m_fixedScroll = fix; } + void SetSpeed(int speed) { curSpeed = speed; } }; @@ -563,7 +563,7 @@ public: void DoFrame(RMGfxTargetBuffer *bigBuf); // Si fa dare il numero dell'item - RMItem* WhichItemIsIn(RMPoint pt); + RMItem *WhichItemIsIn(const RMPoint &pt); // Si fa dare un elemento dal suo codice MPAL RMItem* GetItemFromCode(uint32 dwCode); @@ -575,7 +575,7 @@ public: void SetFixedScroll(const RMPoint &scroll); // Aggiorna le coordinate di scrolling in modo da visualizzare sempre il punto fornito - void UpdateScrolling(RMPoint ptShowThis); + void UpdateScrolling(const RMPoint &ptShowThis); // Legge la posizione di scrolling corrente RMPoint ScrollPosition() { return m_curScroll; } diff --git a/engines/tony/tonychar.h b/engines/tony/tonychar.h index 17b5be23dc..ee6d518f4b 100644 --- a/engines/tony/tonychar.h +++ b/engines/tony/tonychar.h @@ -424,7 +424,7 @@ public: RMPoint Position() { return m_pos; } // Setta la posizione di scrolling - void SetScrollPosition(RMPoint pt) { RMCharacter::SetScrollPosition(pt); } + void SetScrollPosition(const RMPoint &pt) { RMCharacter::SetScrollPosition(pt); } // Setta l'animazione di Take void Take(int nWhere, int nPart); diff --git a/engines/tony/utils.cpp b/engines/tony/utils.cpp index 7a750c2975..a3998a01ab 100644 --- a/engines/tony/utils.cpp +++ b/engines/tony/utils.cpp @@ -109,7 +109,7 @@ RMString::RMString(const int ch) { * Returns the length of the string * @returns Length */ -int RMString::Length() { +int RMString::Length() const { return m_length; } @@ -785,7 +785,7 @@ RMPoint &RMPoint::operator=(RMPoint p) { /** * Offsets the point by another point */ -void RMPoint::Offset(RMPoint p) { +void RMPoint::Offset(const RMPoint &p) { x += p.x; y += p.y; } @@ -878,7 +878,7 @@ void RMRect::SetEmpty(void) { x1 = y1 = x2 = y2 = 0; } -RMRect::RMRect(RMPoint p1, RMPoint p2) { +RMRect::RMRect(const RMPoint &p1, const RMPoint &p2) { SetRect(p1, p2); } @@ -890,7 +890,7 @@ RMRect::RMRect(const RMRect &rc) { CopyRect(rc); } -void RMRect::SetRect(RMPoint p1, RMPoint p2) { +void RMRect::SetRect(const RMPoint &p1, const RMPoint &p2) { x1 = p1.x; y1 = p1.y; x2 = p2.x; @@ -957,7 +957,7 @@ void RMRect::Offset(int xOff, int yOff) { y2 += yOff; } -void RMRect::Offset(RMPoint p) { +void RMRect::Offset(const RMPoint &p) { x1 += p.x; y1 += p.y; x2 += p.x; diff --git a/engines/tony/utils.h b/engines/tony/utils.h index c8ffe062ea..4137823587 100644 --- a/engines/tony/utils.h +++ b/engines/tony/utils.h @@ -185,7 +185,7 @@ public: RMString(const int ch); // Metodi generici - int Length(); + int Length() const; void Compact(); // Access characters within string @@ -247,7 +247,7 @@ public: // Offset void Offset(int xOff, int yOff); - void Offset(RMPoint p); + void Offset(const RMPoint &p); friend RMPoint operator+(RMPoint p1, RMPoint p2); friend RMPoint operator-(RMPoint p1, RMPoint p2); RMPoint &operator+=(RMPoint p); @@ -273,7 +273,7 @@ public: public: RMRect(); RMRect(int x1, int y1, int x2, int y2); - RMRect(RMPoint p1, RMPoint p2); + RMRect(const RMPoint &p1, const RMPoint &p2); RMRect(const RMRect &rc); // Attributes @@ -287,7 +287,7 @@ public: // Set void SetRect(int x1, int y1, int x2, int y2); - void SetRect(RMPoint p1, RMPoint p2); + void SetRect(const RMPoint &p1, const RMPoint &p2); void SetEmpty(void); // Copiers @@ -297,7 +297,7 @@ public: // Offset void Offset(int xOff, int yOff); - void Offset(RMPoint p); + void Offset(const RMPoint &p); friend RMRect operator+(const RMRect &rc, RMPoint p); friend RMRect operator-(const RMRect &rc, RMPoint p); friend RMRect operator+(RMPoint p, const RMRect &rc); @@ -313,7 +313,7 @@ public: void NormalizeRect(); // Point in rect - bool PtInRect(RMPoint pt) { return (pt.x>=x1 && pt.x<=x2 && pt.y>=y1 && pt.y<=y2); } + bool PtInRect(const RMPoint &pt) { return (pt.x >= x1 && pt.x <= x2 && pt.y >= y1 && pt.y <= y2); } // Extract from data stream friend RMDataStream &operator>>(RMDataStream& ds, RMRect &rc); diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp index 2518250bc7..f997b8c53d 100644 --- a/engines/tony/window.cpp +++ b/engines/tony/window.cpp @@ -286,7 +286,6 @@ void RMSnapshot::GrabScreenshot(byte *lpBuf, int dezoom, uint16 *lpDestBuf) { int u, v, curv; - uint16 appo; uint32 k = 0; int sommar, sommab, sommag; uint16 *cursrc; -- cgit v1.2.3