Exemple #1
0
void Floor::dump(output_stream &stream, boolean just_prepare) {
   if (just_prepare) {
      if (items != NULL) items->dump(stream,FALSE,just_prepare);
      return;
   };
   stream.put(FLOOR_MARKER);
   if (items != NULL) {
		items->dump(stream,TRUE);
//      Sprites *sorted_items = sort_items(items); // commented out on 210100 since robots now save links to working cubby
		// commented out the following on 050100 since now if tt_toolbox is responsible it is dumped specially
//      if (tt_toolbox != NULL) {
//         Sprites *non_toolbox_items = NULL;
//         Sprites *remaining = items;
//         while (remaining != NULL) {
//            Sprite *sprite = remaining->first();
//            if (!toolbox_tool(sprite)) {
//              insert_at_end(sprite,non_toolbox_items);
//            };
//            remaining = remaining->rest();
//        };
//         sorted_items = sort_items(non_toolbox_items);
//         non_toolbox_items->remove_all();
//         delete non_toolbox_items;
//      } else {
//         sorted_items = sort_items(items);
//      };
//      if (sorted_items != NULL) {
//         sorted_items->dump(stream,TRUE);
//         sorted_items->remove_all();
//         delete sorted_items;
//      };
   };
   stream.put(END_OF_LIST_MARKER);
	stream.write((char *) &current_priority, sizeof(current_priority)); // new on 150100
};
boolean Thought_Bubble::dump(output_stream &stream, boolean just_prepare, boolean , boolean ) {
   if (just_prepare) return(FALSE);
   int dump_index = about_to_dump(this,stream); // rewritten on 020802
	if (dump_index < 0) return(FALSE); // new on 051099
#if TT_DEBUG_ON
	if (tt_debug_mode == 160299 && !tt_dumping_to_test_equality_or_describe) {
		print_spaces(min(tt_debug_dump_depth,max_debug_depth),tt_error_file());
		tt_error_file() << "About to dump ";
		print(tt_error_file());
		tt_error_file() << endl;
		tt_debug_dump_depth++;
	};
#endif
   if (cubby != NULL) { // && cubby->pointer_to_leader() == this) {
		// changed to top_level_dump on 060201 since there should be no connections between stuff in the thought bubble and outside 
      cubby->top_level_dump(stream);
	} else if (robot->pointer_to_body() != NULL) { // a bit of a hack to distinguish trained robots with empty thought bubbles from untrained ones
		stream.put(NOTHING_MARKER);
	} else {
		stream.put((char) NONE_GIVEN);
	};
#if TT_DEBUG_ON
	if (tt_debug_mode == 160299 && !tt_dumping_to_test_equality_or_describe) {
		print_spaces(min(tt_debug_dump_depth,max_debug_depth),tt_error_file());
		tt_error_file() << "Finished dumping ";
		print(tt_error_file());
		tt_error_file() << endl;
		tt_debug_dump_depth--;
	};
#endif
	return(TRUE);
};
Exemple #3
0
void Room::dump(output_stream &stream, boolean just_prepare) {
   if (just_prepare) {
      if (wall_decoration != NULL) wall_decoration->dump(stream,just_prepare);
      if (items != NULL) {
			items->dump(stream,FALSE,just_prepare);
		};
      return;
   };
   stream.put(ROOM_MARKER);
   if (wall_decoration != NULL) {
//		wall_decoration->propagate_changes(); // new on 160601 to get offsets right
      wall_decoration->dump(stream);
		// rewrote the above on 090400 to get the geometry to save correctly
//		Sprite *wall_decoration_copy = wall_decoration->top_level_copy();
//		Sprites *remaining = wall_decoration_copy->pointer_to_followers();
//		while (remaining != NULL) {
//			Sprite *sprite = remaining->first();
//			sprite->move_by(-sprite->return_old_x_offset(),-sprite->return_old_y_offset());
//			remaining = remaining->rest();
//		};
//		wall_decoration_copy->dump(stream);
//		wall_decoration_copy->destroy();
		wall_decoration->set_ok_to_dump(FALSE); // i.e. not when items are dumped below - note this really means don't dump if part of a list - will still be dumped as decoration from here
   } else {
      stream.put(NOTHING_MARKER);
   };
//   Sprites *sorted_items = sort_items(items); // commented out on 210100 since robots now save links to working cubby
   if (items != NULL) {
		items->dump(stream,TRUE);
   };
//   if (sorted_items != NULL) {
//      sorted_items->dump(stream,TRUE);
//      sorted_items->remove_all();
//      delete sorted_items;
//   };
   stream.put(END_OF_LIST_MARKER);
};