Add httpGet function

This commit is contained in:
Federico Cecchetto
2021-06-20 20:04:36 +02:00
parent e5083cd228
commit b1a29ded7d
11 changed files with 253 additions and 34 deletions

View File

@ -150,7 +150,7 @@ namespace scripting
script_value array::get(const std::string& key) const
{
const auto string_value = game::SL_GetString(key.data(), 0);
const auto variable_id = game::GetVariable(this->id_, string_value);
const auto variable_id = game::FindVariable(this->id_, string_value);
if (!variable_id)
{
@ -167,7 +167,7 @@ namespace scripting
script_value array::get(const unsigned int index) const
{
const auto variable_id = game::GetVariable(this->id_, (index - 0x800000) & 0xFFFFFF);
const auto variable_id = game::FindVariable(this->id_, (index - 0x800000) & 0xFFFFFF);
if (!variable_id)
{

View File

@ -283,4 +283,14 @@ namespace scripting
return index;
}
unsigned int make_object()
{
unsigned int index = 0;
const auto variable = game::AllocVariable(&index);
variable->w.type = game::SCRIPT_STRUCT;
variable->u.f.prev = 0;
return index;
}
}

View File

@ -36,4 +36,5 @@ namespace scripting
void notify(const entity& entity, const std::string& event, const std::vector<script_value>& arguments);
unsigned int make_array();
unsigned int make_object();
}