diff options
author | Gregory Montoir | 2004-10-08 19:58:49 +0000 |
---|---|---|
committer | Gregory Montoir | 2004-10-08 19:58:49 +0000 |
commit | 43a62296cdcbab2ea46bdc9534e6f1d6bcd2a5a3 (patch) | |
tree | ed51717e102789dfa71daf115a2ee878b8260151 /saga | |
parent | 648b7b1e57411998f27f814c252748479e3738a3 (diff) | |
download | scummvm-rg350-43a62296cdcbab2ea46bdc9534e6f1d6bcd2a5a3.tar.gz scummvm-rg350-43a62296cdcbab2ea46bdc9534e6f1d6bcd2a5a3.tar.bz2 scummvm-rg350-43a62296cdcbab2ea46bdc9534e6f1d6bcd2a5a3.zip |
pass arguments by reference-to-const rather than by value, it's usually more efficient...
svn-id: r15477
Diffstat (limited to 'saga')
-rw-r--r-- | saga/actionmap.cpp | 2 | ||||
-rw-r--r-- | saga/actionmap.h | 2 | ||||
-rw-r--r-- | saga/actor.cpp | 6 | ||||
-rw-r--r-- | saga/actor.h | 6 | ||||
-rw-r--r-- | saga/gfx.cpp | 14 | ||||
-rw-r--r-- | saga/gfx.h | 8 | ||||
-rw-r--r-- | saga/interface.cpp | 12 | ||||
-rw-r--r-- | saga/interface.h | 12 | ||||
-rw-r--r-- | saga/objectmap.cpp | 4 | ||||
-rw-r--r-- | saga/objectmap.h | 4 |
10 files changed, 35 insertions, 35 deletions
diff --git a/saga/actionmap.cpp b/saga/actionmap.cpp index 613aa5e0b1..1bbe07f273 100644 --- a/saga/actionmap.cpp +++ b/saga/actionmap.cpp @@ -120,7 +120,7 @@ const int ActionMap::getExitScene(int exitNum) { } -int ActionMap::hitTest(Point imouse) { +int ActionMap::hitTest(const Point& imouse) { R_ACTIONMAP_ENTRY *exmap_entry; R_CLICKAREA *clickarea; Point *points; diff --git a/saga/actionmap.h b/saga/actionmap.h index f9b3e643e2..817d466ad6 100644 --- a/saga/actionmap.h +++ b/saga/actionmap.h @@ -59,7 +59,7 @@ class ActionMap { ~ActionMap(void); const int getExitScene(int exitNum); - int hitTest(Point imousePt); + int hitTest(const Point& imousePt); int draw(R_SURFACE *ds, int color); void info(void); diff --git a/saga/actor.cpp b/saga/actor.cpp index 8afafdc3b2..950f23c958 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -729,7 +729,7 @@ int Actor::deleteActor(int index) { return R_SUCCESS; } -int Actor::walkTo(int id, Point *walk_pt, uint16 flags, R_SEMAPHORE *sem) { +int Actor::walkTo(int id, const Point *walk_pt, uint16 flags, R_SEMAPHORE *sem) { R_ACTORINTENT actor_intent; R_WALKINTENT *walk_intent; R_WALKINTENT zero_intent; @@ -953,7 +953,7 @@ int Actor::handleWalkIntent(R_ACTOR *actor, R_WALKINTENT *a_walkint, int *comple return R_SUCCESS; } -int Actor::move(int index, Point *move_pt) { +int Actor::move(int index, const Point *move_pt) { YS_DL_NODE *node; R_ACTOR *actor; @@ -985,7 +985,7 @@ int Actor::move(int index, Point *move_pt) { return R_SUCCESS; } -int Actor::moveRelative(int index, Point *move_pt) { +int Actor::moveRelative(int index, const Point *move_pt) { YS_DL_NODE *node; R_ACTOR *actor; diff --git a/saga/actor.h b/saga/actor.h index e2141a77c5..d4cf8c173b 100644 --- a/saga/actor.h +++ b/saga/actor.h @@ -199,10 +199,10 @@ class Actor { int AtoS(Point *logical, const Point *actor); int StoA(Point *actor, const Point screen); - int move(int index, Point *move_pt); - int moveRelative(int index, Point *move_pt); + int move(int index, const Point *move_pt); + int moveRelative(int index, const Point *move_pt); - int walkTo(int index, Point *walk_pt, uint16 flags, R_SEMAPHORE *sem); + int walkTo(int index, const Point *walk_pt, uint16 flags, R_SEMAPHORE *sem); int getActorIndex(uint16 actor_id); diff --git a/saga/gfx.cpp b/saga/gfx.cpp index 978cfc29e6..7e07f75cb7 100644 --- a/saga/gfx.cpp +++ b/saga/gfx.cpp @@ -415,7 +415,7 @@ int Gfx::drawRect(R_SURFACE *ds, Rect *dst_rect, int color) { return R_SUCCESS; } -int Gfx::drawFrame(R_SURFACE *ds, Point *p1, Point *p2, int color) { +int Gfx::drawFrame(R_SURFACE *ds, const Point *p1, const Point *p2, int color) { int left, top, right, bottom; int min_x; @@ -457,8 +457,8 @@ int Gfx::drawFrame(R_SURFACE *ds, Point *p1, Point *p2, int color) { return R_SUCCESS; } -int Gfx::drawPolyLine(R_SURFACE *ds, Point *pts, int pt_ct, int draw_color) { - Point *first_pt = pts; +int Gfx::drawPolyLine(R_SURFACE *ds, const Point *pts, int pt_ct, int draw_color) { + const Point *first_pt = pts; int last_i = 1; int i; @@ -634,7 +634,7 @@ int Gfx::clipLine(R_SURFACE *ds, const Point *src_p1, const Point *src_p2, // Coriolis Group Books, 1997 // // Performs no clipping -void Gfx::drawLine(R_SURFACE *ds, Point *p1, Point *p2, int color) { +void Gfx::drawLine(R_SURFACE *ds, const Point *p1, const Point *p2, int color) { byte *write_p; int clip_result; int temp; @@ -1076,14 +1076,14 @@ void Gfx::setCursor(int best_white) { _system->setMouseCursor(cursor_img, R_CURSOR_W, R_CURSOR_H, 4, 4, keycolor); } -bool Gfx::hitTestPoly(Point *points, unsigned int npoints, Point test_point) { +bool Gfx::hitTestPoly(const Point *points, unsigned int npoints, const Point& test_point) { int yflag0; int yflag1; bool inside_flag = false; unsigned int pt; - Point *vtx0 = &points[npoints - 1]; - Point *vtx1 = &points[0]; + const Point *vtx0 = &points[npoints - 1]; + const Point *vtx1 = &points[0]; yflag0 = (vtx0->y >= test_point.y); for (pt = 0; pt < npoints; pt++, vtx1++) { diff --git a/saga/gfx.h b/saga/gfx.h index e70b0c077d..18412f1169 100644 --- a/saga/gfx.h +++ b/saga/gfx.h @@ -92,11 +92,11 @@ public: int bufToBuffer(byte * dst_buf, int dst_w, int dst_h, const byte *src, int src_w, int src_h, Rect *src_rect, Point *dst_pt); int drawRect(R_SURFACE *ds, Rect *dst_rect, int color); - int drawFrame(R_SURFACE *ds, Point *p1, Point *p2, int color); - int drawPolyLine(R_SURFACE *ds, Point *pts, int pt_ct, int draw_color); + int drawFrame(R_SURFACE *ds, const Point *p1, const Point *p2, int color); + int drawPolyLine(R_SURFACE *ds, const Point *pts, int pt_ct, int draw_color); int getClipInfo(R_CLIPINFO *clipinfo); int clipLine(R_SURFACE *ds, const Point *src_p1, const Point *src_p2, Point *dst_p1, Point *dst_p2); - void drawLine(R_SURFACE * ds, Point *p1, Point *p2, int color); + void drawLine(R_SURFACE * ds, const Point *p1, const Point *p2, int color); Gfx(OSystem *system, int width, int height); R_SURFACE *getBackBuffer(); @@ -107,7 +107,7 @@ public: int getCurrentPal(PALENTRY *src_pal); int palToBlack(R_SURFACE *surface, PALENTRY *src_pal, double percent); int blackToPal(R_SURFACE *surface, PALENTRY *src_pal, double percent); - bool hitTestPoly(Point *points, unsigned int npoints, Point test_point); + bool hitTestPoly(const Point *points, unsigned int npoints, const Point& test_point); private: void setCursor(int best_white); diff --git a/saga/interface.cpp b/saga/interface.cpp index 3d999658f3..942264ceca 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -303,7 +303,7 @@ int Interface::draw() { return R_SUCCESS; } -int Interface::update(Point imousePt, int update_flag) { +int Interface::update(const Point& imousePt, int update_flag) { R_GAME_DISPLAYINFO g_di; R_SURFACE *back_buf; @@ -369,7 +369,7 @@ int Interface::drawStatusBar(R_SURFACE *ds) { return R_SUCCESS; } -int Interface::handleCommandClick(R_SURFACE *ds, Point imousePt) { +int Interface::handleCommandClick(R_SURFACE *ds, const Point& imousePt) { int hit_button; int ibutton_num; @@ -420,7 +420,7 @@ int Interface::handleCommandClick(R_SURFACE *ds, Point imousePt) { return R_SUCCESS; } -int Interface::handleCommandUpdate(R_SURFACE *ds, Point imousePt) { +int Interface::handleCommandUpdate(R_SURFACE *ds, const Point& imousePt) { int hit_button; int ibutton_num; @@ -474,7 +474,7 @@ int Interface::handleCommandUpdate(R_SURFACE *ds, Point imousePt) { return R_SUCCESS; } -int Interface::handlePlayfieldClick(R_SURFACE *ds, Point imousePt) { +int Interface::handlePlayfieldClick(R_SURFACE *ds, const Point& imousePt) { int objectNum; uint16 object_flags = 0; @@ -511,7 +511,7 @@ int Interface::handlePlayfieldClick(R_SURFACE *ds, Point imousePt) { return R_SUCCESS; } -int Interface::handlePlayfieldUpdate(R_SURFACE *ds, Point imousePt) { +int Interface::handlePlayfieldUpdate(R_SURFACE *ds, const Point& imousePt) { const char *object_name; int objectNum; uint16 object_flags = 0; @@ -546,7 +546,7 @@ int Interface::handlePlayfieldUpdate(R_SURFACE *ds, Point imousePt) { return R_SUCCESS; } -int Interface::hitTest(Point imousePt, int *ibutton) { +int Interface::hitTest(const Point& imousePt, int *ibutton) { R_INTERFACE_BUTTON *buttons; int nbuttons; diff --git a/saga/interface.h b/saga/interface.h index 300ed951c2..16ef258615 100644 --- a/saga/interface.h +++ b/saga/interface.h @@ -160,16 +160,16 @@ class Interface { int deactivate(); int setStatusText(const char *new_txt); int draw(); - int update(Point imousePt, int update_flag); + int update(const Point& imousePt, int update_flag); private: - int hitTest(Point imousePt, int *ibutton); + int hitTest(const Point& imousePt, int *ibutton); int drawStatusBar(R_SURFACE *ds); - int handleCommandUpdate(R_SURFACE *ds, Point imousePt); - int handleCommandClick(R_SURFACE *ds, Point imousePt); - int handlePlayfieldUpdate(R_SURFACE *ds, Point imousePt); - int handlePlayfieldClick(R_SURFACE *ds, Point imousePt); + int handleCommandUpdate(R_SURFACE *ds, const Point& imousePt); + int handleCommandClick(R_SURFACE *ds, const Point& imousePt); + int handlePlayfieldUpdate(R_SURFACE *ds, const Point& imousePt); + int handlePlayfieldClick(R_SURFACE *ds, const Point& imousePt); private: SagaEngine *_vm; diff --git a/saga/objectmap.cpp b/saga/objectmap.cpp index 7f943577f9..1a402aec37 100644 --- a/saga/objectmap.cpp +++ b/saga/objectmap.cpp @@ -246,7 +246,7 @@ const int ObjectMap::getEPNum(int object) { // Uses Gfx::drawLine to display all clickareas for each object in the // currently loaded object map resource. -int ObjectMap::draw(R_SURFACE *ds, Point imousePt, int color, int color2) { +int ObjectMap::draw(R_SURFACE *ds, const Point& imousePt, int color, int color2) { R_OBJECTMAP_ENTRY *object_map; R_CLICKAREA *clickarea; @@ -301,7 +301,7 @@ int ObjectMap::draw(R_SURFACE *ds, Point imousePt, int color, int color2) { return R_SUCCESS; } -int ObjectMap::hitTest(Point imousePt) { +int ObjectMap::hitTest(const Point& imousePt) { Point imouse; R_OBJECTMAP_ENTRY *object_map; R_CLICKAREA *clickarea; diff --git a/saga/objectmap.h b/saga/objectmap.h index dff64993b6..fded217be2 100644 --- a/saga/objectmap.h +++ b/saga/objectmap.h @@ -65,8 +65,8 @@ public: const char *getName(int object); const uint16 getFlags(int object); const int getEPNum(int object); - int draw(R_SURFACE *draw_surface, Point imousePt, int color, int color2); - int hitTest(Point imousePt); + int draw(R_SURFACE *draw_surface, const Point& imousePt, int color, int color2); + int hitTest(const Point& imousePt); void info(void); private: |