summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actormanager.cpp9
-rw-r--r--src/actormanager.h4
-rw-r--r--src/commands.cpp11
-rw-r--r--src/commands.h2
4 files changed, 20 insertions, 6 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index 966653a99..dd88bc7bb 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -1722,16 +1722,19 @@ void ActorManager::updateEffects(const std::map<int, int> &addEffects,
}
}
-Being *ActorManager::cloneBeing(const Being *const srcBeing)
+Being *ActorManager::cloneBeing(const Being *const srcBeing,
+ const int dx, const int dy,
+ const int id)
{
- Being *const dstBeing = actorManager->createBeing(srcBeing->getId() + 1,
+ Being *const dstBeing = actorManager->createBeing(srcBeing->getId() + id,
ActorType::PLAYER,
srcBeing->getSubType());
if (!dstBeing)
return nullptr;
dstBeing->setGender(srcBeing->getGender());
dstBeing->setAction(srcBeing->getCurrentAction(), 0);
- dstBeing->setTileCoords(srcBeing->getTileX(), srcBeing->getTileY());
+ dstBeing->setTileCoords(srcBeing->getTileX() + dx,
+ srcBeing->getTileY() + dy);
dstBeing->setName(srcBeing->getName());
dstBeing->setDirection(srcBeing->getDirection());
const size_t sz = srcBeing->getSpritesCount();
diff --git a/src/actormanager.h b/src/actormanager.h
index d8ce22e33..48a80b213 100644
--- a/src/actormanager.h
+++ b/src/actormanager.h
@@ -65,7 +65,9 @@ class ActorManager final: public ConfigListener
const ActorType::Type type,
const uint16_t subtype) A_WARN_UNUSED;
- Being *cloneBeing(const Being *const srcBeing);
+ Being *cloneBeing(const Being *const srcBeing,
+ const int dx, const int dy,
+ const int id);
/**
* Create a FloorItem and add it to the list of ActorSprites.
diff --git a/src/commands.cpp b/src/commands.cpp
index 51ce93f85..e92d79eaf 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -84,6 +84,7 @@
#include "utils/delete2.h"
#include "utils/gettext.h"
+#include "utils/mathutils.h"
#include "utils/process.h"
#include "utils/timer.h"
@@ -1540,7 +1541,15 @@ impHandler0(dumpOGL)
impHandler0(debugSpawn)
{
- Being *const being = actorManager->cloneBeing(localPlayer);
+ int cnt = atoi(args.c_str());
+ if (cnt < 1)
+ cnt = 1;
+ const int half = cnt / 2;
+ for (int x = -half; x < cnt - half; x ++)
+ {
+ for (int y = -half; y < cnt - half; y ++)
+ actorManager->cloneBeing(localPlayer, x, y, cnt);
+ }
}
void replaceVars(std::string &str)
diff --git a/src/commands.h b/src/commands.h
index 824ab089d..7820a4ea1 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -344,7 +344,7 @@ static const CommandInfo commands[] =
{"uploadlog", &Commands::uploadLog, -1, false},
{"gm", &Commands::gm, -1, true},
{"hack", &Commands::hack, -1, true},
- {"debugSpawn", &Commands::debugSpawn, -1, false}
+ {"debugSpawn", &Commands::debugSpawn, -1, true}
};
#undef decHandler