All pastes #564971 Raw Edit

blah

public cpp v1 · immutable
·published 2007-06-13 20:20 UTC
rendered paste body
/*! * AbStatusIO *  * *  Saves and loads the game status * * Copyright (c) 2007 by OneManBand Software */#include "StdAfx.h"#include "tuonolib.h"#include "AbStatusIO.h"extern TuCoreServer* tu;AbStatusIO::AbStatusIO(void){}AbStatusIO::~AbStatusIO(void){} void AbStatusIO::DataWrite_Start(AbIODevice* i) {	 i->SaveString("Default Tuono Status I/O file. Version 1"); }void AbStatusIO::DataRead_Start(AbIODevice* i){	i->LoadString(); //skip header}void AbStatusIO::WriteData(AbIODevice* i,TuSaveEnabledObject* obj){ i->SaveString("<object>");  	i->SaveString(obj->GetObjectID()->GetStringID() ); // now save obj->Save(i); i->SaveString("</object>");}	 AbstractedObject* AbStatusIO::ReadData(AbIODevice* i){	std::string check = i->LoadString();	if ( check=="</end>" || i->EndOfFile())	{		return NULL;	}	// get the game to read meta data and create the appropriate object	TuSaveEnabledObject* b = NULL;	check = i->LoadString();		/// we're safe to dodgy casts here, since the object couldn't of	// saved if it wasn't TuSaveEnabledObject*	b = (TuSaveEnabledObject*) tu->GetObjectFactory()->CreateObject(check);				if (b!=NULL)	{	// now load	b->Load(i);	}	i->LoadString();	AbstractedObject* a = (AbstractedObject*)b;	return a;} void AbStatusIO::DataWrite_Terminate(AbIODevice* i) {	 i->SaveString("</end>"); }	void AbStatusIO::DataRead_Terminate(AbIODevice* i)	{	// nothing	}