Fix garage set loading
This commit is contained in:
parent
98a2789c16
commit
eb12c1fa1a
2 changed files with 18 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue