Skip to content

Commit

Permalink
start writing down the STD containers info
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Auto committed Oct 16, 2023
1 parent efaf717 commit 23da5ce
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
29 changes: 29 additions & 0 deletions docs/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,35 @@ def print_lf(lf):
com = link_custom_type(com)
print(com)

print("# STD Library")
print(
"""Sometimes game variables and return of some functions will be of type `map`, `set`, `vector` etc. from the C++ Standard Library.
You don't really need to know much of this as they will behave similar to a lua table, even accept some table functions from the `table` library and support looping thru using `pair` function. You can also use them as parameter for functions that take `array`, Sol will happily convert them for you.
They come with some extra functionality:"""
)
print(
"""
Type | Name | Description
---- | ---- | -----------"""
)
print("any | vector:at(int index) | Same as `vector[index]`")
print("any | set:at(int order) | Returns elements in order, it's not an index as sets don't have one")
print("int | vector:find(any value) | Searches for the value in vector, returns index of the item in vector or nil if not found, only available for simple values that are comparable")
print("any | set:find(any value) | Searches for the value in set, returns the value itself or nil if not found, only available for simple values that are comparable")
print("nil | vector:erase(int index) | Removes element at given index, the rest of elements swift down so that the vector stays contiguous")
print("nil | set:erase(any value) | Removes element from set")
print("nil | vector:clear() | Removes all elements from vector")
print("nil | vector:insert(int index, any element) | Inserts element at given index, the rest of elements shift up")
print("nil | set:insert(int order, any element) | If the set is ordered, the order param doesn't matter and can be set to nil")

print("bool | all:empty() | Returns true if container is empty, false otherwise")
print("int | aLL:size() | Same as `#container`")




print("# Functions")
print(
Expand Down
3 changes: 2 additions & 1 deletion src/game_api/entities_monsters.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "containers/custom_set.hpp"
#include "entities_chars.hpp"
#include "movable.hpp"
#include "particles.hpp"
Expand Down Expand Up @@ -243,7 +244,7 @@ class Yang : public RoomOwner
{
public:
/// Table of uid's of the turkeys, goes only up to 3, is nil when yang is angry
std::set<int32_t> turkeys_in_den;
custom_set<int32_t> turkeys_in_den;
uint8_t unknown4;
uint8_t unknown5;
/// I'm looking for turkeys, wanna help?
Expand Down

0 comments on commit 23da5ce

Please sign in to comment.