Fimbulwinter Project  Pre-Alpha
An Ragnarok Online Emulator
ZoneServer/BlockManager.hpp
00001 #pragma once
00002 
00003 #include <map>
00004 #include "MapManager.hpp"
00005 
00006 using namespace std;
00007 
00016 class BlockManager
00017 {
00018 public:
00019         static map<int, struct BlockList *> id2bl;
00020         static map<int, struct ZoneSessionData *> id2pc;
00021 
00022         static void add_block(struct BlockList *bl)
00023         {
00024                 if (bl == 0)
00025                         return;
00026 
00027                 id2bl[bl->id] = bl;
00028         }
00029 
00030         static void remove_block(struct BlockList *bl)
00031         {
00032                 if (bl == 0)
00033                         return;
00034 
00035                 if (id2bl.count(bl->id))
00036                         id2bl.erase(bl->id);
00037         }
00038 
00039         static struct BlockList *get_block(int id)
00040         {
00041                 if (id2bl.count(id))
00042                         return id2bl[id];
00043 
00044                 return 0;
00045         }
00046 
00047         static ZoneSessionData *get_session(int account_id)
00048         {
00049                 if (id2pc.count(account_id))
00050                         return id2pc[account_id];
00051 
00052                 return 0;
00053         }
00054 
00055 private:
00056 
00057 };
 All Classes Functions