[DGD]Overlapping functions?

Stephen Schmidt schmidsj at union.edu
Mon Jul 2 15:45:01 CEST 2001


On Mon, 2 Jul 2001, Brandon Rush wrote:
> I've got a problem where I have a function named move() in both player.c and
> object.c
> I'm trying to call the "move" from object.c but since I'm using a player
> object it's using player.c's move() function instead.

As a design matter, you probably should not want that. If nothing
else, it opens up a way for someone else's code to move a player
without going through the normal restrictions and announcements.
Better, I think, is to rewrite move() in player.c so that it will
bypass whatever you want bypassed, in the special case (and only
in the special case) that is occuring. That is, in player.c:

int move (mixed dest) {
    do_this_always() ;
    if (special_case) do_this_only_sometimes() ;
    ::move(dest) ;
    do_that_always() ;
    if (special_case) do_that_only_sometimes() ;
}


Steve






List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list