예제 #1
0
void
do_shanty (int x, int y)
{				/* just steal some stuff and make pollution. */

  get_food (x, y, SHANTY_GET_FOOD);
  if (get_goods (x, y, SHANTY_GET_GOODS) != 0)
    if ((goods_tax -= SHANTY_GET_GOODS * 2) < 0)
      goods_tax = 0;
  get_ore (x, y, SHANTY_GET_ORE);
  get_steel (x, y, SHANTY_GET_STEEL);
  if (get_jobs (x, y, SHANTY_GET_JOBS) != 0)
    if ((income_tax -= SHANTY_GET_JOBS * 2) < 0)
      income_tax = 0;
  if (get_coal (x, y, SHANTY_GET_COAL) != 0)
    if ((coal_tax -= SHANTY_GET_COAL * 2) < 0)
      coal_tax = 0;
  if ((total_time & 1) == 0)
    MP_POL(x,y)++;
  else
    MP_POL(x+1,y+1)++;
}
예제 #2
0
void
do_blacksmith (int x, int y)
{
  /*
    // int_1 contains the goods at the blacksmith
    // int_2 contains the goods made - for the animation
    // int_3 contains the coal store
    // int_4 is the animation trigger time
    // int_5 is the % made so far this month
    // int_6 is the % capacity last month
  */
  if (MP_INFO(x,y).int_3 < MAX_COAL_AT_BLACKSMITH)
    if (get_coal (x, y, BLACKSMITH_GET_COAL) != 0)
      MP_INFO(x,y).int_3 += BLACKSMITH_GET_COAL;
  if (MP_INFO(x,y).int_1 < MAX_GOODS_AT_BLACKSMITH
      && MP_INFO(x,y).int_3 >= BLACKSMITH_COAL_USED)
    {
      if (get_steel (x, y, BLACKSMITH_STEEL_USED) != 0)
	{
	  MP_INFO(x,y).int_1 += GOODS_MADE_BY_BLACKSMITH;
	  MP_INFO(x,y).int_3 -= BLACKSMITH_COAL_USED;
	}
    }
  if (get_jobs (x, y, BLACKSMITH_JOBS) != 0)
    {
      if (MP_INFO(x,y).int_1 > GOODS_MADE_BY_BLACKSMITH)
	{
	  if (put_goods (x, y, GOODS_MADE_BY_BLACKSMITH - 1) != 0)
	    {
	      MP_INFO(x,y).int_1 -= (GOODS_MADE_BY_BLACKSMITH - 1);
	      MP_INFO(x,y).int_2 += (GOODS_MADE_BY_BLACKSMITH - 1);
	      MP_INFO(x,y).int_5++;
	    }
	  else
	    put_jobs (x, y, BLACKSMITH_JOBS);
	}
      else
	put_jobs (x, y, BLACKSMITH_JOBS);
    }
  else
    MP_TYPE(x,y) = CST_BLACKSMITH_0;
  if (MP_INFO(x,y).int_2 > BLACKSMITH_BATCH
      && real_time >= MP_INFO(x,y).int_4)
    {
      MP_INFO(x,y).int_4 = real_time + BLACKSMITH_ANIM_SPEED;
      switch (MP_TYPE(x,y))
	{
	case (CST_BLACKSMITH_0):
	  MP_TYPE(x,y) = CST_BLACKSMITH_1;
	  break;
	case (CST_BLACKSMITH_1):
	  MP_TYPE(x,y) = CST_BLACKSMITH_2;
	  break;
	case (CST_BLACKSMITH_2):
	  MP_TYPE(x,y) = CST_BLACKSMITH_3;
	  break;
	case (CST_BLACKSMITH_3):
	  MP_TYPE(x,y) = CST_BLACKSMITH_4;
	  break;
	case (CST_BLACKSMITH_4):
	  MP_TYPE(x,y) = CST_BLACKSMITH_5;
	  break;
	case (CST_BLACKSMITH_5):
	  MP_TYPE(x,y) = CST_BLACKSMITH_6;
	  break;
	case (CST_BLACKSMITH_6):
	  MP_TYPE(x,y) = CST_BLACKSMITH_1;
	  MP_INFO(x,y).int_2 = 0;
	  MP_POL(x,y)++;
	  break;
	}
    }
  if (total_time % 100 == 0)
    {
      MP_INFO(x,y).int_6 = MP_INFO(x,y).int_5;
      MP_INFO(x,y).int_5 = 0;
    }
}
void do_rocket_pad(int x, int y)
{
    /*
       // You need ROCKET_PAD_JOBS, ROCKET_PAD_GOODS and ROCKET_PAD_STEEL 
       // to add 1 to % of ready to fire.
       // int_1 is the stored jobs
       // int_2 is the stored goods
       // int_3 is the stored steel
       // int_4 is the count which gets to ROCKET_PAD_LAUNCH to fire.
       // int_5 unused
       // MP_ANIM is the time of the next animation frame, when waiting for launch. since 1.91
     */
    if (MP_TYPE(x, y) == CST_ROCKET_FLOWN)
        return;                 /* The rocket has been launched. */

    /* get some jobs */
    if (MP_INFO(x, y).int_1 < ROCKET_PAD_JOBS_STORE) {
        if (get_jobs(x, y, ROCKET_PAD_JOBS + 10) != 0)
            MP_INFO(x, y).int_1 += ROCKET_PAD_JOBS;
    }
    /* get goods */
    if (MP_INFO(x, y).int_2 < ROCKET_PAD_GOODS_STORE) {
        if (get_goods(x, y, ROCKET_PAD_GOODS + 10) != 0)
            MP_INFO(x, y).int_2 += ROCKET_PAD_GOODS;
        else if (get_goods(x, y, ROCKET_PAD_GOODS / 10) != 0)
            MP_INFO(x, y).int_2 += ROCKET_PAD_GOODS / 5;
        else if (get_goods(x, y, ROCKET_PAD_GOODS / 50) != 0)
            MP_INFO(x, y).int_2 += ROCKET_PAD_GOODS / 20;
    }
    /* get steel */
    if (MP_INFO(x, y).int_3 < ROCKET_PAD_STEEL_STORE) {
        if (get_steel(x, y, ROCKET_PAD_STEEL + 10) != 0)
            MP_INFO(x, y).int_3 += ROCKET_PAD_STEEL + 10;
        else if (get_steel(x, y, ROCKET_PAD_STEEL / 5) != 0)
            MP_INFO(x, y).int_3 += ROCKET_PAD_STEEL / 5;
        else if (get_steel(x, y, ROCKET_PAD_STEEL / 20) != 0)
            MP_INFO(x, y).int_3 += ROCKET_PAD_STEEL / 20;
    }
#ifdef DEBUG_ROCKETS
    MP_INFO(x, y).int_4++;
#else
    /* now build the rocket.  Unlike uni's need a full store to make +1% */
    if (MP_TYPE(x, y) < CST_ROCKET_5
        && MP_INFO(x, y).int_1 >= ROCKET_PAD_JOBS_STORE
        && MP_INFO(x, y).int_2 >= ROCKET_PAD_GOODS_STORE && MP_INFO(x, y).int_3 >= ROCKET_PAD_STEEL_STORE) {
        MP_INFO(x, y).int_1 -= ROCKET_PAD_JOBS_STORE;
        MP_INFO(x, y).int_2 -= ROCKET_PAD_GOODS_STORE;
        MP_INFO(x, y).int_3 -= ROCKET_PAD_STEEL_STORE;
        MP_INFO(x, y).int_4++;
        goods_used += ROCKET_PAD_GOODS_STORE;

    }
#endif
    rocket_pad_cost += ROCKET_PAD_RUNNING_COST;
    /* animate and return if already said no to launch */
    if (MP_TYPE(x, y) >= CST_ROCKET_5 && MP_INFO(x, y).int_4 >= (100 * ROCKET_PAD_LAUNCH) / 100) {
        if (real_time >= MP_ANIM(x, y)) {
            MP_ANIM(x, y) = real_time + ROCKET_ANIMATION_SPEED;
            switch (MP_TYPE(x, y)) {
            case (CST_ROCKET_5):
                MP_TYPE(x, y) = CST_ROCKET_6;
                break;
            case (CST_ROCKET_6):
                MP_TYPE(x, y) = CST_ROCKET_7;
                break;
            case (CST_ROCKET_7):
                MP_TYPE(x, y) = CST_ROCKET_5;
                break;
            }
        }
        return;
    }
    /* now choose a graphic */
    if (MP_INFO(x, y).int_4 < (25 * ROCKET_PAD_LAUNCH) / 100)
        MP_TYPE(x, y) = CST_ROCKET_1;
    else if (MP_INFO(x, y).int_4 < (60 * ROCKET_PAD_LAUNCH) / 100)
        MP_TYPE(x, y) = CST_ROCKET_2;
    else if (MP_INFO(x, y).int_4 < (90 * ROCKET_PAD_LAUNCH) / 100)
        MP_TYPE(x, y) = CST_ROCKET_3;
    else if (MP_INFO(x, y).int_4 < (100 * ROCKET_PAD_LAUNCH) / 100)
        MP_TYPE(x, y) = CST_ROCKET_4;
    else if (MP_INFO(x, y).int_4 >= (100 * ROCKET_PAD_LAUNCH) / 100) {
        MP_TYPE(x, y) = CST_ROCKET_5;
        update_main_screen(0);
        if (ask_launch_rocket_now(x, y)) {
            /* ? FIXME ? AL1: in NG 1.1 it seems we are never here ?
             * ? ask_launch_rocket_now  manages everything and call launch_rocket ?
             */
            launch_rocket(x, y);
        }
    }
}