[Scummvm-cvs-logs] CVS: scummvm/saga actionmap.cpp,1.25,1.26 actionmap.h,1.12,1.13 actor.cpp,1.28,1.29 actor.h,1.10,1.11 gfx.cpp,1.25,1.26 gfx.h,1.10,1.11 interface.cpp,1.27,1.28 interface.h,1.9,1.10 objectmap.cpp,1.23,1.24 objectmap.h,1.11,1.12

Gregory Montoir cyx at users.sourceforge.net
Fri Oct 8 13:04:03 CEST 2004


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26799/saga

Modified Files:
	actionmap.cpp actionmap.h actor.cpp actor.h gfx.cpp gfx.h 
	interface.cpp interface.h objectmap.cpp objectmap.h 
Log Message:
pass arguments by reference-to-const rather than by value, it's usually more efficient...

Index: actionmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actionmap.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- actionmap.cpp	8 Oct 2004 01:22:39 -0000	1.25
+++ actionmap.cpp	8 Oct 2004 19:58:49 -0000	1.26
@@ -120,7 +120,7 @@
 }
 
 
-int ActionMap::hitTest(Point imouse) {
+int ActionMap::hitTest(const Point& imouse) {
 	R_ACTIONMAP_ENTRY *exmap_entry;
 	R_CLICKAREA *clickarea;
 	Point *points;

Index: actionmap.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actionmap.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- actionmap.h	8 Oct 2004 01:22:39 -0000	1.12
+++ actionmap.h	8 Oct 2004 19:58:49 -0000	1.13
@@ -59,7 +59,7 @@
 	~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);

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- actor.cpp	8 Oct 2004 01:22:39 -0000	1.28
+++ actor.cpp	8 Oct 2004 19:58:49 -0000	1.29
@@ -729,7 +729,7 @@
 	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 @@
 	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 @@
 	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;
 

Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- actor.h	7 Oct 2004 23:26:41 -0000	1.10
+++ actor.h	8 Oct 2004 19:58:49 -0000	1.11
@@ -199,10 +199,10 @@
 	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);
 	

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- gfx.cpp	8 Oct 2004 01:22:39 -0000	1.25
+++ gfx.cpp	8 Oct 2004 19:58:49 -0000	1.26
@@ -415,7 +415,7 @@
 	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 @@
 	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 @@
 // 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 @@
 	_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++) {

Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- gfx.h	8 Oct 2004 01:22:39 -0000	1.10
+++ gfx.h	8 Oct 2004 19:58:49 -0000	1.11
@@ -92,11 +92,11 @@
 	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 @@
 	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);

Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- interface.cpp	8 Oct 2004 01:22:39 -0000	1.27
+++ interface.cpp	8 Oct 2004 19:58:49 -0000	1.28
@@ -303,7 +303,7 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	return R_SUCCESS;
 }
 
-int Interface::hitTest(Point imousePt, int *ibutton) {
+int Interface::hitTest(const Point& imousePt, int *ibutton) {
 	R_INTERFACE_BUTTON *buttons;
 
 	int nbuttons;

Index: interface.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- interface.h	7 Oct 2004 23:26:41 -0000	1.9
+++ interface.h	8 Oct 2004 19:58:49 -0000	1.10
@@ -160,16 +160,16 @@
 	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;

Index: objectmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- objectmap.cpp	8 Oct 2004 01:22:39 -0000	1.23
+++ objectmap.cpp	8 Oct 2004 19:58:49 -0000	1.24
@@ -246,7 +246,7 @@
 
 // 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 @@
 	return R_SUCCESS;
 }
 
-int ObjectMap::hitTest(Point imousePt) {
+int ObjectMap::hitTest(const Point& imousePt) {
 	Point imouse;
 	R_OBJECTMAP_ENTRY *object_map;
 	R_CLICKAREA *clickarea;

Index: objectmap.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- objectmap.h	8 Oct 2004 01:22:39 -0000	1.11
+++ objectmap.h	8 Oct 2004 19:58:49 -0000	1.12
@@ -65,8 +65,8 @@
 	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:





More information about the Scummvm-git-logs mailing list