
/* Type Definition */


/*memo
	OBJECT						= 0x80,
		BUILDING				= 0xB0,
			Refuge				= 0xB8,
			FireStation			= 0xB9,
			AmbulanceCenter		= 0xBA,
			PoliceOffice		= 0xBB,
		ROAD					= 0xA8,
		RIVER					= 0xA9,
		NODE					= 0xC8,
		RiverNode				= 0xC9,
		HUMANOID				= 0xE0,
			CIVILIAN			= 0xE8,
			CAR			= 0xEC,
			FIRE_FIGHTER		= 0xE9,
			AmbulancePerson		= 0xEA,
			PoliceOfficer		= 0xEB,
		WORLD				= 0xD0,
*/

Object
{
	<<<<
	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;
	}
	void setOwner(class RescueObjectPool* owner)
	{
		m_owner = owner;
	}
protected:
	RescueObjectPool* m_owner;
private:
	Objects m_contents;
	>>>>
};

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

real World@0xD0 isakindof VirtualObject
{
	<<<<
	virtual S32 x() const { return 0; }
	virtual S32 y() const { return 0; }
	>>>>
	S32 startTime@29 = 0;
	S32 longitude@30 = 0;
	S32 latitude@31 = 0;
	S32 windForce@32 = 0;
	S32 windDirection@33 = 0;
};


MotionlessObject isakindof RealObject
{
};

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;
	virtual S32 y() const;
	>>>>
};


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;
	setless 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;		//ݥꥴ & ݥꥴɸ
	<<<<
	void setFieryness(S32 time, S32 value);
	>>>>
};

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

real Refuge@0xB8 isakindof Building
{
};


Edge isakindof MotionlessObject
{
	Object head@12;
	Object tail@13;
	S32 length@24 = 1;
	<<<<
	S32 x() const {
		ASSERT(dynamic_cast<RealObject*>(head()) != 0);
		ASSERT(dynamic_cast<RealObject*>(tail()) != 0);
		S32 h = ((RealObject*)head())->x();	// ꤬ Edge λ̵¥롼
		S32 t = ((RealObject*)tail())->x();
		return (h + t) / 2;				// TODO: Сեʤ褦
	}
	S32 y() const {
		ASSERT(dynamic_cast<RealObject*>(head()) != 0);
		ASSERT(dynamic_cast<RealObject*>(tail()) != 0);
		S32 h = ((RealObject*)head())->y();	// ꤬ Edge λ̵¥롼
		S32 t = ((RealObject*)tail())->y();
		return (h + t) / 2;				// TODO: Сեʤ褦
	}
	>>>>
};

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;
	
	<<<<
	void testConnect(S32 time, Edge* edge, bool head) {
		if(head) {
			ASSERT(edge->head() == 0);
			edge->setHead(time, this);
		} else {
			ASSERT(edge->tail() == 0);
			edge->setTail(time, this);
		}
		m_edges.push_back(edge);
		m_timeEdgesUpdated = time;
	}
	>>>>
};

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

real RiverNode@0xC9 isakindof Vertex
{
};

<<<<
	inline S32 MovingObject::x() const {
		ASSERT(dynamic_cast<RealObject*>(position()) != 0);
		Edge* edge = dynamic_cast<Edge*>(position());
		if (edge != 0) {
			S32 length = edge->length();
			if (length != 0) {
				S32 h = ((RealObject*)edge->head())->x();
				S32 t = ((RealObject*)edge->tail())->x();
				return h + (S32)((t - h) * (double)positionExtra() / edge->length());
			}
		}
		return ((RealObject*)position())->x();
	}
	inline S32 MovingObject::y() const {
		ASSERT(dynamic_cast<RealObject*>(position()) != 0);
		Edge* edge = dynamic_cast<Edge*>(position());
		if (edge != 0) {
			S32 length = edge->length();
			if (length != 0) {
				S32 h = ((RealObject*)edge->head())->y();
				S32 t = ((RealObject*)edge->tail())->y();
				return h + (S32)((t - h) * (double)positionExtra() / edge->length());
			}
		}
		return ((RealObject*)position())->y();
	}
>>>>

