Add C4ObjectScript.cpp

floating-point
Günther Brammer 2011-01-20 01:56:01 +01:00
parent dfa1ad948b
commit c74e43b61f
4 changed files with 61 additions and 1 deletions

View File

@ -253,6 +253,7 @@ set(OC_CLONK_SOURCES
src/game/object/C4ObjectList.h
src/game/object/C4ObjectMenu.cpp
src/game/object/C4ObjectMenu.h
src/game/object/C4ObjectScript.cpp
src/game/object/C4ObjectPtr.cpp
src/game/object/C4ObjectPtr.h
src/game/object/C4Sector.cpp

View File

@ -271,6 +271,7 @@ src/game/object/C4ObjectList.cpp \
src/game/object/C4ObjectList.h \
src/game/object/C4ObjectMenu.cpp \
src/game/object/C4ObjectMenu.h \
src/game/object/C4ObjectScript.cpp \
src/game/object/C4ObjectPtr.cpp \
src/game/object/C4ObjectPtr.h \
src/game/object/C4Sector.cpp \

View File

@ -0,0 +1,56 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Copyright (c) 1998-2000, 2004 Matthes Bender
* Copyright (c) 2001, 2006 Peter Wortmann
* Copyright (c) 2001-2002, 2004-2007, 2010 Sven Eberhardt
* Copyright (c) 2004, 2006-2007, 2009-2011 Günther Brammer
* Copyright (c) 2005, 2009-2010 Armin Burgmeier
* Copyright (c) 2009-2010 Nicolas Hake
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
#include <C4Include.h>
#include <C4Aul.h>
#include <C4AulDefFunc.h>
//=========================== C4Script Function Map ===================================
C4ScriptConstDef C4ScriptObjectConstMap[]=
{
{ NULL, C4V_Any, 0}
};
#define MkFnC4V (C4Value (*)(C4AulContext *cthr, C4Value*, C4Value*, C4Value*, C4Value*, C4Value*,\
C4Value*, C4Value*, C4Value*, C4Value*, C4Value*))
C4ScriptFnDef C4ScriptObjectFnMap[]=
{
{ NULL, 0 ,C4V_Any ,{ C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any} ,0, 0 }
};
void InitObjectFunctionMap(C4AulScriptEngine *pEngine)
{
// add all def constants (all Int)
for (C4ScriptConstDef *pCDef = &C4ScriptObjectConstMap[0]; pCDef->Identifier; pCDef++)
{
assert(pCDef->ValType == C4V_Int); // only int supported currently
pEngine->RegisterGlobalConstant(pCDef->Identifier, C4VInt(pCDef->Data));
}
// add all def script funcs
for (C4ScriptFnDef *pDef = &C4ScriptObjectFnMap[0]; pDef->Identifier; pDef++)
pEngine->AddFunc(pDef->Identifier, pDef);
}

View File

@ -5288,14 +5288,16 @@ static Nillable<C4String *> FnGetConstantNameByValue(C4AulContext *ctx, int valu
//=========================== C4Script Function Map ===================================
extern void InitObjectFunctionMap(C4AulScriptEngine *pEngine);
void InitFunctionMap(C4AulScriptEngine *pEngine)
{
InitObjectFunctionMap(pEngine);
// add all def constants (all Int)
for (C4ScriptConstDef *pCDef = &C4ScriptConstMap[0]; pCDef->Identifier; pCDef++)
{
assert(pCDef->ValType == C4V_Int); // only int supported currently
::ScriptEngine.RegisterGlobalConstant(pCDef->Identifier, C4VInt(pCDef->Data));
pEngine->RegisterGlobalConstant(pCDef->Identifier, C4VInt(pCDef->Data));
}
// add all def script funcs