aboutsummaryrefslogtreecommitdiff
path: root/assets/magleves_lockomotive.blend
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2017-02-09 00:11:28 +0100
committerorwell96 <mono96.mml@gmail.com>2017-02-09 00:13:36 +0100
commit3f382974b85c99fdd9b985cba20b19dded42dd6b (patch)
tree1bc84065dbdeddb57f701c1255901b4219a76f0b /assets/magleves_lockomotive.blend
parent4abb967f921c9d965c0746230b0756736f540dd3 (diff)
downloadadvtrains-3f382974b85c99fdd9b985cba20b19dded42dd6b.tar.gz
advtrains-3f382974b85c99fdd9b985cba20b19dded42dd6b.tar.bz2
advtrains-3f382974b85c99fdd9b985cba20b19dded42dd6b.zip
Proper implementation for getting on by walking into train, rework damage and player controls in train, fix death and join bugs, do not spawn bones on death
Diffstat (limited to 'assets/magleves_lockomotive.blend')
0 files changed, 0 insertions, 0 deletions
e details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "ban.h" #include <fstream> #include <jmutexautolock.h> #include <sstream> #include "strfnd.h" #include "debug.h" BanManager::BanManager(const std::string &banfilepath): m_banfilepath(banfilepath), m_modified(false) { m_mutex.Init(); try{ load(); } catch(SerializationError &e) { dstream<<"WARNING: BanManager: creating " <<m_banfilepath<<std::endl; } } BanManager::~BanManager() { save(); } void BanManager::load() { JMutexAutoLock lock(m_mutex); dstream<<"BanManager: loading from "<<m_banfilepath<<std::endl; std::ifstream is(m_banfilepath.c_str(), std::ios::binary); if(is.good() == false) { dstream<<"BanManager: failed loading from "<<m_banfilepath<<std::endl; throw SerializationError("BanManager::load(): Couldn't open file"); } for(;;) { if(is.eof() || is.good() == false) break; std::string ip; std::getline(is, ip, '\n'); m_ips.insert(ip); } m_modified = false; } void BanManager::save() { JMutexAutoLock lock(m_mutex); dstream<<"BanManager: saving to "<<m_banfilepath<<std::endl; std::ofstream os(m_banfilepath.c_str(), std::ios::binary); if(os.good() == false) { dstream<<"BanManager: failed loading from "<<m_banfilepath<<std::endl; throw SerializationError("BanManager::load(): Couldn't open file"); } for(std::set<std::string>::iterator i = m_ips.begin(); i != m_ips.end(); i++) { if(*i == "") continue; os<<*i<<"\n"; } m_modified = false; } bool BanManager::isIpBanned(std::string ip) { JMutexAutoLock lock(m_mutex); return m_ips.find(ip) != m_ips.end(); } void BanManager::add(std::string ip) { JMutexAutoLock lock(m_mutex); m_ips.insert(ip); m_modified = true; } void BanManager::remove(std::string ip) { JMutexAutoLock lock(m_mutex); m_ips.erase(m_ips.find(ip)); m_modified = true; } bool BanManager::isModified() { JMutexAutoLock lock(m_mutex); return m_modified; }