array.data = alloc.Alloc(array.size);
array.ref = fd.IsReferenced();
arrays.push_back(array);
+ std::memset(array.data, 0, array.size);
char *iter = reinterpret_cast<char *>(array.data);
if (i->second->GetLiteral().GetType() == Literal::ARRAY_PROPS) {
const vector<PropertyList *> &list(i->second->GetLiteral().GetPropertyLists());
}
}
}
- std::memcpy(dest, &array.data, sizeof(char *));
+ size_t pLen = sizeof(char *);
+ std::memcpy(dest, &array.data, pLen);
dest += sizeof(char *);
std::memcpy(dest, &arraySize, sizeof(int));
} else if (i->second->IsLiteral() && !fd.IsReferenced()) {
ReadScriptVector(**i, text + cursor);
cursor += sizeof(Vector<int>);
break;
+ default:
+ break;
}
}
} else if (cmd == "add") {
ReadScriptVector(**i, text + cursor);
cursor += sizeof(Vector<int>);
break;
+ default:
+ break;
}
}
} else if (cmd == "mod") {
}
}
+const string &Interpreter::FindImage(SDL_Surface *img) const {
+ for (std::map<string, SDL_Surface *>::const_iterator
+ i(imageCache.begin()), end(imageCache.end());
+ i != end; ++i) {
+ if (i->second == img) {
+ return i->first;
+ }
+ }
+ throw Error("unable to locate image");
+}
+
bool Interpreter::CanLink(const Value &v) const {
return v.IsLiteral() || source.IsDefined(v.GetIdentifier());
td.SetDescription("A signed integer.");
td.SetSize(sizeof(int));
}
- {;
+ {
TypeDescription &td(TypeDescription::Create(PATH_ID, "Path"));
td.SetDescription("A path in the filesystem which is interpreted relative to the source file's location.");
td.SetSize(1);
td.AddSupertype(STRING_ID, 0);
}
{
+ Script s;
TypeDescription &td(TypeDescription::Create(SCRIPT_ID, "Script"));
td.SetDescription("Collection of commands that define a behaviour.");
td.SetSize(sizeof(Script));
+ td.AddField("text", FieldDescription(((char *)&s.text) - ((char *)&s), STRING_ID).SetAggregate());
}
{
TypeDescription &td(TypeDescription::Create(STRING_ID, "String"));