summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/control/Phones.cpp1
-rw-r--r--src/core/FileMgr.cpp3
-rw-r--r--src/core/FileMgr.h2
-rw-r--r--src/core/Streaming.cpp5
-rw-r--r--src/render/Timecycle.cpp5
5 files changed, 12 insertions, 4 deletions
diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp
index cc80360d..d25f146f 100644
--- a/src/control/Phones.cpp
+++ b/src/control/Phones.cpp
@@ -286,6 +286,7 @@ CPhoneInfo::Initialise(void)
CBuilding *building = pool->GetSlot(i);
if (building) {
if (building->GetModelIndex() == MI_PHONEBOOTH1) {
+ assert(m_nMax < ARRAY_SIZE(m_aPhones) && "NUMPHONES should be increased");
CPhone *maxPhone = &m_aPhones[m_nMax];
maxPhone->m_nState = PHONE_STATE_FREE;
maxPhone->m_vecPos = building->GetPosition();
diff --git a/src/core/FileMgr.cpp b/src/core/FileMgr.cpp
index 99923ddf..32aa4041 100644
--- a/src/core/FileMgr.cpp
+++ b/src/core/FileMgr.cpp
@@ -241,7 +241,7 @@ CFileMgr::SetDirMyDocuments(void)
}
ssize_t
-CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode)
+CFileMgr::LoadFile(const char *file, uint8 *buf, int maxlen, const char *mode)
{
int fd;
ssize_t n, len;
@@ -257,6 +257,7 @@ CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode)
return -1;
#endif
len += n;
+ assert(len < maxlen);
}while(n == 0x4000);
buf[len] = 0;
myfclose(fd);
diff --git a/src/core/FileMgr.h b/src/core/FileMgr.h
index 98a78360..f70451b7 100644
--- a/src/core/FileMgr.h
+++ b/src/core/FileMgr.h
@@ -9,7 +9,7 @@ public:
static void ChangeDir(const char *dir);
static void SetDir(const char *dir);
static void SetDirMyDocuments(void);
- static ssize_t LoadFile(const char *file, uint8 *buf, int unused, const char *mode);
+ static ssize_t LoadFile(const char *file, uint8 *buf, int maxlen, const char *mode);
static int OpenFile(const char *file, const char *mode);
static int OpenFile(const char *file) { return OpenFile(file, "rb"); }
static int OpenFileForWriting(const char *file);
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index 3e470fde..8a75b636 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -526,7 +526,12 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
// Txd and anim have to be loaded
int animId = mi->GetAnimFileIndex();
+#ifdef FIX_BUGS
+ if(!HasTxdLoaded(mi->GetTxdSlot()) ||
+#else
+ // texDict will exist even if only first part has loaded
if(CTxdStore::GetSlot(mi->GetTxdSlot())->texDict == nil ||
+#endif
animId != -1 && !CAnimManager::GetAnimationBlock(animId)->isLoaded){
RemoveModel(streamId);
ReRequestModel(streamId);
diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp
index b20a2443..70926c1a 100644
--- a/src/render/Timecycle.cpp
+++ b/src/render/Timecycle.cpp
@@ -172,8 +172,9 @@ CTimeCycle::Initialise(void)
for(w = 0; w < NUMWEATHERS; w++)
for(h = 0; h < NUMHOURS; h++){
li = 0;
- while(work_buff[bi] == '/'){
- while(work_buff[bi] != '\n')
+ while(work_buff[bi] == '/' || work_buff[bi] == '\n' ||
+ work_buff[bi] == '\0' || work_buff[bi] == ' ' || work_buff[bi] == '\r'){
+ while(work_buff[bi] != '\n' && work_buff[bi] != '\0' && work_buff[bi] != '\r')
bi++;
bi++;
}