Fix garage set loading

This commit is contained in:
James Brown 2003-08-20 07:44:54 +00:00
parent 98a2789c16
commit eb12c1fa1a
2 changed files with 18 additions and 2 deletions

View file

@ -65,7 +65,15 @@ Scene::Scene(const char *name, const char *buf, int len) :
ts.expectString("section: sectors");
if (ts.eof()) // Sectors are optional, but section: doesn't seem to be
return;
// Sector NAMES can be null, but ts doesn't seem flexible enough to allow this
if (strlen(ts.currentLine()) > strlen(" sector"))
ts.scanString(" sector %256s", 1, tempBuf);
else {
ts.nextLine();
strcpy(tempBuf, "");
}
ts.scanString(" id %d", 1, &numSectors_);
sectors_ = new Sector[numSectors_];
// FIXME: This would be nicer if we could rewind the textsplitter

View file

@ -22,7 +22,15 @@
void Sector::load(TextSplitter &ts) {
char buf[256];
int id = 0;
// Sector NAMES can be null, but ts isn't flexible enough
if (strlen(ts.currentLine()) > strlen(" sector"))
ts.scanString(" sector %256s", 1, buf);
else {
ts.nextLine();
strcpy(buf, "");
}
ts.scanString(" id %d", 1, &id);
load0(ts, buf, id);
}