00001 /* $Id: unit_id.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */ 00002 /* 00003 Copyright (C) 2008 - 2012 by David White <dave@whitevine.net> 00004 Part of the Battle for Wesnoth Project http://www.wesnoth.org/ 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY. 00012 00013 See the COPYING file for more details. 00014 */ 00015 00016 00017 #ifndef UNIT_ID_HPP_INCLUDED 00018 #define UNIT_ID_HPP_INCLUDED 00019 00020 #include <ctime> 00021 00022 #include <boost/noncopyable.hpp> 00023 00024 namespace n_unit { 00025 00026 class id_manager : private boost::noncopyable { 00027 private: 00028 size_t next_id_; 00029 size_t fake_id_; 00030 static id_manager manager_; 00031 id_manager(); 00032 public: 00033 static id_manager& instance(); 00034 /** returns id for unit that is created */ 00035 size_t next_id(); 00036 00037 size_t next_fake_id(); 00038 00039 /** Used for saving id to savegame */ 00040 size_t get_save_id(); 00041 void set_save_id(size_t); 00042 /** Clears id counter after game */ 00043 void clear(); 00044 void reset_fake(); 00045 }; 00046 00047 } 00048 00049 #endif
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:03:14 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |