src/ai/ai.cpp
changeset 5587 167d9a91ef02
parent 5584 1111b4d36e35
child 5609 dc6a58930ba4
equal deleted inserted replaced
5586:2d4126d81ebb 5587:167d9a91ef02
     3 #include "../stdafx.h"
     3 #include "../stdafx.h"
     4 #include "../openttd.h"
     4 #include "../openttd.h"
     5 #include "../variables.h"
     5 #include "../variables.h"
     6 #include "../command.h"
     6 #include "../command.h"
     7 #include "../network/network.h"
     7 #include "../network/network.h"
       
     8 #include "../helpers.hpp"
     8 #include "ai.h"
     9 #include "ai.h"
     9 #include "default/default.h"
    10 #include "default/default.h"
    10 
    11 
    11 /**
    12 /**
    12  * Dequeues commands put in the queue via AI_PutCommandInQueue.
    13  * Dequeues commands put in the queue via AI_PutCommandInQueue.
    48 {
    49 {
    49 	AICommand *com;
    50 	AICommand *com;
    50 
    51 
    51 	if (_ai_player[player].queue_tail == NULL) {
    52 	if (_ai_player[player].queue_tail == NULL) {
    52 		/* There is no item in the queue yet, create the queue */
    53 		/* There is no item in the queue yet, create the queue */
    53 		_ai_player[player].queue = malloc(sizeof(AICommand));
    54 		MallocT(&_ai_player[player].queue, 1);
    54 		_ai_player[player].queue_tail = _ai_player[player].queue;
    55 		_ai_player[player].queue_tail = _ai_player[player].queue;
    55 	} else {
    56 	} else {
    56 		/* Add an item at the end */
    57 		/* Add an item at the end */
    57 		_ai_player[player].queue_tail->next = malloc(sizeof(AICommand));
    58 		MallocT(&_ai_player[player].queue_tail->next, 1);
    58 		_ai_player[player].queue_tail = _ai_player[player].queue_tail->next;
    59 		_ai_player[player].queue_tail = _ai_player[player].queue_tail->next;
    59 	}
    60 	}
    60 
    61 
    61 	/* This is our new item */
    62 	/* This is our new item */
    62 	com = _ai_player[player].queue_tail;
    63 	com = _ai_player[player].queue_tail;