void pc_record_type::dropItem(short item_num, location where_drop) { short choice, how_many = 0; item_record_type item_store; bool take_given_item = true; location loc; item_store = items[item_num]; if ((equip[item_num] == true) && (items[item_num].isCursed())) add_string_to_buf("Drop: Item is cursed. "); else switch (overall_mode) { case 0: choice = fancy_choice_dialog(1093,0); if (choice == 1) return; add_string_to_buf("Drop: OK"); if ((item_store.type_flag > 0) && (item_store.charges > 1)) { how_many = get_num_of_items(item_store.charges); if (how_many == item_store.charges) takeItem(item_num); else items[item_num].charges -= how_many; } else takeItem(item_num); break; case 5: case 15: loc = where_drop; if ((item_store.type_flag > 0) && (item_store.charges > 1)) { how_many = get_num_of_items(item_store.charges); if (how_many <= 0) return; if (how_many < item_store.charges) take_given_item = false; item_store.charges = how_many; } if (is_container(loc) == true) item_store.item_properties = item_store.item_properties | 8; if (place_item(item_store,loc,false) == false) { add_string_to_buf("Drop: Too many items on ground"); item_store.item_properties = item_store.item_properties & 247; // not contained } else { if (item_store.isContained()) add_string_to_buf("Drop: Item put away"); else add_string_to_buf("Drop: OK"); items[item_num].charges -= how_many; if (take_given_item) takeItem(item_num); } break; } }
static void run_top_sort_level(struct sort_level *sl) { struct sort_level *slc; reverse_sort = sort_opts_vals.kflag ? keys[0].sm.rflag : default_sort_mods->rflag; sl->start_position = 0; sl->sln = 256; sl->sublevels = sort_malloc(slsz); memset(sl->sublevels, 0, slsz); for (size_t i = 0; i < sl->tosort_num; ++i) place_item(sl, i); if (sl->leaves_num > 1) { if (keys_num > 1) { if (sort_opts_vals.sflag) { mergesort(sl->leaves, sl->leaves_num, sizeof(struct sort_list_item *), (int(*)(const void *, const void *)) list_coll); } else { qsort(sl->leaves, sl->leaves_num, sizeof(struct sort_list_item *), (int(*)(const void *, const void *)) list_coll); } } else if (!sort_opts_vals.sflag && sort_opts_vals.complex_sort) { qsort(sl->leaves, sl->leaves_num, sizeof(struct sort_list_item *), (int(*)(const void *, const void *)) list_coll_by_str_only); } } if (!reverse_sort) { memcpy(sl->tosort + sl->start_position, sl->leaves, sl->leaves_num * sizeof(struct sort_list_item*)); sl->start_position += sl->leaves_num; sort_left_dec(sl->leaves_num); for (size_t i = 0; i < sl->sln; ++i) { slc = sl->sublevels[i]; if (slc) { slc->sorted = sl->tosort; slc->start_position = sl->start_position; sl->start_position += slc->tosort_num; push_ls(slc); sl->sublevels[i] = NULL; } } } else { size_t n; for (size_t i = 0; i < sl->sln; ++i) { n = sl->sln - i - 1; slc = sl->sublevels[n]; if (slc) { slc->sorted = sl->tosort; slc->start_position = sl->start_position; sl->start_position += slc->tosort_num; push_ls(slc); sl->sublevels[n] = NULL; } } memcpy(sl->tosort + sl->start_position, sl->leaves, sl->leaves_num * sizeof(struct sort_list_item*)); sort_left_dec(sl->leaves_num); } #if defined(SORT_THREADS) if (nthreads < 2) { #endif run_sort_cycle_st(); #if defined(SORT_THREADS) } else { size_t i; for(i = 0; i < nthreads; ++i) { pthread_attr_t attr; pthread_t pth; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_DETACHED); pthread_create(&pth, &attr, sort_thread, NULL); pthread_attr_destroy(&attr); } for(i = 0; i < nthreads; ++i) sem_wait(&mtsem); } #endif /* defined(SORT_THREADS) */ }
static void run_sort_level_next(struct sort_level *sl) { struct sort_level *slc; size_t i, sln, tosort_num; if (sl->sublevels) { sort_free(sl->sublevels); sl->sublevels = NULL; } switch (sl->tosort_num){ case 0: goto end; case (1): sl->sorted[sl->start_position] = sl->tosort[0]; sort_left_dec(1); goto end; case (2): if (list_coll_offset(&(sl->tosort[0]), &(sl->tosort[1]), sl->level) > 0) { sl->sorted[sl->start_position++] = sl->tosort[1]; sl->sorted[sl->start_position] = sl->tosort[0]; } else { sl->sorted[sl->start_position++] = sl->tosort[0]; sl->sorted[sl->start_position] = sl->tosort[1]; } sort_left_dec(2); goto end; default: if (TINY_NODE(sl) || (sl->level > 15)) { listcoll_t func; func = get_list_call_func(sl->level); sl->leaves = sl->tosort; sl->leaves_num = sl->tosort_num; sl->leaves_sz = sl->leaves_num; sl->leaves = sort_realloc(sl->leaves, (sizeof(struct sort_list_item *) * (sl->leaves_sz))); sl->tosort = NULL; sl->tosort_num = 0; sl->tosort_sz = 0; sl->sln = 0; sl->real_sln = 0; if (sort_opts_vals.sflag) { if (mergesort(sl->leaves, sl->leaves_num, sizeof(struct sort_list_item *), (int(*)(const void *, const void *)) func) == -1) /* NOTREACHED */ err(2, "Radix sort error 3"); } else qsort(sl->leaves, sl->leaves_num, sizeof(struct sort_list_item *), (int(*)(const void *, const void *)) func); memcpy(sl->sorted + sl->start_position, sl->leaves, sl->leaves_num * sizeof(struct sort_list_item*)); sort_left_dec(sl->leaves_num); goto end; } else { sl->tosort_sz = sl->tosort_num; sl->tosort = sort_realloc(sl->tosort, sizeof(struct sort_list_item*) * (sl->tosort_sz)); } } sl->sln = 256; sl->sublevels = sort_malloc(slsz); memset(sl->sublevels, 0, slsz); sl->real_sln = 0; tosort_num = sl->tosort_num; for (i = 0; i < tosort_num; ++i) place_item(sl, i); sort_free(sl->tosort); sl->tosort = NULL; sl->tosort_num = 0; sl->tosort_sz = 0; if (sl->leaves_num > 1) { if (keys_num > 1) { if (sort_opts_vals.sflag) { mergesort(sl->leaves, sl->leaves_num, sizeof(struct sort_list_item *), (int(*)(const void *, const void *)) list_coll); } else { qsort(sl->leaves, sl->leaves_num, sizeof(struct sort_list_item *), (int(*)(const void *, const void *)) list_coll); } } else if (!sort_opts_vals.sflag && sort_opts_vals.complex_sort) { qsort(sl->leaves, sl->leaves_num, sizeof(struct sort_list_item *), (int(*)(const void *, const void *)) list_coll_by_str_only); } } sl->leaves_sz = sl->leaves_num; sl->leaves = sort_realloc(sl->leaves, (sizeof(struct sort_list_item *) * (sl->leaves_sz))); if (!reverse_sort) { memcpy(sl->sorted + sl->start_position, sl->leaves, sl->leaves_num * sizeof(struct sort_list_item*)); sl->start_position += sl->leaves_num; sort_left_dec(sl->leaves_num); sort_free(sl->leaves); sl->leaves = NULL; sl->leaves_num = 0; sl->leaves_sz = 0; sln = sl->sln; for (i = 0; i < sln; ++i) { slc = sl->sublevels[i]; if (slc) { slc->sorted = sl->sorted; slc->start_position = sl->start_position; sl->start_position += slc->tosort_num; if (SMALL_NODE(slc)) run_sort_level_next(slc); else push_ls(slc); sl->sublevels[i] = NULL; } } } else { size_t n; sln = sl->sln; for (i = 0; i < sln; ++i) { n = sln - i - 1; slc = sl->sublevels[n]; if (slc) { slc->sorted = sl->sorted; slc->start_position = sl->start_position; sl->start_position += slc->tosort_num; if (SMALL_NODE(slc)) run_sort_level_next(slc); else push_ls(slc); sl->sublevels[n] = NULL; } } memcpy(sl->sorted + sl->start_position, sl->leaves, sl->leaves_num * sizeof(struct sort_list_item*)); sort_left_dec(sl->leaves_num); } end: free_sort_level(sl); }
void do_oremine (int x, int y) { /* // int_1 is the ore at in stock // int_2 is the ore reserve under the ground or at the surface really. */ int xx, yy, xs, ys, xe, ye, cr; if (MP_INFO(x,y).int_1 < DIG_MORE_ORE_TRIGGER - 5000) { xs = x; ys = y; xe = x + 4; ye = y + 4; cr = 0; for (yy = ys; yy < ye; yy++) for (xx = xs; xx < xe; xx++) cr += MP_INFO(xx,yy).ore_reserve; MP_INFO(x,y).int_2 = cr; if (cr > 0) if (get_jobs (x, y, JOBS_DIG_ORE) != 0) for (yy = ys; yy < ye; yy++) for (xx = xs; xx < xe; xx++) if (MP_INFO(xx,yy).ore_reserve > 0) { MP_INFO(xx,yy).ore_reserve--; MP_INFO(x,y).int_1 += 5000; ore_made += 5000; sust_dig_ore_coal_tip_flag = 0; /* maybe want an ore tax? */ yy = ye; xx = xe; /* break out */ } } if ((MP_INFO(x - 1,y).flags & FLAG_IS_TRANSPORT) != 0) { if (MP_GROUP(x-1,y) == GROUP_RAIL && MP_INFO(x - 1,y).int_5 < MAX_ORE_ON_RAIL && MP_INFO(x,y).int_1 >= (MAX_ORE_ON_RAIL - MP_INFO(x - 1,y).int_5)) { if (get_jobs (x, y, JOBS_LOAD_ORE) != 0) { MP_INFO(x,y).int_1 -= (MAX_ORE_ON_RAIL - MP_INFO(x - 1,y).int_5); MP_INFO(x - 1,y).int_5 = MAX_ORE_ON_RAIL; } } else if (MP_GROUP(x-1,y) == GROUP_ROAD && MP_INFO(x - 1,y).int_5 < MAX_ORE_ON_ROAD && MP_INFO(x,y).int_1 >= (MAX_ORE_ON_ROAD - MP_INFO(x - 1,y).int_5)) { if (get_jobs (x, y, JOBS_LOAD_ORE) != 0) { MP_INFO(x,y).int_1 -= (MAX_ORE_ON_ROAD - MP_INFO(x - 1,y).int_5); MP_INFO(x - 1,y).int_5 = MAX_ORE_ON_ROAD; } } else if (MP_GROUP(x - 1,y) == GROUP_TRACK && MP_INFO(x - 1,y).int_5 < MAX_ORE_ON_TRACK && MP_INFO(x,y).int_1 >= (MAX_ORE_ON_TRACK - MP_INFO(x - 1,y).int_5)) { if (get_jobs (x, y, JOBS_LOAD_ORE) != 0) { MP_INFO(x,y).int_1 -= (MAX_ORE_ON_TRACK - MP_INFO(x - 1,y).int_5); MP_INFO(x - 1,y).int_5 = MAX_ORE_ON_TRACK; } } } if ((MP_INFO(x,y - 1).flags & FLAG_IS_TRANSPORT) != 0) { if (MP_GROUP(x,y-1) == GROUP_RAIL && MP_INFO(x,y - 1).int_5 < MAX_ORE_ON_RAIL && MP_INFO(x,y).int_1 >= (MAX_ORE_ON_RAIL - MP_INFO(x,y - 1).int_5)) { if (get_jobs (x, y, JOBS_LOAD_ORE) != 0) { MP_INFO(x,y).int_1 -= (MAX_ORE_ON_RAIL - MP_INFO(x,y - 1).int_5); MP_INFO(x,y - 1).int_5 = MAX_ORE_ON_RAIL; } } else if (MP_GROUP(x,y-1) == GROUP_ROAD && MP_INFO(x,y - 1).int_5 < MAX_ORE_ON_ROAD && MP_INFO(x,y).int_1 >= (MAX_ORE_ON_ROAD - MP_INFO(x,y - 1).int_5)) { if (get_jobs (x, y, JOBS_LOAD_ORE) != 0) { MP_INFO(x,y).int_1 -= (MAX_ORE_ON_ROAD - MP_INFO(x,y - 1).int_5); MP_INFO(x,y - 1).int_5 = MAX_ORE_ON_ROAD; } } else if (MP_GROUP(x,y-1) == GROUP_TRACK && MP_INFO(x,y - 1).int_5 < MAX_ORE_ON_TRACK && MP_INFO(x,y).int_1 >= (MAX_ORE_ON_TRACK - MP_INFO(x,y - 1).int_5)) { if (get_jobs (x, y, JOBS_LOAD_ORE) != 0) { MP_INFO(x,y).int_1 -= (MAX_ORE_ON_TRACK - MP_INFO(x,y - 1).int_5); MP_INFO(x,y - 1).int_5 = MAX_ORE_ON_TRACK; } } } /* choose a graphic */ if ((total_time & 0x7f) == 0) { xx = 7 * (MP_INFO(x,y).int_2 + (3 * ORE_RESERVE / 2)) / (16 * ORE_RESERVE); switch (xx) { case (0): MP_TYPE(x,y) = CST_OREMINE_8; break; case (1): MP_TYPE(x,y) = CST_OREMINE_7; break; case (2): MP_TYPE(x,y) = CST_OREMINE_6; break; case (3): MP_TYPE(x,y) = CST_OREMINE_5; break; case (4): MP_TYPE(x,y) = CST_OREMINE_4; break; case (5): MP_TYPE(x,y) = CST_OREMINE_3; break; case (6): MP_TYPE(x,y) = CST_OREMINE_2; break; case (7): MP_TYPE(x,y) = CST_OREMINE_1; break; } if (MP_INFO(x,y).int_2 <= 0) { #if defined (commentout) do_bulldoze_area (CST_GREEN, x, y); place_item(x,y,CST_TIP_0); #endif int i,j; for (j = 0; j < 4; j++) { for (i = 0; i < 4; i++) { do_bulldoze_area (CST_WATER, x+i, y+j); } } connect_rivers (); refresh_main_screen (); } } }
void editMap (MapPoint point, int button) { if( !getGameView()->inCity( point ) ){ return; } int x = point.x; int y = point.y; int selected_module_group = get_group_of_type(selected_module_type); int size; // int x, y; /* mappoint */ int mod_x, mod_y; /* upper left coords of module clicked on */ int mps_result; if (MP_TYPE(x,y) == CST_USED) { mod_x = MP_INFO(x,y).int_1; mod_y = MP_INFO(x,y).int_2; } else { mod_x = x; mod_y = y; } /* Bring up mappoint_stats for any right mouse click */ if (button == SDL_BUTTON_RIGHT) { mps_set( x, y, MPS_ENV); return; } /* Handle bulldozing */ if (selected_module_type == CST_GREEN && button != SDL_BUTTON_RIGHT) { check_bulldoze_area (x, y); mps_result = mps_set( mod_x, mod_y, MPS_MAP ); // Update mps on bulldoze #ifdef DEBUG DBG_TileInfo(x, y); #endif return; } /* Bring up mappoint_stats for certain left mouse clicks */ /* Check market and port double-clicks here */ /* Check rocket launches */ if( !GROUP_IS_BARE(MP_GROUP( x,y )) ) { if(mapMPS) mapMPS->playBuildingSound( mod_x, mod_y ); mps_result = mps_set( mod_x, mod_y, MPS_MAP ); //query Tool #ifdef DEBUG DBG_TileInfo(x, y); #endif if( mps_result >= 1 ){ if( MP_GROUP( mod_x,mod_y ) == GROUP_MARKET ){ clicked_market_cb (mod_x, mod_y); return; } else if (MP_GROUP(mod_x,mod_y) == GROUP_PORT) { clicked_port_cb (mod_x, mod_y); return; } else if (MP_TYPE(mod_x,mod_y) >= CST_ROCKET_5 && MP_TYPE(mod_x,mod_y) <= CST_ROCKET_7){ //Dialogs delete themself new Dialog( ASK_LAUNCH_ROCKET, mod_x,mod_y ); return; } } //to be here we are not in bulldoze-mode and the tile //under the cursor is not empty. //to allow up/downgrading of Tracks,Roads,Rails and bridges we can't always return. if( ( selected_module_type != CST_TRACK_LR ) && ( selected_module_type != CST_ROAD_LR ) && ( selected_module_type != CST_RAIL_LR ) ) { return; //not building a transport } if( ( MP_GROUP(x,y) != GROUP_WATER ) && ( !( MP_INFO(x,y).flags & FLAG_IS_TRANSPORT ))){ return; //target area is neither water not a transport } if( selected_module_type == CST_TRACK_LR ) { if( MP_GROUP( x, y ) == GROUP_TRACK || MP_GROUP( x, y ) == GROUP_TRACK_BRIDGE || MP_GROUP( x, y ) == GROUP_ROAD || MP_GROUP( x, y ) == GROUP_ROAD_BRIDGE || MP_GROUP( x, y ) == GROUP_RAIL || MP_GROUP( x, y ) == GROUP_RAIL_BRIDGE ) return; } else if( selected_module_type == CST_ROAD_LR ) { if ( MP_GROUP( x, y ) == GROUP_ROAD || MP_GROUP( x, y ) == GROUP_ROAD_BRIDGE || MP_GROUP( x, y ) == GROUP_RAIL || MP_GROUP( x, y ) == GROUP_RAIL_BRIDGE ) return; } else if( selected_module_type == CST_RAIL_LR ) { if( MP_GROUP( x, y ) == GROUP_RAIL || MP_GROUP( x, y ) == GROUP_RAIL_BRIDGE ) return; } } //query Tool if(selected_module_type==CST_NONE) { if (mapMPS) { mapMPS->playBuildingSound( mod_x, mod_y ); mapMPS->setView(MapPoint( mod_x, mod_y )); } mps_result = mps_set( mod_x, mod_y, MPS_MAP ); //query Tool on CST_NONE #ifdef DEBUG DBG_TileInfo(x, y); #endif return; } /* OK, by now we are certain that the user wants to place the item. Set the origin based on the size of the selected_module_type, and see if the selected item will fit. */ size = main_groups[selected_module_group].size; /* if (px > (mw->x + mw->w) - size*16) px = (mw->x + mw->w) - size*16; if (py > (mw->y + mw->h) - size*16) py = (mw->y + mw->h) - size*16; pixel_to_mappoint(px, py, &x, &y); */ //Check if we are too close to the border if( x + size > WORLD_SIDE_LEN - 1 || y + size > WORLD_SIDE_LEN - 1 || x < 1 || y < 1 ) return; if (size >= 2) { if (!GROUP_IS_BARE(MP_GROUP(x + 1,y)) || !GROUP_IS_BARE(MP_GROUP(x,y + 1)) || !GROUP_IS_BARE(MP_GROUP(x + 1,y + 1))) return; } if (size >= 3) { if (!GROUP_IS_BARE(MP_GROUP(x + 2,y)) || !GROUP_IS_BARE(MP_GROUP(x + 2,y + 1)) || !GROUP_IS_BARE(MP_GROUP(x + 2,y + 2)) || !GROUP_IS_BARE(MP_GROUP(x + 1,y + 2)) || !GROUP_IS_BARE(MP_GROUP(x,y + 2))) return; } if (size == 4) { if (!GROUP_IS_BARE(MP_GROUP(x + 3,y)) || !GROUP_IS_BARE(MP_GROUP(x + 3,y + 1)) || !GROUP_IS_BARE(MP_GROUP(x + 3,y + 2)) || !GROUP_IS_BARE(MP_GROUP(x + 3,y + 3)) || !GROUP_IS_BARE(MP_GROUP(x + 2,y + 3)) || !GROUP_IS_BARE(MP_GROUP(x + 1,y + 3)) || !GROUP_IS_BARE(MP_GROUP(x,y + 3))) return; } //how to build a lake in the park? //just hold 'W' key on build ;-) if( selected_module_group == GROUP_PARKLAND ){ Uint8 *keystate = SDL_GetKeyState(NULL); if ( keystate[SDLK_w] ) selected_module_type = CST_PARKLAND_LAKE; else selected_module_type = CST_PARKLAND_PLANE; } /* Place the selected item . Warning messages are managed by place_item(...) */ last_message_group = place_item (x, y, selected_module_type); switch (last_message_group) { case 0: /* Success */ getSound()->playSound( "Build" ); mps_result = mps_set( mod_x, mod_y, MPS_MAP ); // Update mps on well-built #ifdef DEBUG DBG_TileInfo(x, y); #endif break; case -1000: /* ouch group does not exist */ case -1: /* Not enough money */ case -2: /* Improper port placement */ case -3: /* too many windmills/substations */ case -4: /* too many market */ case -5: /* previous tip here, cannot build tip here */ case -6: /* previous tip here, cannot build oremine */ case -7: /* no ore reserve. cannot build oremine here */ default: /* warning messages are managed by place item */ last_message_group = 0; } }
void player_act() { switch(get_last_action()) { case ACTION_TILL: till(x, y, current_map); break; case ACTION_PICKUP: { item* it = get_item(items_at(x, y, current_map), item_count_at(x, y, current_map), PURPOSE_PICKUP, true); if(!it) break; printf_message(COLOR_DEFAULT, "Picked up %d %s", it->count, it->name); callback("picked_up", it->script_state); take_item(x, y, it, current_map); add_item(it); } break; case ACTION_DROP: { item* it = get_item(inventory, item_count, PURPOSE_DROP, false); if(!it) break; if(it->can_equip && equipment[it->slot] == it) { equipment[it->slot] = 0; printf_message(COLOR_DEFAULT, "You unequip the %s, and drop it on the ground.", it->name); callback("removed", it->script_state); } item* clone = clone_item(it); callback("dropped", clone->script_state); place_item(x, y, clone, current_map); remove_item(it, -1); } break; case ACTION_APPLY: { item* it = get_item(inventory, item_count, PURPOSE_APPLY, false); if(!it) break; callback("apply", it->script_state); remove_item(it, 1); } break; case ACTION_EQUIP: { item* it = get_item(inventory, item_count, PURPOSE_EQUIP, false); if(!it || it->slot == SLOT_INVALID) break; callback("equip", it->script_state); printf_message(COLOR_DEFAULT, "You equip the %s.", it->name); equipment[it->slot] = it; break; } case ACTION_REMOVE: { item* it = get_item(equipment, 3, PURPOSE_REMOVE, false); if(!it) break; callback("remove", it->script_state); equipment[it->slot] = 0; printf_message(COLOR_DEFAULT, "You unequip the %s.", it->name); break; } case ACTION_PLANT: { if(!can_plant(x, y, current_map, true)) break; item* it = get_item(inventory, item_count, PURPOSE_PLANT, false); if(!it) break; if(spawn_plant(x, y, it->plant_id, current_map)) { printf_message(COLOR_DEFAULT, "You plant the %s in the tilled soil.", it->name); remove_item(it, 1); } break; } case ACTION_HARVEST: { add_item(harvest_plant(x, y, current_map)); break; } case ACTION_HELP: show_controls(); break; case ACTION_INVENTORY: get_item(inventory, item_count, PURPOSE_NONE, false); break; case ACTION_WATER: water_tile(x, y, current_map); break; case ACTION_EXAMINE: { int mx, my; get_last_mouse_position(&mx, &my); int xdiff = mx - pres_x; int ydiff = my - pres_y; if(mx < 1 || my < 1 || mx > 78 || my > 78) break; examine(x + xdiff, y +ydiff, current_map); } break; } if(ep_current <= 0) add_message(COLOR_EP_CRIT, "Out of energy, you fall to the ground."); }
void pc_record_type::kill(short type) { short i = 24; bool dummy, no_save = false, no_luck = false; location item_loc; if (type >= 20) { type -= 10; no_save = true; } if(type >= 10) { type -= 10; no_luck = true; } if(no_save == false){ if (type != 4) i = hasAbilEquip(ITEM_LIFE_SAVING); //check if has life saving items else i = hasAbilEquip(ITEM_PROTECT_FROM_PETRIFY); //check if has protection vs petrification items } short which_pc = getNum(); if ((no_luck == false) && (type != 0) && (skills[SKILL_LUCK] > 0) && (get_ran(1,0,100) < hit_chance[skills[SKILL_LUCK]])) { add_string_to_buf(" But you luck out! "); cur_health = 0; } else if ((i == 24) || (type == 0)) { if (combat_active_pc == which_pc) combat_active_pc = 6; for (i = 0; i < 24; i++) equip[i] = false; item_loc = (overall_mode >= MODE_COMBAT) ? pc_pos[which_pc] : c_town.p_loc; if (type == 2) make_sfx(item_loc.x,item_loc.y,3); else if (type == 3) make_sfx(item_loc.x,item_loc.y,6); if (overall_mode != MODE_OUTDOORS) for (i = 0; i < 24; i++) if (items[i].variety != ITEM_TYPE_NO_ITEM) { dummy = place_item(items[i],item_loc,true); items[i].variety = ITEM_TYPE_NO_ITEM; } if ((type == 2) || (type == 3)) play_sound(21); if(type == 4){ play_sound(43); sprintf (create_line, " %s is turned to stone. ",(char *) name); add_string_to_buf(create_line); } main_status = type; pc_moves[which_pc] = 0; } else { if (type == 4) { sprintf (create_line, " %s is immune to petrification. ",(char *) name); add_string_to_buf(create_line); //inform of what has happened } else{ add_string_to_buf(" Life saved! "); takeItem(i); heal(200); } } current_pc = first_active_pc(); if (current_pc > 5) { for (i = 0; i < NUM_OF_PCS; i++) if (adven[i].status > 0) current_pc = i; } put_pc_screen(); set_stat_window(current_pc); }