Added the pathfinding module
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <godot_cpp/classes/ref_counted.hpp>
|
||||
#include "constants.hpp"
|
||||
#include "godot_cpp/classes/ref_counted.hpp"
|
||||
|
||||
namespace CoborVM
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace CoborVM
|
||||
|
||||
SET,
|
||||
CLR,
|
||||
CPY,
|
||||
MOV,
|
||||
SWP,
|
||||
|
||||
ADD,
|
||||
@@ -42,7 +42,7 @@ namespace CoborVM
|
||||
const std::unordered_map<std::string, Instruction> stringToInstructionMap = {
|
||||
{"SET", SET},
|
||||
{"CLR", CLR},
|
||||
{"CPY", CPY},
|
||||
{"MOV", MOV},
|
||||
{"SWP", SWP},
|
||||
{"ADD", ADD},
|
||||
{"SUB", SUB},
|
||||
@@ -60,7 +60,7 @@ namespace CoborVM
|
||||
const std::unordered_map<Instruction, std::string> InstructionToStringMap = {
|
||||
{SET, "SET"},
|
||||
{CLR, "CLR"},
|
||||
{CPY, "CPY"},
|
||||
{MOV, "MOV"},
|
||||
{SWP, "SWP"},
|
||||
{ADD, "ADD"},
|
||||
{SUB, "SUB"},
|
||||
@@ -83,7 +83,7 @@ namespace CoborVM
|
||||
{Instruction::CLR, {true}}, // One pointer argument
|
||||
{Instruction::ZERO, {true}},
|
||||
{Instruction::SET, {false, true}}, // One literal and one pointer argument
|
||||
{Instruction::CPY, {true, true}}, // Two pointer arguments
|
||||
{Instruction::MOV, {true, true}}, // Two pointer arguments
|
||||
{Instruction::SWP, {true, true}},
|
||||
{Instruction::EQL, {true, true}},
|
||||
{Instruction::BIGR, {true, true}},
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// #include <godot_cpp/variant/utility_functions.hpp>
|
||||
|
||||
#include "cobor_virtual_machine.hpp"
|
||||
|
||||
using namespace CoborVM;
|
||||
@@ -61,9 +63,11 @@ godot::String CoborVM::CoborVirtualMachine::set_registers(int size, godot::Packe
|
||||
return godot::String("Size must be one or higher");
|
||||
register_memory = std::vector<int32_t>(size);
|
||||
preloaded_values.resize(size);
|
||||
int i = 0;
|
||||
for (int value : preloaded_values)
|
||||
{
|
||||
register_memory[i] = value;
|
||||
i++;
|
||||
}
|
||||
return godot::String();
|
||||
}
|
||||
@@ -163,7 +167,7 @@ godot::String CoborVM::CoborVirtualMachine::run_executable_step(ExecutableStep s
|
||||
break;
|
||||
}
|
||||
|
||||
case CPY:
|
||||
case MOV:
|
||||
{
|
||||
if (!check_register(step.arg1) || !check_register(step.arg2))
|
||||
return error_message;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user