コード例 #1
0
ファイル: Connect_Process.cpp プロジェクト: kravitz/transims4
bool EnhanceNet::Connectivity_Processing (Db_File *fh)
{
	Connect_File *file;
	bool stat;

	stat = Network_Service::Connectivity_Processing (fh);
		
	file = (Connect_File *) fh;

	if (!stat) {
		if (file->Node () == 0) return (false);

	} else if (type_flag || Connect_Code (file->Type ()) == NO_TYPE) {

		Connect_Data *connect_ptr = connect_data.New_Record ();

		connect_ptr->Type (NO_TYPE);
	}

	//---- save the record to the database ----

	if (First_Record ()) {
		if (!connect_db.Max_Records (file->Num_Records ())) {
			Error ("Insufficient Memory for Lane Connectivity Database");
		}
	}
	connect_db.Copy_Fields (file);

	if (!connect_db.Add_Record ()) {
		Error ("Writing Lane Connectivity Database");
	}
	return (stat);
}
コード例 #2
0
void Data_Service::Initialize_Connects (Connect_File &file)
{
	Required_File_Check (file, LINK);
	if (file.Version () <= 40) {
		Required_File_Check (file, POCKET);
	}
	int percent = System_Data_Reserve (CONNECTION);

	if (connect_array.capacity () == 0 && percent > 0) {
		int num = file.Num_Records ();

		if (percent != 100) {
			num = (int) ((double) num * percent / 100.0);
		} else if (file.Version () <= 40) {
			num = (int) (num / 2.25);
		}
		if (num > 1) {
			connect_array.reserve (num);
			if (num > (int) connect_array.capacity ()) Mem_Error (file.File_ID ());
		}
	}
}