
/* Type Definition */

Object
{
	<<<<
	virtual S32 x() const = 0;	// TODO:
	virtual S32 y() const = 0;	// TODO:
	const Objects& contents() const
	{
		return m_contents;
	}
	void addContent(S32 time, Object* object)
	{
		m_contents.push_back(object);
		//m_timeContentsUpdated = time;
	}
	void removeContent(S32 time, Object* content)
	{
		m_contents.remove(content);
		//m_timeContentsUpdated = time;
	}
private:
	Objects m_contents;
	>>>>
};

VirtualObject isakindof Object
{
	<<<<
	S32 x() const { return 0; }	// 
	S32 y() const { return 0; }	// 
	>>>>
};
RealObject isakindof Object
{
	<<<<
	virtual S32 x() const = 0;
	virtual S32 y() const = 0;
	>>>>
};

real World@0xD0 isakindof VirtualObject
{
	S32 startTime@29 = 0;
	S32 longitude@30 = 0;
	S32 latitude@31 = 0;
	S32 windForce@32 = 0;
	S32 windDirection@33 = 0;
};


MotionlessObject isakindof RealObject
{
	<<<<
	virtual const Objects& neighbors() const = 0;
	>>>>
};

PointObject isakindof MotionlessObject
{
	S32 x@3 = 0;
	S32 y@4 = 0;
};

MovingObject isakindof RealObject
{
	setless Object position@6;
	S32 positionExtra@7;
	S32 direction@27;
	Objects positionHistory@-49;
	<<<<
	void setPosition(S32 time, Object* value)
	{
		if(m_position != 0)
			m_position->removeContent(time, this);
		if(value != 0)
			value->addContent(time, this);
		m_position = value;
		m_timePositionUpdated = time;
	}
	virtual S32 x() const {
		ASSERT(position());
		// TODO: position()  edge  ΤȤɤͤФ
		return position()->x();
	}
	virtual S32 y() const {
		ASSERT(position());
		return position()->y();
	}
	>>>>
};


Humanoid isakindof MovingObject
{
	S32 stamina@9 = 10000;
	S32 hp@10 = 10000;
	S32 damage@11 = 0;
	S32 buriedness@23 = 0;
};

real Building@0xB0 isakindof PointObject
{
	S32 floors@14 = 1;
	S32 buildingAttributes@15 = 0;
	S32 ignition@48 = 0;
	S32 fieryness@16 = 0;
	S32 brokenness@17 = 0;
	Objects entrances@-21 = 0;
	//S32 buildingShapeId@49;		//ʪο޷ID
	S32 buildingCode@50;		//ʪ¤ʹ¤ɽ魯ֹ
	S32 buildingAreaGround@51;	//
	S32 buildingAreaTotal@52;	//پ
	//S32 buildingApexes@53;		//ݥꥴ & ݥꥴɸ
	Bytes buildingApexes@131;		//ݥꥴ & ݥꥴɸ
	<<<<
	virtual const Objects& neighbors() const
	{
		return entrances();
	}
	>>>>
};

real Civilian@0xE8 isakindof Humanoid
{
};
real Car@0xEC isakindof Humanoid
{
};
real FireBrigade@0xE9 isakindof Humanoid
{
	S32 waterQuantity@25 = 0;
	S32 stretchedLength@26 = 0;
};
real FireStation@0xB9 isakindof Building
{
};
real AmbulanceTeam@0xEA isakindof Humanoid
{
};
real AmbulanceCenter@0xBA isakindof Building
{
};
real PoliceForce@0xEB isakindof Humanoid
{
};
real PoliceOffice@0xBB isakindof Building
{
};

real Refuge@0xB8 isakindof Building
{
};


Edge isakindof MotionlessObject
{
	Object head@12;
	Object tail@13;
	S32 length@24 = 1;
	<<<<
	virtual const Objects& neighbors() const
	{
		if(m_neighbors.size() != 2 || m_neighbors.front() != head() || m_neighbors.back() != tail()) {
			m_neighbors.clear();
			m_neighbors.push_back(head());
			m_neighbors.push_back(tail());
		}
		return m_neighbors;
	}
	S32 x() const { return (head()->x() + tail()->x()) / 2; }	// ꤬ Edge λ̵¥롼
	S32 y() const { return (head()->y() + tail()->y()) / 2; }	// ꤬ Edge λ̵¥롼
private:
	mutable Objects m_neighbors;
	>>>>
};

real Road@0xA8 isakindof Edge
{
	S32 roadKind@19 = 0;
	S32 carsPassToHead@34 = 0;
	S32 carsPassToTail@35 = 0;
	S32 humansPassToHead@36 = 0;
	S32 humansPassToTail@37 = 0;
	S32 width@38 = 10;
	S32 block@22 = 0;
	S32 repairCost@39 = 0;
	S32 medianStrip@40 = 0;
	S32 linesToHead@41 = 1;
	S32 linesToTail@42 = 1;
	S32 widthForWalkers@43 = 1;
};

real River@0xA9 isakindof Edge
{
};

Vertex isakindof PointObject
{
	setless Objects edges@-14;
	
	<<<<
	virtual const Objects& neighbors() const
	{
		return edges();
	}
	>>>>
};

real Node@0xC8 isakindof Vertex
{
	S32 signal@44 = 0;
	Bytes shortcutToTurn@128;
	Bytes pocketToTurnAcross@129;
	Bytes signalTiming@130;
};

real RiverNode@0xC9 isakindof Vertex
{
};
