/*
	BinMaker program
	Copyright 2007 Jonathan Wilson
	Portions lifted from BinOpener copyright 2007 booto (temptemp91 at hotmail dot com)

	This file is part of binmaker.

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	binmaker is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

*/
#include <stdio.h>
#include "manifestitem.h"
#include "road.h"

Road::Road(const char *streamname,const char *sourcename,unsigned int hash2, unsigned int hash4, float roadwidth, float roadwidthintexture, float roadpriority, int roadhasnormal)
{
	StreamName = _strdup(streamname);
	SourceName = _strdup(sourcename);
	Header.filenamehash1 = 0xd19d90c6;
	Header.filenamehash2 = hash2;
	Header.filenamehash3 = 0xdcf3c28b;
	Header.filenamehash4 = hash4;
	StreamSize = 24;
	StreamData = new char[StreamSize];
	memset(StreamData,0,StreamSize);
	((unsigned int *)StreamData)[0] = 0;
	((unsigned int *)StreamData)[1] = 0;
	if (roadhasnormal)
	{
		((unsigned int *)StreamData)[2] = 1;
	}
	else
	{
		((unsigned int *)StreamData)[2] = 0;
	}
	((float *)StreamData)[3] = roadwidth;
	((float *)StreamData)[4] = roadwidthintexture;
	((float *)StreamData)[5] = roadpriority;
}
