less serialize code
This commit is contained in:
12
src/main.cpp
12
src/main.cpp
@@ -82,10 +82,12 @@ td::sim::GameHistory GetCustomHistory() {
|
||||
|
||||
td::sim::GameHistory gh(MAX_COUNT);
|
||||
|
||||
auto spawn = std::make_shared<td::protocol::commands::SpawnTroopCommand>(0, 0, td::Vec2fp{td::FpFloat(77), td::FpFloat(13)}, 0);
|
||||
auto spawn = td::protocol::CommandPtr(
|
||||
std::make_shared<td::protocol::commands::SpawnTroopCommand>(0, 0, td::Vec2fp{td::FpFloat(77), td::FpFloat(13)}, 0));
|
||||
gh[0].push_back(spawn);
|
||||
|
||||
auto tower = std::make_shared<td::protocol::commands::PlaceTowerCommand>(td::TowerType::Archer, 0, td::TowerCoords{77, 13});
|
||||
auto tower = td::protocol::CommandPtr(
|
||||
std::make_shared<td::protocol::commands::PlaceTowerCommand>(td::TowerType::Archer, 0, td::TowerCoords{77, 13}));
|
||||
gh[0].push_back(tower);
|
||||
|
||||
return gh;
|
||||
@@ -116,9 +118,9 @@ int main(int argc, char** argv) {
|
||||
|
||||
display.OnKeyDown.Connect([&simulation](SDL_Keycode key) {
|
||||
if (key == SDLK_A) {
|
||||
auto spawn =
|
||||
std::make_shared<td::protocol::commands::SpawnTroopCommand>(0, 0, td::Vec2fp{td::FpFloat(77), td::FpFloat(13)}, 0);
|
||||
td::Array<td::protocol::LockStep, LOCKSTEP_BUFFER_SIZE> steps{};
|
||||
auto spawn = td::protocol::CommandPtr(
|
||||
std::make_shared<td::protocol::commands::SpawnTroopCommand>(0, 0, td::Vec2fp{td::FpFloat(77), td::FpFloat(13)}, 0));
|
||||
std::array<td::protocol::LockStep, LOCKSTEP_BUFFER_SIZE> steps{};
|
||||
steps[0].push_back(spawn);
|
||||
td::protocol::packets::LockStepsPacket packet{0, steps};
|
||||
simulation.HandlePacket(packet);
|
||||
|
||||
Reference in New Issue
Block a user