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

Draft: Remove unused code related to csv #717

Closed
wants to merge 1 commit into from
Closed
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
27 changes: 1 addition & 26 deletions engine/src/cmd/ai/aggressive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,31 +109,6 @@ static void TurretFAW(Unit *parent) {
}
}

static vsUMap<string, string> getAITypes() {
vsUMap<string, string> ret;
VSFileSystem::VSFile f;
VSFileSystem::VSError err = f.OpenReadOnly("VegaPersonalities.csv", VSFileSystem::AiFile);
if (err <= VSFileSystem::Ok) {
CSVTable table(f, f.GetRoot());
vsUMap<std::string, int>::iterator browser = table.rows.begin();
for (; browser != table.rows.end(); ++browser) {
string rowname = (*browser).first;
CSVRow row(&table, rowname);
for (unsigned int i = 1; i < table.key.size(); ++i) {
string hasher = rowname;
if (i != 1) {
hasher = rowname + "%" + table.key[i];
}
string rawrow = row[i];
if (rawrow.length() > 0) {
ret[hasher] = rawrow;
}
}
}
f.Close();
}
return ret;
}

static string select_from_space_list(string inp, unsigned int seed) {
if (inp.length() == 0) {
Expand Down Expand Up @@ -173,7 +148,7 @@ static AIEvents::ElemAttrMap *getLogicOrInterrupt(string name,
vsUMap<string, AIEvents::ElemAttrMap *> &mymap,
int personalityseed) {
string append = "agg";
static vsUMap<string, string> myappend = getAITypes();
static vsUMap<string, string> myappend;
Copy link
Member

Choose a reason for hiding this comment

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

how will this get populated now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you look at line 113-115, this is what's happening anyway. The file 'VegaPersonalities' doesn't exist in either VS or WCPU. I've trimmed the code but nothing's changed. At least, that was the intention.
I specifically asked @Loki1950, as he's our resident historian for such things.
As I can't figure out from the code what they wanted to do and this appears to be a stub for some future feature, I vote to delete it. If/When we get to developing, we'll hopefully document it as well :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I just checked. The file 'VegaPersonalities.csv' does, in fact, exist in PWCU. Three copies of it. One under the 'ai' folder, another under the 'ai.easy' folder, and the third under the 'ai.hard' folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huh. I actually checked in what I assumed was the repository. Is it something you're running on your computer or is it in the repo as well? If it is, can you point me to it?

Copy link
Contributor

Choose a reason for hiding this comment

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

vsUMap<string, string>::iterator iter;
string factionname = FactionUtil::GetFaction(faction);
if ((iter = myappend.find(factionname + "%" + unittype)) != myappend.end()) {
Expand Down