[Scummvm-cvs-logs] CVS: scummvm/sword2 router.cpp,1.36,1.37
Torbj?rn Andersson
eriktorbjorn at users.sourceforge.net
Mon Jan 5 03:10:02 CET 2004
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sword2 walker.cpp,1.31,1.32
- Next message: [Scummvm-cvs-logs] CVS: scummvm/queen credits.cpp,NONE,1.1 credits.h,NONE,1.1 cutaway.cpp,1.96,1.97 logic.cpp,1.153,1.154 logic.h,1.98,1.99 module.mk,1.18,1.19 resource.cpp,1.37,1.38 resource.h,1.28,1.29
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1:/tmp/cvs-serv25874
Modified Files:
router.cpp
Log Message:
Changed some memmove()s to memcpy(), since the memory areas were not
overlapping.
Enabled some sanity-checking code.
Fixed clearWalkGridList() so that it clears the entire walk grid list. That
was a really stupid bug of mine, and I hope it had at least some bearing on
the rare (for me, at least) walk problems I've seen.
Index: router.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/router.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- router.cpp 28 Dec 2003 15:08:11 -0000 1.36
+++ router.cpp 5 Jan 2004 11:09:33 -0000 1.37
@@ -122,7 +122,7 @@
}
WalkData *Router::lockRouteMem(void) {
- uint8 slotNo = returnSlotNo(ID);
+ uint8 slotNo = returnSlotNo(ID);
_vm->_memory->lockMemory(_routeSlots[slotNo]);
return (WalkData *) _routeSlots[slotNo]->ad;
@@ -2411,7 +2411,7 @@
// open walk grid file
fPolygrid = _vm->_resman->openResource(_walkGridList[i]);
fPolygrid += sizeof(StandardHeader);
- memmove((uint8 *) &floorHeader, fPolygrid, sizeof(WalkGridHeader));
+ memcpy((uint8 *) &floorHeader, fPolygrid, sizeof(WalkGridHeader));
fPolygrid += sizeof(WalkGridHeader);
// how many bars & nodes are we getting from this
@@ -2420,24 +2420,15 @@
theseBars = floorHeader.numBars;
theseNodes = floorHeader.numNodes;
-#ifdef _SWORD2_DEBUG
// check that we're not going to exceed the max
// allowed in the complete walkgrid arrays
- if (_nBars + theseBars >= O_GRID_SIZE)
- error("Adding walkgrid(%d): %d+%d bars exceeds max %d",
- _walkGridList[i], _nBars, theseBars,
- O_GRID_SIZE);
-
- if (_nNodes + theseNodes >= O_GRID_SIZE)
- error("Adding walkgrid(%d): %d+%d nodes exceeds max %d",
- _walkGridList[i], _nNodes, theseBars,
- O_GRID_SIZE);
-#endif
+ assert(_nBars + theseBars < O_GRID_SIZE);
+ assert(_nNodes + theseNodes < O_GRID_SIZE);
// lines
- memmove((uint8 *) &_bars[_nBars], fPolygrid, theseBars * sizeof(BarData));
+ memcpy((uint8 *) &_bars[_nBars], fPolygrid, theseBars * sizeof(BarData));
// move pointer to start of node data
fPolygrid += theseBars * sizeof(BarData);
@@ -2446,7 +2437,7 @@
// leave node 0 for start node
for (uint j = 0; j < theseNodes; j++) {
- memmove((uint8 *) &_node[_nNodes + j].x, fPolygrid, 2 * sizeof(int16));
+ memcpy((uint8 *) &_node[_nNodes + j].x, fPolygrid, 2 * sizeof(int16));
fPolygrid += 2 * sizeof(int16);
}
@@ -2463,7 +2454,7 @@
}
void Router::clearWalkGridList(void) {
- memset(_walkGridList, 0, ARRAYSIZE(_walkGridList));
+ memset(_walkGridList, 0, sizeof(_walkGridList));
}
// called from fnAddWalkGrid
@@ -2486,7 +2477,7 @@
}
}
- error("ERROR: _walkGridList[] full");
+ error("_walkGridList[] full");
}
// called from fnRemoveWalkGrid
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sword2 walker.cpp,1.31,1.32
- Next message: [Scummvm-cvs-logs] CVS: scummvm/queen credits.cpp,NONE,1.1 credits.h,NONE,1.1 cutaway.cpp,1.96,1.97 logic.cpp,1.153,1.154 logic.h,1.98,1.99 module.mk,1.18,1.19 resource.cpp,1.37,1.38 resource.h,1.28,1.29
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list