Exemplo n.º 1
0
void Area::loadPlaceables(const Aurora::GFF3List &list) {
	for (Aurora::GFF3List::const_iterator p = list.begin(); p != list.end(); ++p) {
		Placeable *placeable = new Placeable(**p);

		loadObject(*placeable);
	}
}
Exemplo n.º 2
0
void Area::loadCreatures(const Aurora::GFF3List &list) {
	for (Aurora::GFF3List::const_iterator c = list.begin(); c != list.end(); ++c) {
		Creature *creature = new Creature(**c);

		loadObject(*creature);
	}
}
Exemplo n.º 3
0
void Area::loadTriggers(const Aurora::GFF3List &list) {
	for (Aurora::GFF3List::const_iterator c = list.begin(); c != list.end(); ++c) {
		Trigger *trigger = new Trigger(**c);

		loadObject(*trigger);
	}
}
Exemplo n.º 4
0
void Area::loadWaypoints(const Aurora::GFF3List &list) {
	for (Aurora::GFF3List::const_iterator w = list.begin(); w != list.end(); ++w) {
		Waypoint *waypoint = new Waypoint(**w);

		loadObject(*waypoint);
	}
}
Exemplo n.º 5
0
void Area::loadDoors(const Aurora::GFF3List &list) {
	for (Aurora::GFF3List::const_iterator d = list.begin(); d != list.end(); ++d) {
		Door *door = new Door(*_module, **d);

		loadObject(*door);
	}
}
Exemplo n.º 6
0
void GFF3Dumper::dumpList(const Aurora::GFF3List &list) {
	if (!list.empty())
		_xml->breakLine();

	for (Aurora::GFF3List::const_iterator e = list.begin(); e != list.end(); ++e)
		dumpStruct(**e);
}
Exemplo n.º 7
0
void Area::loadTiles(const Aurora::GFF3List &tiles) {
	size_t n = 0;
	for (Aurora::GFF3List::const_iterator t = tiles.begin(); t != tiles.end(); ++t, ++n) {
		assert(n < (_width * _height));

		loadTile(**t, _tiles[n]);
	}

	assert(n == _tiles.size());
}
Exemplo n.º 8
0
void Object::readVarTable(const Aurora::GFF3List &varTable) {
	for (Aurora::GFF3List::const_iterator v = varTable.begin(); v != varTable.end(); ++v) {
		const Common::UString name  = (*v)->getString ("Name");
		const int32           type  = (*v)->getSint   ("Type");

		if (name.empty())
			continue;

		switch (type) {
			case -1:
				setVariable(name, Aurora::NWScript::Variable());
				break;

			case  1:
				setVariable(name, (int32) (*v)->getSint("Value"));
				break;

			case  2:
				setVariable(name, (float) (*v)->getDouble("Value"));
				break;

			case  3:
				setVariable(name, (*v)->getString("Value"));
				break;

			case  4:
				setVariable(name, (int32)((uint32) (*v)->getUint("Value")));
				break;

			case  5:
				warning("TODO: Object::readVarTable(), \"%s\" has location type", name.c_str());
				setVariable(name, Aurora::NWScript::Variable());
				break;

			default:
				throw Common::Exception("Unknown variable type %u (\"%s\")", type, name.c_str());
		}
	}
}
Exemplo n.º 9
0
void Placeable::loadObject(const Aurora::GFF3Struct &gff) {
	// State

	_state = (State) gff.getUint("AnimationState", (uint) _state);

	// Inventory

	_hasInventory = gff.getBool("HasInventory", _hasInventory);

	if (_hasInventory && gff.hasField("ItemList")) {
		Aurora::GFF3List classList = gff.getList("ItemList");
		for (Aurora::GFF3List::const_iterator iter = classList.begin(); iter != classList.end(); ++iter) {
			const Aurora::GFF3Struct &item = **iter;
			_inventory.addItem(item.getString("InventoryRes"));
		}
	}

	// Hit Points

	_currentHitPoints = gff.getSint("CurrentHP");
	_maxHitPoints = gff.getSint("HP");

	_minOneHitPoint = gff.getBool("Min1HP");
}