OpenMW
|
00001 #ifndef OPENMW_ESM_SCPT_H 00002 #define OPENMW_ESM_SCPT_H 00003 00004 #include <string> 00005 #include <vector> 00006 00007 #include "esmcommon.hpp" 00008 00009 namespace ESM 00010 { 00011 00012 class ESMReader; 00013 class ESMWriter; 00014 00015 /* 00016 * Script definitions 00017 */ 00018 00019 class Script 00020 { 00021 public: 00022 static unsigned int sRecordId; 00023 00024 struct SCHDstruct 00025 { 00026 /* Script name. 00027 00028 NOTE: You should handle the name "Main" (case insensitive) with 00029 care. With tribunal, modders got the ability to add 'start 00030 scripts' to their mods, which is a script that is run at 00031 startup and which runs throughout the game (I think.) 00032 00033 However, before Tribunal, there was only one startup script, 00034 called "Main". If mods wanted to make their own start scripts, 00035 they had to overwrite Main. This is obviously problem if 00036 multiple mods to this at the same time. 00037 00038 Although most mods have switched to using Trib-style startup 00039 scripts, some legacy mods might still overwrite Main, and this 00040 can cause problems if several mods do it. I think the best 00041 course of action is to NEVER overwrite main, but instead add 00042 each with a separate unique name and add them to the start 00043 script list. But there might be other problems with this 00044 approach though. 00045 */ 00046 00047 // These describe the sizes we need to allocate for the script 00048 // data. 00049 int mNumShorts, mNumLongs, mNumFloats, mScriptDataSize, mStringTableSize; 00050 }; // 52 bytes 00051 00052 std::string mId; 00053 00054 SCHDstruct mData; 00055 00056 std::vector<std::string> mVarNames; // Variable names 00057 std::vector<unsigned char> mScriptData; // Compiled bytecode 00058 std::string mScriptText; // Uncompiled script 00059 00060 void load(ESMReader &esm); 00061 void save(ESMWriter &esm) const; 00062 00063 void blank(); 00065 }; 00066 } 00067 #endif