mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
Space Viking's many mercs changes plus numerous generic bug fixes
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2498 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+2
-2
@@ -51,8 +51,8 @@ typedef struct
|
||||
{
|
||||
UINT16 usIndex;
|
||||
UINT16 usRate;
|
||||
UINT8 ubVolume;
|
||||
UINT8 ubLoops;
|
||||
UINT8 ubVolume;
|
||||
UINT8 ubLoops;
|
||||
UINT32 uiPan;
|
||||
|
||||
} EV_E_PLAYSOUND;
|
||||
|
||||
+72
-27
@@ -1,11 +1,17 @@
|
||||
#include "builddefines.h"
|
||||
#include "IniReader.h"
|
||||
#include "FileMan.h"
|
||||
#include "debug.h"
|
||||
#include "Font Control.h"
|
||||
#include "message.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
|
||||
// Kaiden: INI reading function definitions:
|
||||
|
||||
std::stack<std::string> iniErrorMessages;
|
||||
|
||||
|
||||
CIniReader::CIniReader(const STR8 szFileName)
|
||||
{
|
||||
@@ -26,41 +32,80 @@ int CIniReader::ReadInteger(const STR8 szSection, const STR8 szKey, int iDefault
|
||||
}
|
||||
|
||||
|
||||
int CIniReader::ReadInteger(const STR8 szSection, const STR8 szKey, int iDefaultValue, int iMinValue, int iMaxValue)
|
||||
int CIniReader::ReadInteger(const STR8 szSection, const STR8 szKey, int defaultValue, int minValue, int maxValue)
|
||||
{
|
||||
int i = GetPrivateProfileInt(szSection, szKey, iDefaultValue, m_szFileName);
|
||||
if (i < iMinValue)
|
||||
return iMinValue;
|
||||
else if (i > iMaxValue)
|
||||
return iMaxValue;
|
||||
return i;
|
||||
}
|
||||
|
||||
int ReadInteger(const STR8 szSection, const STR8 szKey, int iDefaultValue, int iMinValue, int iMaxValue);
|
||||
|
||||
|
||||
|
||||
float CIniReader::ReadFloat(const STR8 szSection, const STR8 szKey, float fltDefaultValue)
|
||||
{
|
||||
char szResult[255];
|
||||
char szDefault[255];
|
||||
float fltResult;
|
||||
sprintf(szDefault, "%f",fltDefaultValue);
|
||||
GetPrivateProfileString(szSection, szKey, szDefault, szResult, 255, m_szFileName);
|
||||
fltResult = (float) atof(szResult);
|
||||
return fltResult;
|
||||
int iniValueReadFromFile = GetPrivateProfileInt(szSection, szKey, defaultValue, m_szFileName);
|
||||
//AssertGE(iniValueReadFromFile, minValue);
|
||||
//AssertLE(iniValueReadFromFile, maxValue);
|
||||
if (iniValueReadFromFile < minValue) {
|
||||
std::stringstream errMessage;
|
||||
errMessage << "The value of the .ini setting " << szKey << "(" << iniValueReadFromFile
|
||||
<< ") is outsize the valid range of " << minValue << " to " << maxValue
|
||||
<< ". " << minValue << " will be used.";
|
||||
iniErrorMessages.push(errMessage.str());
|
||||
return minValue;
|
||||
} else if (iniValueReadFromFile > maxValue) {
|
||||
std::stringstream errMessage;
|
||||
errMessage << "The value of the .ini setting " << szKey << "(" << iniValueReadFromFile
|
||||
<< ") is outsize the valid range of " << minValue << " to " << maxValue
|
||||
<< ". " << maxValue << " will be used.";
|
||||
iniErrorMessages.push(errMessage.str());
|
||||
return maxValue;
|
||||
}
|
||||
return iniValueReadFromFile;
|
||||
}
|
||||
|
||||
|
||||
bool CIniReader::ReadBoolean(const STR8 szSection, const STR8 szKey, bool bolDefaultValue)
|
||||
|
||||
//float CIniReader::ReadDouble(const STR8 szSection, const STR8 szKey, float fltDefaultValue)
|
||||
//{
|
||||
// char szResult[255];
|
||||
// char szDefault[255];
|
||||
// float fltResult;
|
||||
// sprintf(szDefault, "%f",fltDefaultValue);
|
||||
// GetPrivateProfileString(szSection, szKey, szDefault, szResult, 255, m_szFileName);
|
||||
// fltResult = (float) atof(szResult);
|
||||
// return fltResult;
|
||||
//}
|
||||
|
||||
double CIniReader::ReadDouble(const STR8 szSection, const STR8 szKey, double defaultValue, double minValue, double maxValue)
|
||||
{
|
||||
char szResult[255];
|
||||
char szDefault[255];
|
||||
double iniValueReadFromFile;
|
||||
sprintf(szDefault, "%f", defaultValue);
|
||||
GetPrivateProfileString(szSection, szKey, szDefault, szResult, 255, m_szFileName);
|
||||
iniValueReadFromFile = (float) atof(szResult);
|
||||
//AssertGE(iniValueReadFromFile, minValue);
|
||||
//AssertLE(iniValueReadFromFile, maxValue);
|
||||
if (iniValueReadFromFile < minValue) {
|
||||
std::stringstream errMessage;
|
||||
errMessage << "The value of the .ini setting " << szKey << "(" << iniValueReadFromFile
|
||||
<< ") is outsize the valid range of " << minValue << " to " << maxValue
|
||||
<< ". " << minValue << " will be used.";
|
||||
iniErrorMessages.push(errMessage.str());
|
||||
return minValue;
|
||||
} else if (iniValueReadFromFile > maxValue) {
|
||||
std::stringstream errMessage;
|
||||
errMessage << "The value of the .ini setting " << szKey << "(" << iniValueReadFromFile
|
||||
<< ") is outsize the valid range of " << minValue << " to " << maxValue
|
||||
<< ". " << maxValue << " will be used.";
|
||||
iniErrorMessages.push(errMessage.str());
|
||||
return maxValue;
|
||||
}
|
||||
return iniValueReadFromFile;
|
||||
}
|
||||
|
||||
|
||||
bool CIniReader::ReadBoolean(const STR8 szSection, const STR8 szKey, bool defaultValue)
|
||||
{
|
||||
char szResult[255];
|
||||
char szDefault[255];
|
||||
bool bolResult;
|
||||
sprintf(szDefault, "%s", bolDefaultValue? "TRUE" : "FALSE");
|
||||
bool boolResult;
|
||||
sprintf(szDefault, "%s", defaultValue? "TRUE" : "FALSE");
|
||||
GetPrivateProfileString(szSection, szKey, szDefault, szResult, 255, m_szFileName);
|
||||
bolResult = (strcmp(szResult, "TRUE") == 0 || strcmp(szResult, "TRUE") == 0) ? true : false;
|
||||
return bolResult;
|
||||
boolResult = (strcmp(szResult, "TRUE") == 0 || strcmp(szResult, "TRUE") == 0) ? true : false;
|
||||
return boolResult;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+27
-7
@@ -3,19 +3,39 @@
|
||||
|
||||
#include <Windows.h>
|
||||
#include <Types.h>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
|
||||
// Kaiden: This will read any value out of
|
||||
// an INI file as long as the correct type is specified.
|
||||
// Methods should be fairly self explainatory:
|
||||
// Methods should be fairly self explainatory
|
||||
//
|
||||
// Note: readers without valid range parameters will be removed to "encourage" developers to specify
|
||||
// valid ranges. Consider carefully what those values should be.
|
||||
//
|
||||
|
||||
// Queue of error messages. They are queued because screen is not ready for I/O yet.
|
||||
extern std::stack<std::string> iniErrorMessages;
|
||||
|
||||
class CIniReader
|
||||
{
|
||||
public:
|
||||
CIniReader(const STR8 szFileName);
|
||||
int ReadInteger(const STR8 szSection, const STR8 szKey, int iDefaultValue);
|
||||
int ReadInteger(const STR8 szSection, const STR8 szKey, int iDefaultValue, int iMinValue, int iMaxValue);
|
||||
float ReadFloat(const STR8 szSection, const STR8 szKey, float fltDefaultValue);
|
||||
bool ReadBoolean(const STR8 szSection, const STR8 szKey, bool bolDefaultValue);
|
||||
STR8 ReadString(const STR8 szSection, const STR8 szKey, const STR8 szDefaultValue);
|
||||
CIniReader(const STR8 szFileName);
|
||||
|
||||
// Warning: the following function will be removed
|
||||
int ReadInteger(const STR8 szSection, const STR8 szKey, int iDefaultValue);
|
||||
|
||||
int ReadInteger(const STR8 szSection, const STR8 szKey, int defaultValue, int minValue, int maxValue);
|
||||
|
||||
// Warning: the following function will be removed
|
||||
//double ReadDouble(const STR8 szSection, const STR8 szKey, double fltDefaultValue);
|
||||
|
||||
double ReadDouble(const STR8 szSection, const STR8 szKey, double defaultValue, double minValue, double maxValue);
|
||||
|
||||
bool ReadBoolean(const STR8 szSection, const STR8 szKey, bool bolDefaultValue);
|
||||
|
||||
STR8 ReadString(const STR8 szSection, const STR8 szKey, const STR8 szDefaultValue);
|
||||
|
||||
private:
|
||||
char m_szFileName[MAX_PATH];
|
||||
};
|
||||
|
||||
+2
-1
@@ -1017,7 +1017,7 @@ enum
|
||||
AIM_MEMBER_LEAVE_MSG,
|
||||
AIM_MEMBER_DEAD,
|
||||
|
||||
AIM_MEMBER_ALREADY_HAVE_18_MERCS,
|
||||
AIM_MEMBER_ALREADY_HAVE_MAX_MERCS,
|
||||
|
||||
AIM_MEMBER_PRERECORDED_MESSAGE,
|
||||
AIM_MEMBER_MESSAGE_RECORDED,
|
||||
@@ -1574,6 +1574,7 @@ enum
|
||||
MSG113_DELETE_ALL,
|
||||
MSG113_SOLD,
|
||||
MSG113_SOLD_ALL,
|
||||
MSG113_CHECK_GOGGLES,
|
||||
};
|
||||
|
||||
//CHRISL: NewInv messages
|
||||
|
||||
Binary file not shown.
@@ -4413,6 +4413,7 @@ STR16 New113Message[] =
|
||||
L"Schrapte alle punten van dit type",
|
||||
L"Verkocht punt",
|
||||
L"Verkocht alle punten van dit type",
|
||||
L"You should check your goggles",
|
||||
};
|
||||
|
||||
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
|
||||
|
||||
@@ -4425,6 +4425,7 @@ STR16 New113Message[] =
|
||||
L"Deleted all items of this type",
|
||||
L"Sold item",
|
||||
L"Sold all items of this type",
|
||||
L"You should check your goggles",
|
||||
};
|
||||
|
||||
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
|
||||
|
||||
@@ -4426,6 +4426,7 @@ STR16 New113Message[] =
|
||||
L"A supprimé tous les articles de ce type",
|
||||
L"Article vendu",
|
||||
L"A vendu tous les articles de ce type",
|
||||
L"You should check your goggles",
|
||||
};
|
||||
|
||||
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
|
||||
|
||||
@@ -4221,6 +4221,7 @@ STR16 New113Message[] =
|
||||
L"Alle Gegenstände dieses Typs gelöscht",
|
||||
L"Gegestand verkauft",
|
||||
L"Alle Gegenstände dieses Typs verkauft",
|
||||
L"You should check your goggles",
|
||||
};
|
||||
|
||||
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
|
||||
|
||||
@@ -4411,6 +4411,7 @@ STR16 New113Message[] =
|
||||
L"Ha cancellato tutti gli articoli di questo tipo",
|
||||
L"Articolo venduto",
|
||||
L"Ha venduto tutti gli articoli di questo tipo",
|
||||
L"You should check your goggles",
|
||||
};
|
||||
|
||||
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
|
||||
|
||||
@@ -4418,6 +4418,7 @@ STR16 New113Message[] =
|
||||
L"Usuniêto wszystkie przedmioty tego typu",
|
||||
L"Przedmiot sprzedany",
|
||||
L"Wszystkie przedmioty tego typu sprzedane",
|
||||
L"You should check your goggles",
|
||||
};
|
||||
|
||||
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
|
||||
|
||||
@@ -4421,6 +4421,7 @@ STR16 New113Message[] =
|
||||
L"Âûáðîøåíû âñå âåùè âûáðàííîé ãðóïïû.",
|
||||
L"Âåùü ïðîäàíà ãîëîäàþùåìó íàñåëåíèþ Àðóëüêî.",
|
||||
L"Ïðîäàíû âñå âåùè âûáðàííîé ãðóïïû.",
|
||||
L"You should check your goggles",
|
||||
};
|
||||
|
||||
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
|
||||
@@ -4561,4 +4562,4 @@ STR16 MPHelp[] =
|
||||
L"'F1' - Ïîêàçàòü îñíîâíóþ ïîìîùü.",
|
||||
};
|
||||
|
||||
#endif //RUSSIAN
|
||||
#endif //RUSSIAN
|
||||
|
||||
@@ -4425,6 +4425,7 @@ STR16 New113Message[] =
|
||||
L"Deleted all items of this type",
|
||||
L"Sold item",
|
||||
L"Sold all items of this type",
|
||||
L"You should check your goggles",
|
||||
};
|
||||
|
||||
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
|
||||
@@ -4521,7 +4522,7 @@ STR16 MPClientMessage[] =
|
||||
L"Kicked client #%d - '%S'",
|
||||
// 30
|
||||
L"Start turn for client number: #1 - '%S' | #2 - '%S' | #3 - '%S' | #4 - '%S'",
|
||||
L"Starting turn for client #%d",
|
||||
L"Starting turn for client #%d",
|
||||
L"Requesting for realtime...",
|
||||
L"Switched back to realtime.",
|
||||
L"Error: Something went wrong switching back.",
|
||||
|
||||
Reference in New Issue
Block a user