mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 13:31:39 +00:00
Entities: Removed Tag attribute; it is taken from the filename instead. Made entity XML files be loaded on demand. Probably stopped crash when maps contain non-existent entities. Fixed a few bugs in entity definitions.
Maps: Stored non-entity objects in XML instead of PMP, for easier manual editing. Updated existing maps to newest format, so that they can still work. Added undocumented _rewriteMaps() JS function. Also renamed _mem to vmem, and reclassified its undocumentedness as unintentional, since it's reasonably useful. Loader: added NonprogressiveLoad function, for ScEd/_rewriteMaps/etc which don't care about progressiveness. main.cpp: re-enabled vfs_display, since it doesn't crash now Vector3D: stopped warning This was SVN commit r2078.
This commit is contained in:
@@ -10,7 +10,9 @@
|
||||
|
||||
#include "FilePacker.h"
|
||||
|
||||
#include <stdio.h> // VFS_REPLACE: remove
|
||||
#ifdef SCED
|
||||
# include <stdio.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include "lib/res/vfs.h"
|
||||
|
||||
@@ -34,12 +36,11 @@ CFilePacker::CFilePacker(u32 version, const char magicstr[4])
|
||||
// Write: write out to file all packed data added so far
|
||||
void CFilePacker::Write(const char* filename)
|
||||
{
|
||||
/*
|
||||
VFS_REPLACE: this is the entire function body
|
||||
#ifndef SCED
|
||||
// write out all data (including header)
|
||||
if(vfs_store(filename, &m_Data[0], m_Data.size()) < 0)
|
||||
if(vfs_store(filename, &m_Data[0], m_Data.size(), FILE_NO_AIO) < 0)
|
||||
throw CFileWriteError();
|
||||
*/
|
||||
#else
|
||||
|
||||
FILE* fp=fopen(filename,"wb");
|
||||
if (!fp) {
|
||||
@@ -54,6 +55,7 @@ VFS_REPLACE: this is the entire function body
|
||||
|
||||
// all done
|
||||
fclose(fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -273,3 +273,26 @@ done:
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// immediately process all queued load requests.
|
||||
// returns 0 on success, something else on failure.
|
||||
int LDR_NonprogressiveLoad()
|
||||
{
|
||||
int progress_percent;
|
||||
wchar_t description[100];
|
||||
int ret;
|
||||
|
||||
while(1)
|
||||
{
|
||||
ret = LDR_ProgressiveLoad(100.f, description, ARRAY_SIZE(description), &progress_percent);
|
||||
|
||||
switch(ret)
|
||||
{
|
||||
case 1: debug_warn("NonprogressiveLoad: No load in progress"); return 0;
|
||||
case 0: return 0; // success
|
||||
case ERR_TIMED_OUT: break; // try again
|
||||
default: CHECK_ERR(ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,3 +84,7 @@ extern int LDR_Cancel();
|
||||
// the request is de-queued. that leaves writing into caller's buffer.
|
||||
extern int LDR_ProgressiveLoad(double time_budget, wchar_t* next_description,
|
||||
size_t max_chars, int* progress_percent);
|
||||
|
||||
// immediately process all queued load requests.
|
||||
// returns 0 on success, something else on failure.
|
||||
extern int LDR_NonprogressiveLoad();
|
||||
@@ -10,7 +10,7 @@
|
||||
using namespace VFSUtil;
|
||||
|
||||
// Because I'm lazy, and it saves a few lines of code in other places:
|
||||
bool VFSUtil::FindFiles (CStr& dirname, const char* filter, FileList& files)
|
||||
bool VFSUtil::FindFiles (const CStr& dirname, const char* filter, FileList& files)
|
||||
{
|
||||
files.clear();
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ typedef std::vector<CStr> FileList;
|
||||
// 'filter': see vfs_next_dirent
|
||||
// 'files' is initially cleared, and undefined on failure.
|
||||
// On failure, logs an error and returns false.
|
||||
extern bool FindFiles(CStr& dirname, const char* filter, FileList& files);
|
||||
extern bool FindFiles(const CStr& dirname, const char* filter, FileList& files);
|
||||
|
||||
|
||||
// called by EnumFiles for each file in a directory (optionally
|
||||
|
||||
Reference in New Issue
Block a user