Subversion Repositories shark

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

/**************** Functions called by keyboard handler*********/
#include <drivers/keyb.h>
#include <drivers/glib.h>
#include <drivers/glib.h>
#include <stdlib.h>
#include <string.h>
#include "include/simcity.h"
#include "include/proc.h"

short maxc=0;
char sens=0;

extern starting_set starting_set_array[S_POINT];

void h_car_create(KEY_EVT *k)
{
  char name[10];
  int num;

  if((maxc<MAX_CAR)) {
    num=add();
    if(num>=0) {
      sprintf(name,"car%d",num);
      h_create(name,num);
      sprintf(name,"camera%d",num);
      cam_create(name,num);
      sprintf(name,"speed%d",num);
      gauge_create(name,num);
      sprintf(name,"arrow%d",num);
      arrow_create(name,num);
    }
  }
}

void s_car_create(KEY_EVT *k)
{
  char name[10];
  int num;

  if((maxc<MAX_CAR)) {
    num=add();
    if(num>=0) {
      sprintf(name,"car%d",num);
      h_create(name,num);
      sprintf(name,"camera%d",num);
      cam_create(name,num);
      sprintf(name,"speed%d",num);
      gauge_create(name,num);
      sprintf(name,"arrow%d",num);
      arrow_create(name,num);
    }
  }
}

void h_car_kill(KEY_EVT *k) {
  int num;

  if(maxc>0) {
    num=del_o();
    if(num>=0) {
      killing(num);
    }
  }
}

void endfun(KEY_EVT *k)
{
  grx_close();
  cprintf("Brk command pressed! Ending...\n");
  sys_end();
}

void refresh(KEY_EVT *k){

  sem_wait(&mutex);
//heavy and obsolete.....
//draw_scenario();
  grx_putimage(MAPX,MAPY,MAPX+W-1,MAPY+H-1,street);
  sem_post(&mutex);
}

void sensor_switch(KEY_EVT *k) {
  if(sens==0) sens=1;
  else sens=0;
}