view carNode.cc @ 122:5219bf3d5e71

title_draw
author e085768
date Mon, 27 Jun 2011 19:44:46 +0900
parents ed702e49cc6c
children 6ef3b0efdeaf
line wrap: on
line source

#include <stdio.h>
#include <stdlib.h>
#include "libps2.h"
#include "ps2util.h"
#include "car.h"
#include "game.h"
#include "carNode.h"

/* --- car.c --- */
void car_destroy(CarPtr car);

static CarPtr car_list;

void
carNode_append(CarPtr newCar) 
{
  printf("carNode_append()\n");
  CarPtr p = car_list;

  if (!p) {
    printf("carNode_append()\n");
    car_list = newCar;
  } else {
    while (p->next) p = p->next;
    p->next = newCar;
  }
}


void
carNode_draw()
{
  CarPtr p = car_list;

  while (p) {
    ps2util_obj_Draw(p->body);
    p = p->next;
  }
}


void
carNode_destroy()
{
  CarPtr p = car_list;

  while (p) {
    car_destroy(p);
    p = p->next;
  }
  car_list = NULL;
}