add Command::Unit to describe similar fields between main command and motions
This commit is contained in:
parent
a07e9eb46b
commit
bbc1c8d153
@ -1,12 +1,2 @@
|
||||
#include "Command.h"
|
||||
#include <string.h>
|
||||
|
||||
Command::Command()
|
||||
{
|
||||
id = NOP;
|
||||
count = 0u;
|
||||
following_char = 0u;
|
||||
motion.id = Motion::NOP;
|
||||
motion.count = 0u;
|
||||
motion.following_char = 0u;
|
||||
}
|
||||
|
@ -33,18 +33,24 @@ public:
|
||||
BACK_UP_TO_CHAR,
|
||||
BACK_ON_TO_CHAR,
|
||||
};
|
||||
};
|
||||
|
||||
struct Unit
|
||||
{
|
||||
uint32_t id;
|
||||
uint32_t count;
|
||||
uint32_t following_char;
|
||||
|
||||
Unit()
|
||||
{
|
||||
id = 0u;
|
||||
count = 0u;
|
||||
following_char = 0u;
|
||||
}
|
||||
};
|
||||
|
||||
uint32_t id;
|
||||
uint32_t count;
|
||||
uint32_t following_char;
|
||||
Motion motion;
|
||||
|
||||
Command();
|
||||
Unit main;
|
||||
Unit motion;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -52,7 +52,7 @@ std::shared_ptr<Command> CommandMap::get_command(uint32_t * command_characters,
|
||||
if (in_motion)
|
||||
command.motion.id = node->id;
|
||||
else
|
||||
command.id = node->id;
|
||||
command.main.id = node->id;
|
||||
if (node->flags & Node::FLAG_FOLLOWING_CHAR)
|
||||
{
|
||||
if (i < (length - 1u))
|
||||
@ -60,7 +60,7 @@ std::shared_ptr<Command> CommandMap::get_command(uint32_t * command_characters,
|
||||
if (in_motion)
|
||||
command.motion.following_char = command_characters[i + 1u];
|
||||
else
|
||||
command.following_char = command_characters[i + 1u];
|
||||
command.main.following_char = command_characters[i + 1u];
|
||||
return std::make_shared<Command>(command);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user