delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/01/23:45:32

From: "Aaron & Rebecca" <NOSPAM AT for DOT me>
Newsgroups: comp.lang.c++,comp.os.msdos.djgpp,rec.games.programmer
Subject: Re: pointer to function ??
Date: 2 Mar 1998 03:22:13 GMT
Organization: AT&T WorldNet Services
Lines: 32
Message-ID: <6dd8l5$gk2@bgtnsc02.worldnet.att.net>
References: <6c7ltq$ms1$1 AT o DOT online DOT no> <6c7u5l$mub$2 AT news DOT ox DOT ac DOT uk>
NNTP-Posting-Host: 12.68.104.50
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

 x-no-archive:yes                                       

Thomas Womack <mert0236 AT sable DOT ox DOT ac DOT uk> wrote in article
<6c7u5l$mub$2 AT news DOT ox DOT ac DOT uk>...
> Wouldn't it be easier, and not discernably slower, to put
> 
> int nextthink;
> 
> nextthink=THINKER_RUN;
> nextthink=THINKER_ATTACK;
> 
> switch nextthink
> {
>   case THINKER_RUN:
>     run();
> 
>   case THINKER_ATTACK:
>     attack();
> }
> 
> Tom


This is a pretty good solution, but, depending on how the application
develops in the future, it may require a lot of extra coding if other
actions are added to the repotoire later in develpment.  See my post for
MHO on a solution to the problem.

Just my $0.02 worth,

Aaron Cosand.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019