MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / UpdatePrimitive

Function UpdatePrimitive

manage/manage.cpp:1991–2014  ·  view source on GitHub ↗

Updates a primitive if needed Localname = local version of the primname (with path) Netname = Network version of the primname (with path)

Source from the content-addressed store, hash-verified

1989// Localname = local version of the primname (with path)
1990// Netname = Network version of the primname (with path)
1991void UpdatePrimitive(const std::filesystem::path &localname, const std::filesystem::path &netname, char *primname,
1992 int pagetype, char *pagename) {
1993 bool update = false;
1994 if (Starting_editor && !Use_old_update_method) {
1995 if (IsPrimitiveOld(primname))
1996 update = true;
1997 } else {
1998 if (!cfexist(localname) || (cfexist(netname) && cf_Diff(localname, netname)))
1999 update = true;
2000 }
2001
2002 if (update) {
2003 mngs_Pagelock temp_pl;
2004 temp_pl.pagetype = pagetype;
2005 strcpy(temp_pl.name, pagename);
2006 if (!InLockList(&temp_pl)) {
2007 mprintf(0, "Making a local copy of %s for next time.\n", primname);
2008 if (!cf_CopyFile(localname, netname, 1)) {
2009 Int3(); // get Jason
2010 return;
2011 }
2012 }
2013 }
2014}
2015// Writes a chunk header. Writes chunk id & placeholder length. Returns chunk start pos
2016int StartManagePage(CFILE *ofile, uint8_t pagetype) {
2017 int chunk_start_pos;

Calls 5

IsPrimitiveOldFunction · 0.85
cfexistFunction · 0.85
cf_DiffFunction · 0.85
InLockListFunction · 0.85
cf_CopyFileFunction · 0.85

Tested by

no test coverage detected