Code Search for Developers
 
 
  

splitlandscapefile.pl from Scorched 3D at Krugle


Show splitlandscapefile.pl syntax highlighted

use strict;

my ($infile, $tag) = @ARGV;
if (!defined $infile)
{
	print "Usage : $0 <infile> <splittag>";
	exit 1;
}

open(IN, $infile) || die "ERROR: Cannot open file $infile";
my @filelines = <IN>;
close(IN);

my ($content, $name) = ("", "");
foreach (@filelines)
{
	s/\t//;
	if (/<name>(\w+)<\/name>/)
	{
		if ($name eq "")
		{
			$name = $1;
		}
		else
		{
			$content .= $_;
		}
	}
	elsif (/<$tag>/)
	{
		$name = "";
		$content = $_;
	}
	else 
	{
		$content .= $_;
	}

	if (/<\/$tag>/)
	{
		my $outfile = $tag.$name.".xml";
		open(OUT, ">$outfile") || die "ERROR: Cannot write $outfile";
		print OUT $content;
		close(OUT);
	}
}




See more files for this project here

Scorched 3D

Scorched3D is a 3D remake of the popular 2D artillery game Scorched Earth.\r\nScorched3D can be played against the computer, other players and remotely across the internet or LAN.

Project homepage: http://sourceforge.net/projects/scorched3d
Programming language(s): C,C++,XML
License: gpl2

  addGPLLines.pl
  checkIncludeCase.pl
  checkMakeRefs.pl
  convertAccessories38-381.pl
  copyall.bat
  copyallnodata.bat
  copyjustsrc.bat
  createAMMakefile.pl
  dos2unixall
  exclude.txt
  exclude2.txt
  generateDiff.pl
  hmm.txt
  make_todo.pl
  moveGroups.pl
  ms3d_ascii_export.py
  openal-config
  removeMSPragma.pl
  removeSlash.pl
  resource.h
  resource.rc
  showChangedOptions.pl
  splitlandscapefile.pl
  updateAmbientSounds.pl
  vcfiles.pl
  weaponDocs.pl
  wxWinFromRC.pl