Beispiel #1
0
		void FromPB(const PB_NPCAtt *pb_) {
			id_ = pb_->id();
			att_.FromPB(&pb_->att());
			pic_ = pb_->pic();
			strncpy(desc_, pb_->desc().c_str(), desc_size() - 1);
			desc_[desc_size() - 1] = '\0';
			funcAtt_.FromPB(&pb_->funcAtt());
			dropID_ = pb_->dropID();
			if (peddleAudio_size() <= pb_->peddleAudio_size()) {
				for (int i = 0; i < peddleAudio_size(); i++)
					peddleAudio_[i] = pb_->peddleAudio(i);
			} else {
				for (int i = 0; i < pb_->peddleAudio_size(); i++)
					peddleAudio_[i] = pb_->peddleAudio(i);
				for (int i = pb_->peddleAudio_size(); i < peddleAudio_size(); i++)
					peddleAudio_[i] = 0;
			}
			peddleMaxDistance_ = pb_->peddleMaxDistance();
			peddleMinInterval_ = pb_->peddleMinInterval();
			peddleMaxInterval_ = pb_->peddleMaxInterval();
			if (talkAudio_size() <= pb_->talkAudio_size()) {
				for (int i = 0; i < talkAudio_size(); i++)
					talkAudio_[i] = pb_->talkAudio(i);
			} else {
				for (int i = 0; i < pb_->talkAudio_size(); i++)
					talkAudio_[i] = pb_->talkAudio(i);
				for (int i = pb_->talkAudio_size(); i < talkAudio_size(); i++)
					talkAudio_[i] = 0;
			}
			bornTime_ = pb_->bornTime();
			shockDelay_ = pb_->shockDelay();
			shockTime_ = pb_->shockTime();
			bornEffect_ = pb_->bornEffect();
			bornEffectTime_ = pb_->bornEffectTime();
			specialPercent_ = pb_->specialPercent();
			bearAudio_ = pb_->bearAudio();
			dieAudio_ = pb_->dieAudio();
			color_ = (ColorType)pb_->color();
			hue_ = pb_->hue();
			if (equips_size() <= pb_->equips_size()) {
				for (int i = 0; i < equips_size(); i++)
					equips_[i].FromPB(&pb_->equips(i));
			} else {
				for (int i = 0; i < pb_->equips_size(); i++)
					equips_[i].FromPB(&pb_->equips(i));
				for (int i = pb_->equips_size(); i < equips_size(); i++)
					equips_[i] = EquipAsset();
			}
			newSpecial_ = pb_->newSpecial();
			type_ = pb_->type();
			quality_ = pb_->quality();
			level_ = pb_->level();
			goodsID_ = pb_->goodsID();
			goodsCount_ = pb_->goodsCount();
			dieEffect_ = pb_->dieEffect();
		}
Beispiel #2
0
/*
 * hotplug_device tries to find changes in the device page.
 */
static void hotplug_devices(struct work_struct *dummy)
{
	unsigned int i;
	struct kvm_device_desc *d;
	struct device *dev;

	for (i = 0; i < PAGE_SIZE; i += desc_size(d)) {
		d = kvm_devices + i;

		/* end of list */
		if (d->type == 0)
			break;

		/* device already exists */
		dev = device_find_child(kvm_root, d, match_desc);
		if (dev) {
			/* XXX check for hotplug remove */
			put_device(dev);
			continue;
		}

		/* new device */
		printk(KERN_INFO "Adding new virtio device %p\n", d);
		add_kvm_device(d, i);
	}
}
/*D:110
 * scan_devices() simply iterates through the device page.  The type 0 is
 * reserved to mean "end of devices".
 */
static void scan_devices(void)
{
	unsigned int i;
	struct lguest_device_desc *d;

	/* We start at the page beginning, and skip over each entry. */
	for (i = 0; i < PAGE_SIZE; i += desc_size(d)) {
		d = lguest_devices + i;

		/* Once we hit a zero, stop. */
		if (d->type == 0)
			break;

		printk("Device at %i has size %u\n", i, desc_size(d));
		add_lguest_device(d, i);
	}
}
Beispiel #4
0
/*
 * scan_devices() simply iterates through the device page.
 * The type 0 is reserved to mean "end of devices".
 */
static void scan_devices(void)
{
	unsigned int i;
	struct kvm_device_desc *d;

	for (i = 0; i < PAGE_SIZE; i += desc_size(d)) {
		d = kvm_devices + i;

		if (d->type == 0)
			break;

		add_kvm_device(d, i);
	}
}
Beispiel #5
0
		inline void set_desc(const char * value) {
			strncpy(desc_, value, desc_size() - 1);
			desc_[desc_size() - 1] = '\0';
		}