Exemplo n.º 1
0
void Map_Read (scene::Node& root, Tokeniser& tokeniser, EntityCreator& entityTable, const PrimitiveParser& parser)
{
	// Create an info display panel to track load progress
	gtkutil::ModalProgressDialog dialog(GlobalRadiant().getMainWindow(), _("Loading map"));

	// Read each entity in the map, until EOF is reached
	for (int entCount = 0; ; entCount++) {
		// Update the dialog text
		dialog.setText("Loading entity " + string::toString(entCount));

		// Check for end of file
		if (tokeniser.getToken().empty())
			break;

		// Create an entity node by parsing from the stream
		NodeSmartReference entity(Entity_parseTokens(tokeniser, entityTable, parser, entCount));

		if (entity == g_nullNode) {
			globalErrorStream() << "entity " << entCount << ": parse error\n";
			return;
		}

		// Insert the new entity into the scene graph
		Node_getTraversable(root)->insert(entity);
	}
}
Exemplo n.º 2
0
void Map_Read(scene::Node& root, Tokeniser& tokeniser, EntityCreator& entityTable, const PrimitiveParser& parser)
{
  int count_entities = 0;
  for(;;)
  {
    tokeniser.nextLine();
    if (!tokeniser.getToken()) // { or 0
		  break;

    NodeSmartReference entity(Entity_parseTokens(tokeniser, entityTable, parser, count_entities));

    if(entity == g_nullNode)
    {
      globalErrorStream() << "entity " << count_entities << ": parse error\n";
      return;
    }

    Node_getTraversable(root)->insert(entity);

    ++count_entities;
  }
}