|
|
@ -45,6 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#include <string>
|
|
|
|
#include <string>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "Console.h"
|
|
|
|
#include "RemoteClient.h"
|
|
|
|
#include "RemoteClient.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdio>
|
|
|
@ -55,11 +56,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
|
|
|
|
using namespace DFHack;
|
|
|
|
using namespace DFHack;
|
|
|
|
using namespace dfproto;
|
|
|
|
using namespace dfproto;
|
|
|
|
using std::cout;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main (int argc, char *argv[])
|
|
|
|
int main (int argc, char *argv[])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
color_ostream_wrapper out(cout);
|
|
|
|
Console out;
|
|
|
|
|
|
|
|
|
|
|
|
if (argc <= 1)
|
|
|
|
if (argc <= 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -85,12 +85,15 @@ int main (int argc, char *argv[])
|
|
|
|
if (!client.connect())
|
|
|
|
if (!client.connect())
|
|
|
|
return 2;
|
|
|
|
return 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
out.init(true);
|
|
|
|
|
|
|
|
|
|
|
|
command_result rv;
|
|
|
|
command_result rv;
|
|
|
|
|
|
|
|
|
|
|
|
if (strcmp(argv[1], "--lua") == 0)
|
|
|
|
if (strcmp(argv[1], "--lua") == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (argc <= 3)
|
|
|
|
if (argc <= 3)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
out.shutdown();
|
|
|
|
fprintf(stderr, "Usage: dfhack-run --lua <module> <function> [args...]\n");
|
|
|
|
fprintf(stderr, "Usage: dfhack-run --lua <module> <function> [args...]\n");
|
|
|
|
return 2;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -99,6 +102,7 @@ int main (int argc, char *argv[])
|
|
|
|
|
|
|
|
|
|
|
|
if (!run_call.bind(&client, "RunLua"))
|
|
|
|
if (!run_call.bind(&client, "RunLua"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
out.shutdown();
|
|
|
|
fprintf(stderr, "No RunLua protocol function found.");
|
|
|
|
fprintf(stderr, "No RunLua protocol function found.");
|
|
|
|
return 3;
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -130,6 +134,7 @@ int main (int argc, char *argv[])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
out.flush();
|
|
|
|
out.flush();
|
|
|
|
|
|
|
|
out.shutdown();
|
|
|
|
|
|
|
|
|
|
|
|
if (rv != CR_OK)
|
|
|
|
if (rv != CR_OK)
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|