Пример #1
0
void Init()
{
	MarkAllDirty();
	for (VertexLoaderBase*& vertexLoader : g_main_cp_state.vertex_loaders)
		vertexLoader = nullptr;
	last_game_code = SConfig::GetInstance().m_strUniqueID;
}
Пример #2
0
void Init()
{
	MarkAllDirty();
	for (auto& map_entry : g_main_cp_state.vertex_loaders)
		map_entry = nullptr;
	for (auto& map_entry : g_preprocess_cp_state.vertex_loaders)
		map_entry = nullptr;
	SETSTAT(stats.numVertexLoaders, 0);
}
Пример #3
0
void LevelViewPort::AttachToLevel ( Level* new_level, NetworkCommandBuffer& buffer )
{
	if ( level )
		level->RemoveViewPort ( this );
	level = new_level;
	if ( level )
	{
		level->AddViewPort ( this );
		sizex = level->sizex;
		sizey = level->sizey;
		MarkAllDirty();
		NetworkCommandBuffer::Command command(buffer);
		command.SendChar ( MSG_RESIZEWORLD );
		command.SendInt ( level->sizex );
		command.SendInt ( level->sizey );
		MarkAllDirty();
	}
}
Пример #4
0
void Init()
{
	MarkAllDirty();
	for (auto& map_entry : g_main_cp_state.vertex_loaders)
		map_entry = nullptr;
	for (auto& map_entry : g_preprocess_cp_state.vertex_loaders)
		map_entry = nullptr;
	RecomputeCachedArraybases();
}
Пример #5
0
	void DataFileDB::Attach(const Data& init, const string& variablename,FileDBType type)
	{
		dir=savedir+"/"+variablename+"-db";
		dbtype=DatabaseExist();

		security.WriteFile(dir);

		if(dbtype!=DBNone)
		{
			Dump("DataFileDB::Attach(const Data&, const string&, FileDBType)","load old",init);
			LoadContent();
		}
		else
		{
			dbtype=type;
			Dump("DataFileDB::Attach(const Data&, const string&, FileDBType)","create new",init);
			CreateEmpty();
			DataFileDB::operator=(init);
			MarkAllDirty();
		}
	}
Пример #6
0
	Data& DataFileDB::operator=(const Data& z)
	{
		Dump("operator=(const Data&)","copy from",z);
		
		DestroyContent();
		
		if(dbtype==DBNone)
			throw Error::IO("DataFileDB::operator=(const Data&)","cannot assign to database type DBNone");

		if(dbtype==DBSingleFile)
		{
			Data::operator=(z);
			MarkAllDirty();
			return *this;
		}
		else if(dbtype==DBStringKeys)
		{
			if(!z.IsList())
				throw LangErr("DataFileDB::operator=(const DataFileDB&)","only dictionaries can be stored into DBStringKeys");

			MakeList(z.Size());
			status=vector<DBEntryStatus>(z.Size());
			
			for(size_t i=0; i<z.Size(); i++)
			{
				if(!z[i].IsList(2))
					throw LangErr("DataFileDB::operator=(const DataFileDB&)","invalid dictionary entry "+tostr(z[i]).String());
				else if(!z[i][0].IsString())
					throw LangErr("DataFileDB::operator=(const DataFileDB&)","only string valued keys allowed: "+tostr(z[i][0]).String());

				vec[i]=z[i];
				Touch(i);
				MarkDirty(i);
			}
			
			return *this;
		}
		else
			throw Error::NotYetImplemented("DataFileDB::operator=(const Data&)");
	}
Пример #7
0
	Data* DataFileDB::FindKey(const Data& key)
	{
		if(dbtype==DBNone)
			throw LangErr("DataFileDB::FindKey(const Data&)","cannot do key lookup on database type DBNone");
		else if(dbtype==DBSingleFile)
		{
			MarkAllDirty();
			return Data::FindKey(key);
		}
		else if(dbtype==DBStringKeys)
		{
			bool is_old;
			size_t pos;
		
			pos=KeyLookup(key,is_old);

			if(is_old)
				LoadCache(pos);
			else
			{
				Data pair;

				pair.MakeList(2);
				pair[0]=key;
				InsertAt(pos,pair);
			}

			Touch(pos);
			MarkDirty(pos);
			CacheUpdate();
			
			return &vec[pos];
		}
		else
			throw Error::NotYetImplemented("DataFileDB::FindKey(const Data&)");
	}