Example #1
0
/**
 * \copydoc LuaData::export_to_lua
 */
bool MapData::export_to_lua(std::ostream& out) const {

  // Write map properties.
  out << "properties{\n"
      << "  x = " << get_location().x << ",\n"
      << "  y = " << get_location().y << ",\n"
      << "  width = " << get_size().width << ",\n"
      << "  height = " << get_size().height << ",\n";
  if (has_world()) {
    out << "  world = \"" << get_world() << "\",\n";
  }
  if (has_floor()) {
    out << "  floor = " << get_floor() << ",\n";
  }
  out << "  tileset = \"" << get_tileset_id() << "\",\n";
  if (has_music()) {
    out << "  music = \"" << get_music_id() << "\",\n";
  }
  out << "}\n\n";

  for (const EntityList& layer_entities : entities) {
    for (const EntityData& entity_data : layer_entities.entities) {
      bool success = entity_data.export_to_lua(out);
      Debug::check_assertion(success, "Entity export failed");
    }
  }

  return true;
}
Example #2
0
void run_test(void)
{
	int personTargetFloor;
	for(int currentFloor=0;currentFloor<FLOOR;currentFloor++){//Hardcode FLORR->100.
		move_elevator(currentFloor);
		personTargetFloor=get_floor();
		//Proceed only if person belongs to other floor..
		if(personTargetFloor!=currentFloor){
			//Load him to elevator..
			load_elevator();
			//Iterate till no person moved to elevator..
			while(personTargetFloor!=-1){
				move_elevator(personTargetFloor);
				personTargetFloor=get_floor();
				exchange_elevator();
			}
		}

	}
}
Example #3
0
/**
 * \brief Returns whether this map has a floor.
 *
 * This function returns true if the floor is not nil.
 *
 * \return true if there is a floor.
 */
bool Map::has_floor() const {
  return get_floor() != NO_FLOOR;
}
Example #4
0
/**
 * \brief Returns whether this map has a floor.
 *
 * This function returns true if the floor is not MapData::NO_FLOOR.
 *
 * \return true if there is a floor.
 */
bool Map::has_floor() const {
  return get_floor() != MapData::NO_FLOOR;
}