forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatchfile.I
More file actions
102 lines (92 loc) · 2.31 KB
/
patchfile.I
File metadata and controls
102 lines (92 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file patchfile.I
* @author darren, mike
* @date 1997-01-09
*/
// #include "config_downloader.h"
/**
* Returns a value in the range 0..1, representing the amount of progress
* through the patchfile, during a session.
*/
INLINE PN_stdfloat Patchfile::
get_progress() const {
if (!_initiated) {
express_cat.warning()
<< "Patchfile::get_progress() - Patch has not been initiated" << std::endl;
return 0.0f;
}
nassertr(_total_bytes_to_process > 0, 0.0f);
return ((PN_stdfloat)_total_bytes_processed / (PN_stdfloat)_total_bytes_to_process);
}
/**
* If this flag is set true, the Patchfile will make a special case for
* patching Panda Multifiles, if detected, and attempt to patch them on a
* subfile-by-subfile basis. If this flag is false, the Patchfile will always
* patch the file on a full-file basis.
*
* This has effect only when building patches; it is not used for applying
* patches.
*/
INLINE void Patchfile::
set_allow_multifile(bool allow_multifile) {
_allow_multifile = allow_multifile;
}
/**
* See set_allow_multifile().
*/
INLINE bool Patchfile::
get_allow_multifile() {
return _allow_multifile;
}
/**
*
*/
INLINE void Patchfile::
set_footprint_length(int length) {
nassertv(length > 0);
_footprint_length = length;
}
/**
*
*/
INLINE int Patchfile::
get_footprint_length() {
return _footprint_length;
}
/**
*
*/
INLINE void Patchfile::
reset_footprint_length() {
_footprint_length = _DEFAULT_FOOTPRINT_LENGTH;
}
/**
* Returns true if the MD5 hash for the source file is known. (Some early
* versions of the patch file did not store this information.)
*/
INLINE bool Patchfile::
has_source_hash() const {
return (_version_number >= 1);
}
/**
* Returns the MD5 hash for the source file.
*/
INLINE const HashVal &Patchfile::
get_source_hash() const {
nassertr(has_source_hash(), _MD5_ofSource);
return _MD5_ofSource;
}
/**
* Returns the MD5 hash for the file after the patch has been applied.
*/
INLINE const HashVal &Patchfile::
get_result_hash() const {
return _MD5_ofResult;
}