Order in ADD_FOLLOWER

More
2 weeks 1 day ago #9775 by kogan
Order in ADD_FOLLOWER was created by kogan
Hi,
anyone can help me to order followers in ADD_FOLLOWERS to follow squence and not to reverse?
Currently last followed enters always first now.

I tried to change it but got stuck here. Only the last 2 follow now :-(

void add_follower(struct char_data *ch, struct char_data *leader)
{
  struct follow_type *k, *j;
  struct char_data *l = leader;

  if (ch->master) {
    core_dump();
    return;
  }

  ch->master = leader;

  CREATE(k, struct follow_type, 1);

  if (!l->followers) {
    k->follower = ch;
    k->next = NULL;
    leader->followers = k;
  } else {
    while (l->followers->next) {
      l->followers = l->followers->next;
    }
    k->follower = ch;
    k->next = l->followers->next;
    leader->followers->next = k;
  }

  act("You now follow $N.", FALSE, ch, 0, leader, TO_CHAR);
  if (CAN_SEE(leader, ch))
    act("$n starts following you.", TRUE, ch, 0, leader, TO_VICT);
  act("$n starts to follow $N.", TRUE, ch, 0, leader, TO_NOTVICT);
}


Thanks for your assistane.
 

Please Log in or Create an account to join the conversation.

More
1 week 6 days ago - 1 week 6 days ago #9776 by thomas
Replied by thomas on topic Order in ADD_FOLLOWER
Please login to view the answers
Last edit: 1 week 6 days ago by thomas. Reason: readability

Please Log in or Create an account to join the conversation.

Time to create page: 0.078 seconds