openttd updated to 1.5.0-beta2
--HG-- branch : openttd
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_info_dummy.cpp 24776 2012-12-01 13:12:39Z alberth $ */
|
||||
/* $Id: script_info_dummy.cpp 26782 2014-09-06 20:22:59Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -9,12 +9,14 @@
|
||||
|
||||
/** @file script_info_dummy.cpp Implementation of a dummy Script. */
|
||||
|
||||
#include <squirrel.h>
|
||||
#include "../stdafx.h"
|
||||
#include <squirrel.h>
|
||||
|
||||
#include "../string_func.h"
|
||||
#include "../strings_func.h"
|
||||
|
||||
#include "../safeguards.h"
|
||||
|
||||
/* The reason this exists in C++, is that a user can trash his ai/ or game/ dir,
|
||||
* leaving no Scripts available. The complexity to solve this is insane, and
|
||||
* therefore the alternative is used, and make sure there is always a Script
|
||||
@@ -39,12 +41,12 @@ void Script_CreateDummyInfo(HSQUIRRELVM vm, const char *type, const char *dir)
|
||||
dp += seprintf(dp, lastof(dummy_script), "function CreateInstance() { return \"Dummy%s\"; }\n", type);
|
||||
dp += seprintf(dp, lastof(dummy_script), "} RegisterDummy%s(Dummy%s());\n", type, type);
|
||||
|
||||
const SQChar *sq_dummy_script = OTTD2SQ(dummy_script);
|
||||
const SQChar *sq_dummy_script = dummy_script;
|
||||
|
||||
sq_pushroottable(vm);
|
||||
|
||||
/* Load and run the script */
|
||||
if (SQ_SUCCEEDED(sq_compilebuffer(vm, sq_dummy_script, scstrlen(sq_dummy_script), _SC("dummy"), SQTrue))) {
|
||||
if (SQ_SUCCEEDED(sq_compilebuffer(vm, sq_dummy_script, strlen(sq_dummy_script), "dummy", SQTrue))) {
|
||||
sq_push(vm, -2);
|
||||
if (SQ_SUCCEEDED(sq_call(vm, 1, SQFalse, SQTrue))) {
|
||||
sq_pop(vm, 1);
|
||||
@@ -95,11 +97,11 @@ void Script_CreateDummy(HSQUIRRELVM vm, StringID string, const char *type)
|
||||
/* 3) We translate the error message in the character format that Squirrel wants.
|
||||
* We can use the fact that the wchar string printing also uses %s to print
|
||||
* old style char strings, which is what was generated during the script generation. */
|
||||
const SQChar *sq_dummy_script = OTTD2SQ(dummy_script);
|
||||
const SQChar *sq_dummy_script = dummy_script;
|
||||
|
||||
/* And finally we load and run the script */
|
||||
sq_pushroottable(vm);
|
||||
if (SQ_SUCCEEDED(sq_compilebuffer(vm, sq_dummy_script, scstrlen(sq_dummy_script), _SC("dummy"), SQTrue))) {
|
||||
if (SQ_SUCCEEDED(sq_compilebuffer(vm, sq_dummy_script, strlen(sq_dummy_script), "dummy", SQTrue))) {
|
||||
sq_push(vm, -2);
|
||||
if (SQ_SUCCEEDED(sq_call(vm, 1, SQFalse, SQTrue))) {
|
||||
sq_pop(vm, 1);
|
||||
|
||||
Reference in New Issue
Block a user