Hello Patrick.
On 14-Maj-00, you wrote:
PD>>> I would recommend not using a new variable to count up the attackers as
PD>>> is just asking for trouble(as you've seen). b> Try simple for loop
PD>>> there are always
PD>> 6 or less attackers. It won't use too much cpu time I don't b> think. This
PD>> way you save on memory usage, have a smaller playerfile, and b> you're
PD>> ALWAYS sure who's attacking whom and the exact count.
PD>>
PD>> wont I still need a variable to check that? besides, it wont work with
PD>> skills
PD>> like bash, kick and backstab. the playerfile is no issue here, I dont
PD>> save the
PD>> variable attackers. that would be quite pointless. memory is no big issue
PD>> either, attackers is defined as a byte.
PD>
PD> Naw. No problem.
PD>
PD> int num_of_attackers(struct char_data *ch) {
PD> struct char_data *i;
PD> int j=0;
PD>
PD> for (i = world[IN_ROOM(ch)].people; i; i = i->next_in_room) {
PD> if(FIGHTING(i)==ch) {
PD> j++;
PD> }
PD> }
PD> return j;
PD> }
will try this out, thanks!
--
/Damian/
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 04/10/01 PDT