[Scummvm-cvs-logs] CVS: scummvm/sword2 events.cpp,1.39,1.40 function.cpp,1.90,1.91 logic.h,1.49,1.50 sync.cpp,1.27,1.28
Torbjörn Andersson
eriktorbjorn at users.sourceforge.net
Sun Nov 13 11:30:01 CET 2005
- Previous message: [Scummvm-cvs-logs] CVS: docs/docbook credits.xml,1.18,1.19
- Next message: [Scummvm-cvs-logs] CVS: scummvm/kyra kyra.cpp,1.70,1.71 kyra.h,1.35,1.36 screen.cpp,1.23,1.24 script.cpp,1.19,1.20 script.h,1.12,1.13 script_v1.cpp,1.22,1.23 sprites.cpp,1.9,1.10 staticres.cpp,1.16,1.17
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31358
Modified Files:
events.cpp function.cpp logic.h sync.cpp
Log Message:
Cleanup
Index: events.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/events.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- events.cpp 29 Oct 2005 21:24:53 -0000 1.39
+++ events.cpp 13 Nov 2005 19:29:32 -0000 1.40
@@ -26,7 +26,7 @@
namespace Sword2 {
void Logic::sendEvent(uint32 id, uint32 interact_id) {
- for (int i = 0; i < MAX_events; i++) {
+ for (int i = 0; i < ARRAYSIZE(_eventList); i++) {
if (_eventList[i].id == id || !_eventList[i].id) {
_eventList[i].id = id;
_eventList[i].interact_id = interact_id;
@@ -43,7 +43,7 @@
}
int Logic::checkEventWaiting() {
- for (int i = 0; i < MAX_events; i++) {
+ for (int i = 0; i < ARRAYSIZE(_eventList); i++) {
if (_eventList[i].id == readVar(ID))
return 1;
}
@@ -55,7 +55,7 @@
// call this from stuff like fnWalk
// you must follow with a return IR_TERMINATE
- for (int i = 0; i < MAX_events; i++) {
+ for (int i = 0; i < ARRAYSIZE(_eventList); i++) {
if (_eventList[i].id == readVar(ID)) {
logicOne(_eventList[i].interact_id);
_eventList[i].id = 0;
@@ -67,7 +67,7 @@
}
void Logic::clearEvent(uint32 id) {
- for (int i = 0; i < MAX_events; i++) {
+ for (int i = 0; i < ARRAYSIZE(_eventList); i++) {
if (_eventList[i].id == id) {
_eventList[i].id = 0;
return;
@@ -76,7 +76,7 @@
}
void Logic::killAllIdsEvents(uint32 id) {
- for (int i = 0; i < MAX_events; i++) {
+ for (int i = 0; i < ARRAYSIZE(_eventList); i++) {
if (_eventList[i].id == id)
_eventList[i].id = 0;
}
@@ -87,7 +87,7 @@
uint32 Logic::countEvents() {
uint32 count = 0;
- for (int i = 0; i < MAX_events; i++) {
+ for (int i = 0; i < ARRAYSIZE(_eventList); i++) {
if (_eventList[i].id)
count++;
}
Index: function.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/function.cpp,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- function.cpp 29 Oct 2005 21:24:53 -0000 1.90
+++ function.cpp 13 Nov 2005 19:29:32 -0000 1.91
@@ -444,19 +444,7 @@
// params: 0 sync's recipient
// 1 sync value
- for (int i = 0; i < MAX_syncs; i++) {
- if (_syncList[i].id == 0) {
- debug(5, "%d sends sync %d to %d", readVar(ID), params[1], params[0]);
- _syncList[i].id = params[0];
- _syncList[i].sync = params[1];
- return IR_CONT;
- }
- }
-
- // The original code didn't even check for this condition, so maybe
- // it should be a fatal error?
-
- warning("No free sync slot");
+ sendSync(params[0], params[1]);
return IR_CONT;
}
Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/logic.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- logic.h 29 Oct 2005 21:24:53 -0000 1.49
+++ logic.h 13 Nov 2005 19:29:32 -0000 1.50
@@ -31,9 +31,6 @@
#define MAX_events 10
-// There won't be many, will there? Probably 2 at most i reckon
-#define MAX_syncs 10
-
#define TREE_SIZE 3
// This must allow for the largest number of objects in a screen
@@ -170,9 +167,11 @@
uint32 sync;
};
- SyncUnit _syncList[MAX_syncs];
+ // There won't be many, will there? Probably 2 at most i reckon
+ SyncUnit _syncList[10];
void clearSyncs(uint32 id);
+ void sendSync(uint32 id, uint32 sync);
int getSync();
Router *_router;
Index: sync.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/sync.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- sync.cpp 29 Oct 2005 21:24:54 -0000 1.27
+++ sync.cpp 13 Nov 2005 19:29:32 -0000 1.28
@@ -32,7 +32,7 @@
*/
void Logic::clearSyncs(uint32 id) {
- for (int i = 0; i < MAX_syncs; i++) {
+ for (int i = 0; i < ARRAYSIZE(_syncList); i++) {
if (_syncList[i].id == id) {
debug(5, "removing sync %d for %d", i, id);
_syncList[i].id = 0;
@@ -40,6 +40,22 @@
}
}
+void Logic::sendSync(uint32 id, uint32 sync) {
+ for (int i = 0; i < ARRAYSIZE(_syncList); i++) {
+ if (_syncList[i].id == 0) {
+ debug(5, "%d sends sync %d to %d", readVar(ID), sync, id);
+ _syncList[i].id = id;
+ _syncList[i].sync = sync;
+ return;
+ }
+ }
+
+ // The original code didn't even check for this condition, so maybe
+ // it should be a fatal error?
+
+ warning("No free sync slot");
+}
+
/**
* Check for a sync waiting for this character. Called from fnAnim() to see if
* animation is to be finished. Returns an index into _syncList[], or -1.
@@ -48,7 +64,7 @@
int Logic::getSync() {
uint32 id = readVar(ID);
- for (int i = 0; i < MAX_syncs; i++) {
+ for (int i = 0; i < ARRAYSIZE(_syncList); i++) {
if (_syncList[i].id == id)
return i;
}
- Previous message: [Scummvm-cvs-logs] CVS: docs/docbook credits.xml,1.18,1.19
- Next message: [Scummvm-cvs-logs] CVS: scummvm/kyra kyra.cpp,1.70,1.71 kyra.h,1.35,1.36 screen.cpp,1.23,1.24 script.cpp,1.19,1.20 script.h,1.12,1.13 script_v1.cpp,1.22,1.23 sprites.cpp,1.9,1.10 staticres.cpp,1.16,1.17
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list