mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed add_extra_msg_file loading the same msg file more than once (#467)
Minor code edits. Updated version number.
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
;sfall configuration settings
|
;sfall configuration settings
|
||||||
;v3.8.42.1
|
;v3.8.43
|
||||||
|
|
||||||
[Main]
|
[Main]
|
||||||
;Set to 1 if you want to use command line arguments to tell sfall to use another ini file
|
;Set to 1 if you want to use command line arguments to tell sfall to use another ini file
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "..\main.h"
|
#include "..\main.h"
|
||||||
#include "..\FalloutEngine\Fallout2.h"
|
#include "..\FalloutEngine\Fallout2.h"
|
||||||
|
#include "..\Utils.h"
|
||||||
#include "LoadGameHook.h"
|
#include "LoadGameHook.h"
|
||||||
|
|
||||||
#include "Message.h"
|
#include "Message.h"
|
||||||
@@ -62,6 +63,7 @@ const char* Message::GameLanguage() {
|
|||||||
|
|
||||||
ExtraGameMessageListsMap Message::gExtraGameMsgLists;
|
ExtraGameMessageListsMap Message::gExtraGameMsgLists;
|
||||||
static std::vector<std::string> msgFileList;
|
static std::vector<std::string> msgFileList;
|
||||||
|
static std::unordered_map<std::string, long> addedExtraMsgFiles;
|
||||||
|
|
||||||
static long msgNumCounter = 0x3000;
|
static long msgNumCounter = 0x3000;
|
||||||
|
|
||||||
@@ -192,6 +194,11 @@ long Message::AddExtraMsgFile(const char* msgName, long msgNumber) {
|
|||||||
|
|
||||||
std::string path("game\\");
|
std::string path("game\\");
|
||||||
path += msgName;
|
path += msgName;
|
||||||
|
ToLowerCase(path);
|
||||||
|
|
||||||
|
const std::unordered_map<std::string, long>::iterator &msgIt = addedExtraMsgFiles.find(path.c_str());
|
||||||
|
if (msgIt != addedExtraMsgFiles.cend()) return msgIt->second; // file has already been added by func
|
||||||
|
|
||||||
fo::MessageList* list = new fo::MessageList();
|
fo::MessageList* list = new fo::MessageList();
|
||||||
if (!fo::func::message_load(list, path.c_str())) {
|
if (!fo::func::message_load(list, path.c_str())) {
|
||||||
// change current language folder
|
// change current language folder
|
||||||
@@ -203,6 +210,7 @@ long Message::AddExtraMsgFile(const char* msgName, long msgNumber) {
|
|||||||
}
|
}
|
||||||
if (msgNumber == 0) msgNumber = msgNumCounter++;
|
if (msgNumber == 0) msgNumber = msgNumCounter++;
|
||||||
Message::gExtraGameMsgLists.insert(std::make_pair(msgNumber, list));
|
Message::gExtraGameMsgLists.insert(std::make_pair(msgNumber, list));
|
||||||
|
addedExtraMsgFiles.insert(std::make_pair(path, msgNumber));
|
||||||
return msgNumber;
|
return msgNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,6 +224,7 @@ void ClearScriptAddedExtraGameMsg() {
|
|||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
addedExtraMsgFiles.clear();
|
||||||
msgNumCounter = 0x3000;
|
msgNumCounter = 0x3000;
|
||||||
heroIsFemale = -1;
|
heroIsFemale = -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ void ObjectName::SetName(long sid, const char* name) {
|
|||||||
|
|
||||||
const char* __stdcall ObjectName::GetName(fo::GameObject* object) {
|
const char* __stdcall ObjectName::GetName(fo::GameObject* object) {
|
||||||
if (!overrideScrName.empty()) {
|
if (!overrideScrName.empty()) {
|
||||||
std::unordered_map<int, std::string>::iterator &name = overrideScrName.find(object->scriptId);
|
const std::unordered_map<int, std::string>::iterator &name = overrideScrName.find(object->scriptId);
|
||||||
if (name != overrideScrName.cend()) {
|
if (name != overrideScrName.cend()) {
|
||||||
return (name->second.length() > 0)
|
return (name->second.length() > 0)
|
||||||
? name->second.c_str()
|
? name->second.c_str()
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ struct levelRest {
|
|||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
std::unordered_map<int, levelRest> mapRestInfo;
|
static std::unordered_map<int, levelRest> mapRestInfo;
|
||||||
|
|
||||||
std::vector<std::pair<long, std::string>> wmTerrainTypeNames; // pair first: x + y * number of horizontal sub-tiles
|
static std::vector<std::pair<long, std::string>> wmTerrainTypeNames; // pair first: x + y * number of horizontal sub-tiles
|
||||||
std::unordered_map<long, std::string> wmAreaHotSpotTitle;
|
static std::unordered_map<long, std::string> wmAreaHotSpotTitle;
|
||||||
|
|
||||||
static bool restMap;
|
static bool restMap;
|
||||||
static bool restMode;
|
static bool restMode;
|
||||||
|
|||||||
+3
-3
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#define VERSION_MAJOR 3
|
#define VERSION_MAJOR 3
|
||||||
#define VERSION_MINOR 8
|
#define VERSION_MINOR 8
|
||||||
#define VERSION_BUILD 42
|
#define VERSION_BUILD 43
|
||||||
#define VERSION_REV 1
|
#define VERSION_REV 0
|
||||||
|
|
||||||
#define VERSION_STRING "3.8.42.1"
|
#define VERSION_STRING "3.8.43"
|
||||||
|
|||||||
Reference in New Issue
Block a user