Filter:   InfoImg
download world.h
Language: C++
LOC: 53
Project Info
Ultima Online Project(uop)
Server: SourceForge
Type: cvs
SourceForge\u\uop\uop\uop\
   acinclude.m4
   aclocal.m4
   action.cc
   action.h
   animation.cc
   animation.h
   artexport.cc
   artfactory.cc
   artfactory.h
   audio.cc
   audio.h
   btree.cc
   btree.h
   cache.h
   cliloc.cc
   cliloc.h
   config.h.in
   configure.in
   cvs2cl.pl
   entity.cc
   entity.h
   gumps.cc
   gumps.h
   interface.cc
   interface.h
   interfacegumps.cc
   interfacegumps.h
   interfacehandler.cc
   interfacehandler.h
   intrface.def
   Makefile.am
   Makefile.in
   message.cc
   message.h
   musicmap.def
   network.cc
   network.h
   patchhandler.cc
   patchhandler.h
   readable.pl
   serverhandler.cc
   serverhandler.h
   sprite.cc
   sprite.h
   stamp-h.in
   texthandler.cc
   texthandler.h
   tiledata.cc
   tiledata.h
   unreadable.pl
   uop.cc
   uop.cfg
   uop.dox
   uop.h
   uopconfig.cc
   uopconfig.h
   uosprite.h
   uostub.pl
   world.cc
   world.h

#ifndef __WORLD_H__
#define __WORLD_H__

#include <SDL/SDL.h>
#include "artfactory.h"
#include "sprite.h"
#include "entity.h"
#include "cache.h"

class Cell
{
 private:
	bool right_order(void);
 public:
	void add(Entity *entity);
	void remove(Entity *entity) { entity->inCell = NULL; entities.remove(entity); }
	void blit(int x, int y);
	list<Entity*> entities;
	LandTile *landTile;
};

class Block
{
 public:
	void produce(Uint32 bid, bool tdmap, Block &block);
	void recycle(Block &block);
	void renderTiles();
	Cell cells[8][8];
	bool rendered;
	Uint32 id;
	bool tdmap;
};

class World
{
 public:
	World();
	~World();
	bool paused(void) const;
	void pause(void);
	void unpause(void);
	Cell *getCell(Uint16 globalX, Uint16 globalY, bool tdmap, bool renderBlock);
		
	Mobile *focus;
	map <Uint32, Mobile*> mobiles;
	
	Cache<Uint32, Sprite, ArtFactory> artSprites;
	MapCache<Uint32, Block, Block, false> mapBlocks; /**< map0.mul block cache */
	MapCache<Uint32, Block, Block, true> mapBlocksTD; /**< map2.mul block cache */

	//ifstream artidx; /**< artidx.mul filehandle */
	//ifstream artfile; /**< art.mul filehandle */
	ifstream mapfile; /**< map0.mul filehandle */
	ifstream tdmapfile; /**< map2.mul filehandle */
	ifstream staidxfile; /**< staidx0.mul filehandle */
	ifstream tdstaidxfile; /**< staidx2.mul filehandle */
	ifstream staticsfile; /**< statics0.mul filehandle */
	ifstream tdstaticsfile; /**< statics2.mul filehandle */
private:
	bool is_paused;
};

#endif