fixes after merge

This commit is contained in:
water
2024-03-31 11:46:13 -04:00
parent 6a6f1c20ee
commit 7126394310
12 changed files with 39 additions and 50 deletions
+5 -5
View File
@@ -147,7 +147,7 @@ void apply_formatting_config(
// Find the maximum number of columns
int max_columns = 0;
for (const auto& field : curr_node.refs) {
if (field.refs.size() > max_columns) {
if ((int)field.refs.size() > max_columns) {
max_columns = field.refs.size();
}
}
@@ -156,7 +156,7 @@ void apply_formatting_config(
for (int col = 0; col < max_columns; col++) {
column_max_widths.push_back(0);
for (const auto& field : curr_node.refs) {
if (field.refs.size() > col) {
if ((int)field.refs.size() > col) {
const auto width = get_total_form_inlined_width(field.refs.at(col));
if (width > column_max_widths.at(col)) {
column_max_widths[col] = width;
@@ -271,7 +271,7 @@ std::vector<std::string> apply_formatting(const FormatterTreeNode& curr_node,
val = comments::format_block_comment(ref.token_str());
}
form_lines.push_back(val);
if (!curr_node.metadata.is_top_level && i == curr_node.refs.size() - 1 &&
if (!curr_node.metadata.is_top_level && i == (int)curr_node.refs.size() - 1 &&
(ref.metadata.is_comment)) {
// if there's an inline comment at the end of a form, we have to force the paren to the next
// line and do a new-line paren this is ugly, but we have no choice!
@@ -354,9 +354,9 @@ std::vector<std::string> apply_formatting(const FormatterTreeNode& curr_node,
// Add any column padding
if (!curr_node.formatting_config.list_element_column_widths.empty()) {
for (int i = 0; i < form_lines.size(); i++) {
for (int i = 0; i < (int)form_lines.size(); i++) {
const auto& token = form_lines.at(i);
if (i < form_lines.size() - 1) {
if (i < (int)form_lines.size() - 1) {
form_lines[i] = str_util::pad_right(
token, curr_node.formatting_config.list_element_column_widths.at(i), ' ');
}
+1 -1
View File
@@ -247,7 +247,7 @@ std::string titlize(const std::string& str) {
}
std::string pad_right(const std::string& input, const int width, const char padding_char) {
if (input.length() >= width) {
if ((int)input.length() >= width) {
return input; // No need to pad if input length is already greater or equal to width
} else {
int padding_width = width - input.length();
+9 -4
View File
@@ -38,7 +38,8 @@ class TrieMap {
}
// Retrieve elements with a given prefix
std::vector<std::shared_ptr<T>> retrieve_with_prefix(const std::string& prefix) const {
std::vector<std::shared_ptr<T>> retrieve_with_prefix(const std::string& prefix,
int max_count = -1) const {
std::vector<std::shared_ptr<T>> result;
std::shared_ptr<TrieNode> node = root;
// Traverse to the node representing the prefix
@@ -49,7 +50,7 @@ class TrieMap {
node = node->children[c];
}
// Gather all elements stored at or below this node
retrieve_elements(node, result);
retrieve_elements(node, result, max_count);
return result;
}
@@ -88,14 +89,18 @@ class TrieMap {
private:
// Recursive function to retrieve elements stored at or below the given node
void retrieve_elements(std::shared_ptr<TrieNode> node,
std::vector<std::shared_ptr<T>>& result) const {
std::vector<std::shared_ptr<T>>& result,
int max_count) const {
// Add elements stored at this node to the result
for (const auto& element : node->elements) {
if (max_count >= 0 && (int)result.size() >= max_count) {
return;
}
result.push_back(element);
}
// Recursively traverse children
for (const auto& child : node->children) {
retrieve_elements(child.second, result);
retrieve_elements(child.second, result, max_count);
}
}
+1 -1
View File
@@ -570,7 +570,7 @@ void inspect_cloth_data_jak3(LetElement* let, DefskelgroupElement::StaticInfo& i
auto array_set = dynamic_cast<SetFormFormElement*>(when_body->at(0));
if (array_set) {
// get elements
auto elts = when_body->elts().size() - 2;
auto elts = (int)when_body->elts().size() - 2;
for (int i = 0; i < elts; i++) {
auto parms_form = dynamic_cast<SetFormFormElement*>(when_body->at(i + 1));
if (parms_form) {
+3 -3
View File
@@ -38,9 +38,9 @@ struct AudioDir {
int entry_count() const { return entries.size(); }
void debug_print() const {
for (auto& e : entries) {
// lg::debug("\"{}\" 0x{:07x} - 0x{:07x}", e.name, e.start_byte, e.end_byte);
}
// for (auto& e : entries) {
// lg::debug("\"{}\" 0x{:07x} - 0x{:07x}", e.name, e.start_byte, e.end_byte);
// }
}
};
+2 -16
View File
@@ -5,20 +5,6 @@
;; name in dgo: entity
;; dgos: GAME
(defmethod birth bsp-header ((this bsp-header))
(format #t "skipping birth for ~A~%" this)
(none)
)
(defun reset-actors ((arg0 symbol))
(format #t "skipping reset-actors ~A~%" arg0)
(none)
)
(defun entity-by-name ((arg0 string))
(the entity #f)
)
;; DECOMP BEGINS
(define *spawn-actors* #t)
@@ -1129,7 +1115,7 @@
(if (and (nonzero? (-> (the-as process-drawable arg0) draw)) *display-actor-vis*)
(add-debug-sphere
#t
(bucket-id bucket583)
(bucket-id debug)
(-> (the-as process-drawable arg0) draw origin)
(-> (the-as process-drawable arg0) draw bounds w)
(new 'static 'rgba :r #x80 :a #x80)
@@ -1362,7 +1348,7 @@
)
(add-debug-sphere
#t
(bucket-id bucket583)
(bucket-id debug)
(-> (the-as process-drawable s0-2) draw origin)
(-> (the-as process-drawable s0-2) draw bounds w)
(new 'static 'rgba :r #x80 :a #x80)
-7
View File
@@ -5,13 +5,6 @@
;; name in dgo: scene
;; dgos: GAME
;; TODO: remove this. just a stub so the game starts
(defmethod load-scene ((this scene))
(format 0 "unsupported load-scene~%")
(format #t "unsupported load-scene~%")
this
)
;; DECOMP BEGINS
(deftype scene-stage (process-hidden)
@@ -2533,7 +2533,7 @@
)
(add-debug-vector
#t
(bucket-id bucket583)
(bucket-id debug)
(-> self start-pos)
(-> self start-dir)
(meters 6)
+2 -1
View File
@@ -101,7 +101,8 @@ class Compiler {
const std::string& file_path) const;
std::vector<std::shared_ptr<symbol_info::SymbolInfo>> lookup_symbol_info_by_prefix(
const std::string& prefix) const;
std::set<std::string> lookup_symbol_names_starting_with(const std::string& prefix) const;
std::set<std::string> lookup_symbol_names_starting_with(const std::string& prefix,
int max_size) const;
std::vector<std::shared_ptr<symbol_info::SymbolInfo>> lookup_exact_name_info(
const std::string& name) const;
std::optional<TypeSpec> lookup_typespec(const std::string& symbol_name);
@@ -443,7 +443,7 @@ replxx::Replxx::completions_t Compiler::find_symbols_or_object_file_by_prefix(
// the syntax
const auto [token, stripped_leading_paren] = m_repl->get_current_repl_token(context);
// Otherwise, look for symbols
auto possible_forms = lookup_symbol_names_starting_with(token);
auto possible_forms = lookup_symbol_names_starting_with(token, 100);
for (auto& x : possible_forms) {
completions.push_back(stripped_leading_paren ? "(" + x : x);
@@ -460,7 +460,7 @@ replxx::Replxx::hints_t Compiler::find_hints_by_prefix(std::string const& contex
(void)contextLen;
(void)user_data;
auto token = m_repl->get_current_repl_token(context);
auto possible_forms = lookup_symbol_names_starting_with(token.first);
auto possible_forms = lookup_symbol_names_starting_with(token.first, 100);
replxx::Replxx::hints_t hints;
@@ -598,9 +598,10 @@ std::vector<std::shared_ptr<symbol_info::SymbolInfo>> Compiler::lookup_symbol_in
return m_symbol_info.lookup_symbols_starting_with(prefix);
}
std::set<std::string> Compiler::lookup_symbol_names_starting_with(const std::string& prefix) const {
std::set<std::string> Compiler::lookup_symbol_names_starting_with(const std::string& prefix,
int max_size) const {
if (m_goos.reader.check_string_is_valid(prefix)) {
return m_symbol_info.lookup_names_starting_with(prefix);
return m_symbol_info.lookup_names_starting_with(prefix, max_size);
}
return {};
}
+6 -4
View File
@@ -280,18 +280,20 @@ std::vector<std::shared_ptr<SymbolInfo>> SymbolInfoMap::lookup_exact_name(
}
std::vector<std::shared_ptr<SymbolInfo>> SymbolInfoMap::lookup_symbols_starting_with(
const std::string& prefix) const {
const std::string& prefix,
int max_count) const {
std::vector<std::shared_ptr<SymbolInfo>> symbols;
const auto lookup = m_symbol_map.retrieve_with_prefix(prefix);
const auto lookup = m_symbol_map.retrieve_with_prefix(prefix, max_count);
for (const auto& result : lookup) {
symbols.push_back(result);
}
return symbols;
}
std::set<std::string> SymbolInfoMap::lookup_names_starting_with(const std::string& prefix) const {
std::set<std::string> SymbolInfoMap::lookup_names_starting_with(const std::string& prefix,
int max_count) const {
std::set<std::string> names;
const auto lookup = m_symbol_map.retrieve_with_prefix(prefix);
const auto lookup = m_symbol_map.retrieve_with_prefix(prefix, max_count);
for (const auto& result : lookup) {
names.insert(result->m_name);
}
+4 -3
View File
@@ -159,9 +159,10 @@ class SymbolInfoMap {
std::vector<std::shared_ptr<SymbolInfo>> lookup_symbols_by_file(
const std::string& file_path) const;
std::vector<std::shared_ptr<SymbolInfo>> lookup_exact_name(const std::string& name) const;
std::vector<std::shared_ptr<SymbolInfo>> lookup_symbols_starting_with(
const std::string& prefix) const;
std::set<std::string> lookup_names_starting_with(const std::string& prefix) const;
std::vector<std::shared_ptr<SymbolInfo>> lookup_symbols_starting_with(const std::string& prefix,
int max_count = -1) const;
std::set<std::string> lookup_names_starting_with(const std::string& prefix,
int max_count = -1) const;
int symbol_count() const;
std::vector<std::shared_ptr<SymbolInfo>> get_all_symbols() const;
// Uses the per-file index to find and evict symbols globally