summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorKUDr <KUDr@openttd.org>2007-01-11 17:29:39 +0000
committerKUDr <KUDr@openttd.org>2007-01-11 17:29:39 +0000
commit28e969924b9033f5132fe2ba223e2bcadd39a7ec (patch)
treed644a3831ca0947198b191fa3e4e8973d3a9786e /src/ai
parent5675956443d4e58713a0abd8cedb4eaaaccf22d4 (diff)
downloadopenttd-28e969924b9033f5132fe2ba223e2bcadd39a7ec.tar.xz
(svn r8066) - Codechange: MallocT(), CallocT(), ReallocT() now return the pointer to allocated memory instead of modifying the pointer given as parameter
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/ai.cpp4
-rw-r--r--src/ai/default/default.cpp3
2 files changed, 3 insertions, 4 deletions
diff --git a/src/ai/ai.cpp b/src/ai/ai.cpp
index 5b2e5a8fc..3921fd873 100644
--- a/src/ai/ai.cpp
+++ b/src/ai/ai.cpp
@@ -51,11 +51,11 @@ static void AI_PutCommandInQueue(PlayerID player, TileIndex tile, uint32 p1, uin
if (_ai_player[player].queue_tail == NULL) {
/* There is no item in the queue yet, create the queue */
- MallocT(&_ai_player[player].queue, 1);
+ _ai_player[player].queue = MallocT<AICommand>(1);
_ai_player[player].queue_tail = _ai_player[player].queue;
} else {
/* Add an item at the end */
- MallocT(&_ai_player[player].queue_tail->next, 1);
+ _ai_player[player].queue_tail->next = MallocT<AICommand>(1);
_ai_player[player].queue_tail = _ai_player[player].queue_tail->next;
}
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index fff5cef8a..09e2f68a4 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -3575,7 +3575,6 @@ return_to_loop:;
static void AiStateRemoveStation(Player *p)
{
// Remove stations that aren't in use by any vehicle
- byte *in_use;
const Order *ord;
const Station *st;
TileIndex tile;
@@ -3584,7 +3583,7 @@ static void AiStateRemoveStation(Player *p)
p->ai.state = AIS_1;
// Get a list of all stations that are in use by a vehicle
- MallocT(&in_use, GetMaxStationIndex() + 1);
+ byte *in_use = MallocT<byte>(GetMaxStationIndex() + 1);
memset(in_use, 0, GetMaxStationIndex() + 1);
FOR_ALL_ORDERS(ord) {
if (ord->type == OT_GOTO_STATION) in_use[ord->dest] = 1;