Changeset 262
- Timestamp:
- 07/04/07 11:39:56 (1 year ago)
- Files:
-
- trunk/lib/edit/limits.txt (modified) (1 diff)
- trunk/src/externs.h (modified) (1 diff)
- trunk/src/object2.c (modified) (5 diffs)
- trunk/src/snd-sdl.c (modified) (2 diffs)
- trunk/src/squelch.c (modified) (1 diff)
- trunk/src/ui.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/edit/limits.txt
r157 r262 52 52 53 53 # Maximum number of objects on the level 54 M:O: 51254 M:O:1024 55 55 56 56 # Maximum number of monsters on the level trunk/src/externs.h
r250 r262 599 599 void autoinscribe_pack(void); 600 600 601 bool squelch_item_ok(const object_type *o_ptr); 601 602 void squelch_set(object_type *o_ptr); 602 603 bool squelch_hide_item(object_type *o_ptr); trunk/src/object2.c
r259 r262 287 287 288 288 /* 289 * Compact and Reorder the object list289 * Compact and reorder the object list 290 290 * 291 291 * This function can be very dangerous, use with caution! 292 292 * 293 * When actually "compacting" objects, we base the saving throw on a 294 * combination of object level, distance from player, and current 295 * "desperation". 296 * 297 * After "compacting" (if needed), we "reorder" the objects into a more 298 * compact order, and we reset the allocation info, and the "live" array. 293 * When compacting objects, we first destroy gold, on the basis that by the 294 * time item compaction becomes an issue, the player really won't care. 295 * We also nuke items marked as squelch. 296 * 297 * When compacting other objects, we base the saving throw on a combination of 298 * object level, distance from player, and current "desperation". 299 * 300 * After compacting, we "reorder" the objects into a more compact order, and we 301 * reset the allocation info, and the "live" array. 299 302 */ 300 303 void compact_objects(int size) … … 303 306 int px = p_ptr->px; 304 307 305 int i, y, x, num,cnt;308 int i, y, x, cnt; 306 309 307 310 int cur_lev, cur_dis, chance; 308 311 309 312 310 /* Compact */ 311 if (size) 312 { 313 /* Message */ 314 msg_print("Compacting objects..."); 315 316 /* Redraw map */ 317 p_ptr->redraw |= (PR_MAP); 318 319 /* Window stuff */ 320 p_ptr->window |= (PW_OVERHEAD | PW_MAP); 313 /* Reorder objects when not passed a size */ 314 if (!size) 315 { 316 /* Excise dead objects (backwards!) */ 317 for (i = o_max - 1; i >= 1; i--) 318 { 319 object_type *o_ptr = &o_list[i]; 320 321 /* Skip real objects */ 322 if (o_ptr->k_idx) continue; 323 324 /* Move last object into open hole */ 325 compact_objects_aux(o_max - 1, i); 326 327 /* Compress "o_max" */ 328 o_max--; 329 } 330 331 return; 332 } 333 334 335 /* Message */ 336 msg_print("Compacting objects..."); 337 338 /* Redraw map */ 339 p_ptr->redraw |= (PR_MAP); 340 341 /* Window stuff */ 342 p_ptr->window |= (PW_OVERHEAD | PW_MAP); 343 344 345 346 347 /*** Try destroying objects ***/ 348 349 /* First do gold */ 350 for (i = 1; (i < o_max) && (size); i++) 351 { 352 object_type *o_ptr = &o_list[i]; 353 354 /* Nuke gold or squelched items */ 355 if (o_ptr->tval == TV_GOLD || squelch_item_ok(o_ptr)) 356 { 357 delete_object_idx(i); 358 size--; 359 } 321 360 } 322 361 323 362 324 363 /* Compact at least 'size' objects */ 325 for ( num = 0, cnt = 1; num <size; cnt++)364 for (cnt = 1; size; cnt++) 326 365 { 327 366 /* Get more vicious each iteration */ … … 332 371 333 372 /* Examine the objects */ 334 for (i = 1; i < o_max; i++)373 for (i = 1; (i < o_max) && (size); i++) 335 374 { 336 375 object_type *o_ptr = &o_list[i]; 337 338 376 object_kind *k_ptr = &k_info[o_ptr->k_idx]; 339 377 … … 377 415 chance = 90; 378 416 379 /* Squelched items get compacted */380 if (k_ptr->aware && k_ptr->squelch) chance = 0;381 382 417 383 418 /* Hack -- only compact artifacts in emergencies */ … … 389 424 /* Delete the object */ 390 425 delete_object_idx(i); 391 392 /* Count it */ 393 num++; 394 } 395 } 396 397 398 /* Excise dead objects (backwards!) */ 399 for (i = o_max - 1; i >= 1; i--) 400 { 401 object_type *o_ptr = &o_list[i]; 402 403 /* Skip real objects */ 404 if (o_ptr->k_idx) continue; 405 406 /* Move last object into open hole */ 407 compact_objects_aux(o_max - 1, i); 408 409 /* Compress "o_max" */ 410 o_max--; 411 } 426 size--; 427 } 428 } 429 430 431 /* Reorder objects */ 432 compact_objects(0); 412 433 } 413 434 trunk/src/snd-sdl.c
r166 r262 58 58 static void close_audio(void) 59 59 { 60 size_t i, j; 60 size_t i; 61 int j; 61 62 62 63 /* Free all the sample data*/ … … 123 124 char path[2048]; 124 125 char buffer[2048]; 125 int i;126 126 FILE *fff; 127 Mix_Chunk *wave = NULL;128 127 129 128 trunk/src/squelch.c
r245 r262 316 316 * Determines if an object is eligable for squelching. 317 317 */ 318 staticbool squelch_item_ok(const object_type *o_ptr)318 bool squelch_item_ok(const object_type *o_ptr) 319 319 { 320 320 size_t i; trunk/src/ui.c
r256 r262 96 96 void stop_event_loop() 97 97 { 98 event_type stop = { EVT_STOP };98 event_type stop = { EVT_STOP, 0, 0, 0, 0 }; 99 99 100 100 /* Stop right away! */ … … 647 647 { 648 648 /* TODO: need a panel dispatcher here, not a generic target */ 649 event_target t = { { 0, 0, 0, 0 }, FALSE, 0 /* menu->target.observers */};649 event_target t = { EVENT_EMPTY, FALSE, 0 /* menu->target.observers */}; 650 650 t.observers = menu->target.observers; 651 651 out = run_event_loop(&t, FALSE, in);
