Skip to content

Commit

Permalink
Merge pull request #14 from Asiern/inventory-fix
Browse files Browse the repository at this point in the history
Inventory fix
  • Loading branch information
Asiern authored Oct 8, 2021
2 parents cd7dcb3 + 07f9a8f commit ab8539d
Show file tree
Hide file tree
Showing 3 changed files with 236 additions and 208 deletions.
8 changes: 8 additions & 0 deletions Scripts/char_editor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
f = open("./f.txt", "r")
out = open("./out.txt", "w")
for line in f.readlines():
s = list(line)
s[5] = '4'
out.write("".join(s))


30 changes: 30 additions & 0 deletions Scripts/csv_to_cpp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import os
import sys
import getopt
import csv

try:
opts, args = getopt.getopt(sys.argv[1:], "hf:", ["file"])
except getopt.GetoptError:
print('csv_to_cpp.py -f <file.csv>')
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print('csv_to_cpp.py -f <file.csv>')
sys.exit()
elif opt in ("-f", "--file"):
path = arg
# elif opt in ("-p", "--prefix"):
# prefix = arg
# elif opt in ("-s", "-sufix"):
# sufix = arg


f = open("out.cpp", "w")

prefix = 'this->_inventory.insert(std::pair<std::string, uintptr_t>("'
sufix = '));'
with open(path, newline="") as file:
reader = csv.reader(file, delimiter=",", quotechar="|")
for row in reader:
f.write(prefix + row[1] + '", ' + row[2] + sufix + "\n")
Loading

0 comments on commit ab8539d

Please sign in to comment.