[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.32,1.33

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Sat Nov 6 01:33:18 CET 2004


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

Modified Files:
	actor.cpp 
Log Message:
Cleanup


Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- actor.cpp	27 Oct 2004 21:32:27 -0000	1.32
+++ actor.cpp	6 Nov 2004 09:29:22 -0000	1.33
@@ -90,7 +90,7 @@
 	}
 
 	// Create actor alias table
-	_aliasTbl = (int *)malloc(ACTORCOUNT * sizeof *_aliasTbl);
+	_aliasTbl = (int *)malloc(ACTORCOUNT * sizeof(*_aliasTbl));
 	if (_aliasTbl == NULL) {
 		free(_tbl);
 		error("Actor::Actor(): Memory allocation error.");
@@ -367,7 +367,7 @@
 	actor->action_time = 0;
 	actor->action_frame = 0;
 
-	new_node = ys_dll_insert(_list, actor, sizeof *actor, zCompare);
+	new_node = ys_dll_insert(_list, actor, sizeof(*actor), zCompare);
 
 	if (new_node == NULL) {
 		return FAILURE;
@@ -452,14 +452,14 @@
 	if (use_existing_ai) {
 		// Store the current dialogue off the existing actor intent
 		a_speakint = (SPEAKINTENT *)a_intent_p->a_data;
-		ys_dll_add_tail(a_speakint->si_diaglist, &a_dialogue, sizeof a_dialogue);
+		ys_dll_add_tail(a_speakint->si_diaglist, &a_dialogue, sizeof(a_dialogue));
 	} else {
 		// Create a new actor intent
 		a_intent.a_itype = INTENT_SPEAK;
 		a_intent.a_idone = 0;
 		a_intent.a_iflags = 0;
 
-		a_speakint = (SPEAKINTENT *)malloc(sizeof *a_speakint);
+		a_speakint = (SPEAKINTENT *)malloc(sizeof(*a_speakint));
 		if (a_speakint == NULL) {
 			return FAILURE;
 		}
@@ -469,8 +469,8 @@
 		a_speakint->si_last_action = actor->action;
 		a_intent.a_data = a_speakint;
 
-		ys_dll_add_tail(a_speakint->si_diaglist, &a_dialogue, sizeof a_dialogue);
-		ys_dll_add_tail(actor->a_intentlist, &a_intent, sizeof a_intent);
+		ys_dll_add_tail(a_speakint->si_diaglist, &a_dialogue, sizeof(a_dialogue));
+		ys_dll_add_tail(actor->a_intentlist, &a_intent, sizeof(a_intent));
 	}
 
 	if (sem != NULL) {
@@ -563,7 +563,8 @@
 int Actor::setOrientation(int index, int orient) {
 	ACTOR *actor;
 
-	if (!_initialized) {
+	actor = lookupActor(index);
+	if (actor == NULL) {
 		return FAILURE;
 	}
 
@@ -571,12 +572,6 @@
 		return FAILURE;
 	}
 
-	actor = lookupActor(index);
-	if (actor == NULL) {
-
-		return FAILURE;
-	}
-
 	actor->orient = orient;
 
 	return SUCCESS;
@@ -585,10 +580,6 @@
 int Actor::setAction(int index, int action_n, uint16 action_flags) {
 	ACTOR *actor;
 
-	if (!_initialized) {
-		return FAILURE;
-	}
-
 	actor = lookupActor(index);
 	if (actor == NULL) {
 		return FAILURE;
@@ -609,10 +600,6 @@
 int Actor::setDefaultAction(int index, int action_n, uint16 action_flags) {
 	ACTOR *actor;
 
-	if (!_initialized) {
-		return FAILURE;
-	}
-
 	actor = lookupActor(index);
 	if (actor == NULL) {
 		return FAILURE;
@@ -751,7 +738,7 @@
 	node = _tbl[id];
 	actor = (ACTOR *)ys_dll_get_data(node);
 
-	walk_intent = (WALKINTENT *)malloc(sizeof *walk_intent);
+	walk_intent = (WALKINTENT *)malloc(sizeof(*walk_intent));
 	if (walk_intent == NULL) {
 		return MEM;
 	}
@@ -770,7 +757,7 @@
 	actor_intent.a_iflags = 0;
 	actor_intent.a_data = walk_intent;
 
-	ys_dll_add_tail(actor->a_intentlist, &actor_intent, sizeof actor_intent);
+	ys_dll_add_tail(actor->a_intentlist, &actor_intent, sizeof(actor_intent));
 
 	if (sem != NULL) {
 		_vm->_script->SThreadHoldSem(sem);
@@ -791,7 +778,7 @@
 	new_node.node_pt = *dst_pt;
 	new_node.calc_flag = 0;
 
-	ys_dll_add_tail(walk_int->nodelist, &new_node, sizeof new_node);
+	ys_dll_add_tail(walk_int->nodelist, &new_node, sizeof(new_node));
 
 	return SUCCESS;
 }





More information about the Scummvm-git-logs mailing list