Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor: runtime_data: declared checksums structure #532

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions BunnymodXT/runtime_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ namespace RuntimeData
PLAYERHEALTH,
SPLIT_MARKER,
FLAGS,
CHECKSUMS,
};

// Encrypting filter.
Expand Down Expand Up @@ -367,6 +368,14 @@ namespace RuntimeData
archive(f.flags);
}

void operator()(const Checksums& c) const {
archive(RuntimeDataType::CHECKSUMS);

archive(c.client);
archive(c.server);
archive(c.map);
}

private:
Archive& archive;
};
Expand Down Expand Up @@ -489,6 +498,14 @@ namespace RuntimeData
data = f;
break;
}
case RuntimeDataType::CHECKSUMS: {
Checksums c;
archive(c.client);
archive(c.server);
archive(c.map);
data = c;
break;
}
default: {
EngineDevWarning("Read unknown RuntimeDataType %d\n", data_type);
break;
Expand Down Expand Up @@ -554,6 +571,7 @@ namespace RuntimeData
void operator()(const RuntimeData::Edicts& e) const {}
void operator()(const RuntimeData::SplitMarker& m) const {}
void operator()(const RuntimeData::Flags& f) const {}
void operator()(const RuntimeData::Checksums& c) const {}

private:
// bxt commands that should be executed when found during demo playback
Expand Down
9 changes: 8 additions & 1 deletion BunnymodXT/runtime_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ namespace RuntimeData
int flags;
};

struct Checksums {
std::string client;
std::string server;
std::string map;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead a map from name to checksum? Then it can have "hl.dll" => checksum, "client.dll" => checksum, and whatever else we may add in the future?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that's a really good idea in fact. After all, maybe in the future this field with all the loaded modules will still be needed again, who knows, so it's better not to re-use it again just for this.

};

using Data = boost::variant<VersionInfo,
CVarValues,
Time,
Expand All @@ -80,7 +86,8 @@ namespace RuntimeData
Edicts,
PlayerHealth,
SplitMarker,
Flags>;
Flags,
Checksums>;

void Add(Data data);
void Clear();
Expand Down