[Scummvm-cvs-logs] CVS: scummvm/sky logic.cpp,1.48,1.49 compact.cpp,1.7,1.8 compact.h,1.4,1.5 autoroute.cpp,1.8,1.9

Oliver Kiehl olki at users.sourceforge.net
Mon May 26 12:39:09 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv15657

Modified Files:
	logic.cpp compact.cpp compact.h autoroute.cpp 
Log Message:
cleanup (add supportive function getMegaSet() )


Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- logic.cpp	26 May 2003 19:25:23 -0000	1.48
+++ logic.cpp	26 May 2003 19:38:44 -0000	1.49
@@ -517,8 +517,8 @@
 }
 
 bool SkyLogic::collide(Compact *cpt) {
-	MegaSet *m1 = (MegaSet *)SkyCompact::getCompactElem(_compact, C_GRID_WIDTH + _compact->extCompact->megaSet);
-	MegaSet *m2 = (MegaSet *)SkyCompact::getCompactElem(cpt, C_GRID_WIDTH + cpt->extCompact->megaSet);
+	MegaSet *m1 = SkyCompact::getMegaSet(_compact, _compact->extCompact->megaSet);
+	MegaSet *m2 = SkyCompact::getMegaSet(cpt, cpt->extCompact->megaSet);
 
 	// target's base coordinates
 	uint16 x = cpt->xcood & 0xfff8;

Index: compact.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/compact.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- compact.cpp	26 May 2003 19:25:24 -0000	1.7
+++ compact.cpp	26 May 2003 19:38:48 -0000	1.8
@@ -50,6 +50,21 @@
 
 namespace SkyCompact {
 
+MegaSet *getMegaSet(Compact *cpt, uint16 megaSet) {
+	switch (megaSet) {
+	case 0:
+		return cpt->extCompact->megaSet0;
+	case 1 + NEXT_MEGA_SET:
+		return cpt->extCompact->megaSet1;
+	case 2 + NEXT_MEGA_SET*2:
+		return cpt->extCompact->megaSet2;
+	case 3 + NEXT_MEGA_SET*3:
+		return cpt->extCompact->megaSet3;
+	default:
+		error("Invalid MegaSet (%d)", megaSet);
+	}
+}
+
 uint16 *getSub(Compact *cpt, uint16 mode) {
 	switch (mode) {
 	case 0:

Index: compact.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/compact.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- compact.h	26 May 2003 19:25:24 -0000	1.4
+++ compact.h	26 May 2003 19:38:48 -0000	1.5
@@ -27,6 +27,7 @@
 #include "sky/skydefs.h"
 
 namespace SkyCompact {
+	MegaSet *getMegaSet(Compact *cpt, uint16 megaSet);
 	uint16 *getSub(Compact *cpt, uint16 mode);
 	void *getCompactElem(Compact *cpt, uint32 off);
 

Index: autoroute.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/autoroute.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- autoroute.cpp	29 Apr 2003 14:34:18 -0000	1.8
+++ autoroute.cpp	26 May 2003 19:38:49 -0000	1.9
@@ -70,7 +70,7 @@
 	
 	uint8 stretch1, stretch2; // bl / bh
 	stretch1 = 0;
-	MegaSet *mega = (MegaSet *)SkyCompact::getCompactElem(cpt, C_GRID_WIDTH + cpt->extCompact->megaSet);
+	MegaSet *mega = SkyCompact::getMegaSet(cpt, cpt->extCompact->megaSet);
 	stretch2 = (uint8)(mega->gridWidth & 0xff);
 
 	uint16 cnt;





More information about the Scummvm-git-logs mailing list