This commit is contained in:
Christoph Oelckers 2015-02-07 16:45:44 +01:00
commit 4e2763e5fa
28 changed files with 72 additions and 92 deletions

View file

@ -1234,9 +1234,16 @@ void AM_initVariables ()
for (pnum=0;pnum<MAXPLAYERS;pnum++)
if (playeringame[pnum])
break;
m_x = (players[pnum].camera->x >> FRACTOMAPBITS) - m_w/2;
m_y = (players[pnum].camera->y >> FRACTOMAPBITS) - m_h/2;
// [ZzZombo] no access out of bounds.
if(pnum>=MAXPLAYERS)
{
m_x=m_y=0;
}
else
{
m_x = (players[pnum].camera->x >> FRACTOMAPBITS) - m_w/2;
m_y = (players[pnum].camera->y >> FRACTOMAPBITS) - m_h/2;
}
AM_changeWindowLoc();
// for saving & restoring

View file

@ -61,8 +61,8 @@ void DBot::Serialize (FArchive &arc)
if (SaveVersion < 4515)
{
angle_t savedyaw;
int savedpitch;
angle_t savedyaw=0;
int savedpitch=0;
arc << savedyaw
<< savedpitch;
}

View file

@ -513,7 +513,7 @@ angle_t DBot::FireRox (AActor *enemy, ticcmd_t *cmd)
bglobal.SetBodyAt (enemy->x + FixedMul(enemy->velx, (m+2*FRACUNIT)),
enemy->y + FixedMul(enemy->vely, (m+2*FRACUNIT)), ONFLOORZ, 1);
dist = P_AproxDistance(actor->x-bglobal.body1->x, actor->y-bglobal.body1->y);
//try the predicted location
if (P_CheckSight (actor, bglobal.body1, SF_IGNOREVISIBILITY)) //See the predicted location, so give a test missile
{

View file

@ -1028,7 +1028,6 @@ CCMD(nextsecret)
TEXTCOLOR_NORMAL " is for single-player only.\n");
return;
}
char *next = NULL;
if (level.NextSecretMap.Len() > 0 && level.NextSecretMap.Compare("enDSeQ", 6))
{

View file

@ -856,11 +856,10 @@ void C_DrawConsole (bool hw2d)
}
else if (ConBottom)
{
int visheight, realheight;
int visheight;
FTexture *conpic = TexMan[conback];
visheight = ConBottom;
realheight = (visheight * conpic->GetHeight()) / SCREENHEIGHT;
screen->DrawTexture (conpic, 0, visheight - screen->GetHeight(),
DTA_DestWidth, screen->GetWidth(),

View file

@ -439,7 +439,7 @@ static BYTE HexToByte (const char *hex)
UCVarValue FBaseCVar::FromString (const char *value, ECVarType type)
{
UCVarValue ret;
int i;
int i=0;
switch (type)
{
@ -475,39 +475,29 @@ UCVarValue FBaseCVar::FromString (const char *value, ECVarType type)
// 0 1 2 3
ret.pGUID = NULL;
for (i = 0; i < 38; ++i)
if(value)
for (; i < 38; i++)
{
if (value[i] == 0)
{
break;
}
bool goodv = true;
switch (i)
{
case 0:
if (value[i] != '{')
goodv = false;
break;
break;
case 9:
case 14:
case 19:
case 24:
if (value[i] != '-')
goodv = false;
break;
break;
case 37:
if (value[i] != '}')
goodv = false;
break;
break;
default:
if (value[i] < '0' ||
(value[i] > '9' && value[i] < 'A') ||
(value[i] > 'F' && value[i] < 'a') ||
value[i] > 'f')
{
goodv = false;
}
break;
break;
}
}
if (i == 38 && value[i] == 0)
@ -1673,9 +1663,6 @@ void FBaseCVar::ListVars (const char *filter, bool plain)
if (CheckWildcards (filter, var->GetName()))
{
DWORD flags = var->GetFlags();
UCVarValue val;
val = var->GetGenericRep (CVAR_String);
if (plain)
{ // plain formatting does not include user-defined cvars
if (!(flags & CVAR_UNSETTABLE))

View file

@ -1336,7 +1336,7 @@ CCMD (alias)
}
else
{
alias = new FConsoleAlias (argv[1], argv[2], ParsingKeyConf);
new FConsoleAlias (argv[1], argv[2], ParsingKeyConf);
}
}
}

View file

@ -448,7 +448,7 @@ void SetCompatibilityParams()
{
unsigned i = ii_compatparams;
while (CompatParams[i] != CP_END && i < CompatParams.Size())
while (i < CompatParams.Size() && CompatParams[i] != CP_END)
{
switch (CompatParams[i])
{

View file

@ -20,11 +20,11 @@ struct FCompatValues
struct FMD5HashTraits
{
hash_t Hash(const FMD5Holder key)
hash_t Hash(const FMD5Holder &key)
{
return key.Hash;
}
int Compare(const FMD5Holder left, const FMD5Holder right)
int Compare(const FMD5Holder &left, const FMD5Holder &right)
{
return left.DWords[0] != right.DWords[0] ||
left.DWords[1] != right.DWords[1] ||

View file

@ -50,12 +50,11 @@ static FRandom pr_endtag;
//
//====================================================================
FConfigFile::FConfigFile ()
FConfigFile::FConfigFile () : PathName(NAME_None)
{
Sections = CurrentSection = NULL;
LastSectionPtr = &Sections;
CurrentEntry = NULL;
PathName = "";
OkayToWrite = true;
FileExisted = true;
}
@ -836,7 +835,7 @@ const char *FConfigFile::GenerateEndTag(const char *value)
for (int i = 0; i < 5; ++i)
{
DWORD three_bytes = (rand_bytes[i*3] << 16) | (rand_bytes[i*3+1] << 8) | (rand_bytes[i*3+2]);
//DWORD three_bytes = (rand_bytes[i*3] << 16) | (rand_bytes[i*3+1] << 8) | (rand_bytes[i*3+2]); // ???
EndTag[4+i*4 ] = Base64Table[rand_bytes[i*3] >> 2];
EndTag[4+i*4+1] = Base64Table[((rand_bytes[i*3] & 3) << 4) | (rand_bytes[i*3+1] >> 4)];
EndTag[4+i*4+2] = Base64Table[((rand_bytes[i*3+1] & 15) << 2) | (rand_bytes[i*3+2] >> 6)];

View file

@ -2055,7 +2055,8 @@ void FDynamicBuffer::SetData (const BYTE *data, int len)
}
else
{
len = 0;
m_Len = 0;
M_Free((void *)data);
}
}

View file

@ -500,5 +500,5 @@ void SkipChunk (BYTE **stream)
int len;
len = ReadLong (stream);
stream += len + (len & 1);
*stream += len + (len & 1);
}

View file

@ -443,7 +443,6 @@ void FDecalLib::ParseDecal (FScanner &sc)
FString decalName;
WORD decalNum;
FDecalTemplate newdecal;
int code;
FTextureID picnum;
int lumpnum;
@ -467,7 +466,7 @@ void FDecalLib::ParseDecal (FScanner &sc)
AddDecal (decalName, decalNum, newdecal);
break;
}
switch ((code = sc.MustMatchString (DecalKeywords)))
switch (sc.MustMatchString (DecalKeywords))
{
case DECAL_XSCALE:
newdecal.ScaleX = ReadScale (sc);
@ -763,8 +762,6 @@ void FDecalLib::ParseSlider (FScanner &sc)
}
else if (sc.Compare ("DistX"))
{
sc.MustGetFloat ();
distX = (fixed_t)(sc.Float * FRACUNIT);
Printf ("DistX in slider decal %s is unsupported\n", sliderName.GetChars());
}
else if (sc.Compare ("DistY"))
@ -1024,9 +1021,8 @@ FDecalLib::FTranslation *FDecalLib::GenerateTranslation (DWORD start, DWORD end)
return trans;
}
FDecalBase::FDecalBase ()
FDecalBase::FDecalBase () : Name(NAME_None)
{
Name = NAME_None;
}
FDecalBase::~FDecalBase ()
@ -1139,9 +1135,8 @@ const FDecalTemplate *FDecalGroup::GetDecal () const
return static_cast<const FDecalTemplate *>(remember);
}
FDecalAnimator::FDecalAnimator (const char *name)
FDecalAnimator::FDecalAnimator (const char *name) : Name(name)
{
Name = name;
}
FDecalAnimator::~FDecalAnimator ()

View file

@ -24,7 +24,7 @@ struct PSymbol
FName SymbolName;
protected:
PSymbol(FName name, ESymbolType type) { SymbolType = type; SymbolName = name; }
PSymbol(FName name, ESymbolType type):SymbolName(name) { SymbolType = type; }
};
// A constant value ---------------------------------------------------------

View file

@ -78,9 +78,8 @@ DMover::DMover ()
}
DMover::DMover (sector_t *sector)
: DSectorEffect (sector)
: DSectorEffect (sector), interpolation(NULL)
{
interpolation = NULL;
}
void DMover::Destroy()

View file

@ -53,7 +53,7 @@
//==========================================================================
FileReader::FileReader ()
: File(NULL), Length(0), StartPos(0), CloseOnDestruct(false)
: File(NULL), Length(0), StartPos(0), FilePos(0), CloseOnDestruct(false)
{
}

View file

@ -2589,6 +2589,12 @@ bool G_ProcessIFFDemo (FString &mapname)
demo_p = nextchunk;
}
if (!headerHit)
{
Printf ("Demo has no header!\n");
return true;
}
if (!numPlayers)
{
Printf ("Demo has no players!\n");

View file

@ -367,7 +367,6 @@ static void InitPlayerClasses ()
void G_InitNew (const char *mapname, bool bTitleLevel)
{
EGameSpeed oldSpeed;
bool wantFast;
int i;
@ -454,7 +453,6 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
I_Error ("Could not find map %s\n", mapname);
}
oldSpeed = GameSpeed;
wantFast = !!G_SkillProperty(SKILLP_FastMonsters);
GameSpeed = wantFast ? SPEED_Fast : SPEED_Normal;

View file

@ -241,7 +241,7 @@ struct FOptionalMapinfoData
{
FOptionalMapinfoData *Next;
FName identifier;
FOptionalMapinfoData() { Next = NULL; identifier = NAME_None; }
FOptionalMapinfoData():identifier(NAME_None) { Next = NULL; }
virtual ~FOptionalMapinfoData() {}
virtual FOptionalMapinfoData *Clone() const = 0;
};

View file

@ -705,8 +705,6 @@ void FMapInfoParser::ParseCluster()
}
else if (sc.Compare("music"))
{
int order = 0;
ParseAssign();
ParseMusic(clusterinfo->MessageMusic, clusterinfo->musicorder);
}

View file

@ -238,7 +238,7 @@ void PacketSend (void)
else
{
// Printf("send %d\n", doomcom.datalength);
c = sendto(mysocket, (char *)doomcom.data, doomcom.datalength,
/*c = */sendto(mysocket, (char *)doomcom.data, doomcom.datalength,
0, (sockaddr *)&sendaddress[doomcom.remotenode],
sizeof(sendaddress[doomcom.remotenode]));
}
@ -800,7 +800,6 @@ bool Guest_WaitForOthers (void *userdata)
{
int node;
packet.NumNodes = packet.NumNodes;
doomcom.numnodes = packet.NumNodes + 2;
sendplayer[0] = packet.ConsoleNum; // My player number
doomcom.consoleplayer = packet.ConsoleNum;

View file

@ -158,7 +158,6 @@ void FActorInfo::StaticSetActorNums ()
void FActorInfo::RegisterIDs ()
{
const PClass *cls = PClass::FindClass(Class->TypeName);
bool set = false;
if (GameFilter == GAME_Any || (GameFilter & gameinfo.gametype))
{
@ -578,17 +577,17 @@ CCMD (summonfoe)
TMap<FName, DamageTypeDefinition> GlobalDamageDefinitions;
void DamageTypeDefinition::Apply(FName const type)
void DamageTypeDefinition::Apply(FName const &type)
{
GlobalDamageDefinitions[type] = *this;
}
DamageTypeDefinition *DamageTypeDefinition::Get(FName const type)
DamageTypeDefinition *DamageTypeDefinition::Get(FName const &type)
{
return GlobalDamageDefinitions.CheckKey(type);
}
bool DamageTypeDefinition::IgnoreArmor(FName const type)
bool DamageTypeDefinition::IgnoreArmor(FName const &type)
{
DamageTypeDefinition *dtd = Get(type);
if (dtd) return dtd->NoArmor;
@ -610,7 +609,7 @@ bool DamageTypeDefinition::IgnoreArmor(FName const type)
//
//==========================================================================
int DamageTypeDefinition::ApplyMobjDamageFactor(int damage, FName const type, DmgFactors const * const factors)
int DamageTypeDefinition::ApplyMobjDamageFactor(int damage, FName const &type, DmgFactors const * const factors)
{
if (factors)
{

View file

@ -217,7 +217,7 @@ public:
bool ReplaceFactor;
bool NoArmor;
void Apply(FName const type);
void Apply(FName const &type);
void Clear()
{
DefaultFactor = FRACUNIT;
@ -225,9 +225,9 @@ public:
NoArmor = false;
}
static DamageTypeDefinition *Get(FName const type);
static bool IgnoreArmor(FName const type);
static int ApplyMobjDamageFactor(int damage, FName const type, DmgFactors const * const factors);
static DamageTypeDefinition *Get(FName const &type);
static bool IgnoreArmor(FName const &type);
static int ApplyMobjDamageFactor(int damage, FName const &type, DmgFactors const * const factors);
};

View file

@ -55,10 +55,9 @@ DArgs::DArgs()
//
//===========================================================================
DArgs::DArgs(const DArgs &other)
: DObject()
DArgs::DArgs(const DArgs &other):Argv(other.Argv),
DObject()
{
Argv = other.Argv;
}
//===========================================================================
@ -263,7 +262,6 @@ void DArgs::RemoveArgs(const char *check)
const char *DArgs::GetArg(int arg) const
{
return ((unsigned)arg < Argv.Size()) ? Argv[arg].GetChars() : NULL;
return Argv[arg];
}
//===========================================================================
@ -351,7 +349,6 @@ void DArgs::RemoveArg(int argindex)
void DArgs::CollectFiles(const char *param, const char *extension)
{
TArray<FString> work;
DArgs *out = new DArgs;
unsigned int i;
size_t extlen = extension == NULL ? 0 : strlen(extension);

View file

@ -1023,7 +1023,6 @@ bool M_SaveBitmap(const BYTE *from, ESSType color_type, int width, int height, i
}
}
y = sizeof(buffer) - stream.avail_out;
deflateEnd (&stream);
if (err != Z_STREAM_END)

View file

@ -261,11 +261,10 @@ protected:
public:
bool mEnabled;
FListMenuItem(int xpos = 0, int ypos = 0, FName action = NAME_None)
FListMenuItem(int xpos = 0, int ypos = 0, FName action = NAME_None):mAction(action)
{
mXpos = xpos;
mYpos = ypos;
mAction = action;
mEnabled = true;
}

View file

@ -416,10 +416,10 @@ typedef unsigned int hash_t;
template<class KT> struct THashTraits
{
// Returns the hash value for a key.
hash_t Hash(const KT key) { return (hash_t)(intptr_t)key; }
hash_t Hash(const KT &key) { return (hash_t)(intptr_t)key; }
// Compares two keys, returning zero if they are the same.
int Compare(const KT left, const KT right) { return left != right; }
int Compare(const KT &left, const KT &right) { return left != right; }
};
template<class VT> struct TValueTraits
@ -547,12 +547,12 @@ public:
//
//=======================================================================
VT &operator[] (const KT key)
VT &operator[] (const KT &key)
{
return GetNode(key)->Pair.Value;
}
const VT &operator[] (const KT key) const
const VT &operator[] (const KT &key) const
{
return GetNode(key)->Pair.Value;
}
@ -566,13 +566,13 @@ public:
//
//=======================================================================
VT *CheckKey (const KT key)
VT *CheckKey (const KT &key)
{
Node *n = FindKey(key);
return n != NULL ? &n->Pair.Value : NULL;
}
const VT *CheckKey (const KT key) const
const VT *CheckKey (const KT &key) const
{
const Node *n = FindKey(key);
return n != NULL ? &n->Pair.Value : NULL;
@ -591,7 +591,7 @@ public:
//
//=======================================================================
VT &Insert(const KT key, const VT &value)
VT &Insert(const KT &key, const VT &value)
{
Node *n = FindKey(key);
if (n != NULL)
@ -614,7 +614,7 @@ public:
//
//=======================================================================
void Remove(const KT key)
void Remove(const KT &key)
{
DelKey(key);
}
@ -649,13 +649,13 @@ protected:
hash_t Size; /* must be a power of 2 */
hash_t NumUsed;
const Node *MainPosition(const KT k) const
const Node *MainPosition(const KT &k) const
{
HashTraits Traits;
return &Nodes[Traits.Hash(k) & (Size - 1)];
}
Node *MainPosition(const KT k)
Node *MainPosition(const KT &k)
{
HashTraits Traits;
return &Nodes[Traits.Hash(k) & (Size - 1)];
@ -736,7 +736,7 @@ protected:
**
** The Value field is left unconstructed.
*/
Node *NewKey(const KT key)
Node *NewKey(const KT &key)
{
Node *mp = MainPosition(key);
if (!mp->IsNil())
@ -775,7 +775,7 @@ protected:
return mp;
}
void DelKey(const KT key)
void DelKey(const KT &key)
{
Node *mp = MainPosition(key), **mpp;
HashTraits Traits;
@ -814,7 +814,7 @@ protected:
}
}
Node *FindKey(const KT key)
Node *FindKey(const KT &key)
{
HashTraits Traits;
Node *n = MainPosition(key);
@ -825,7 +825,7 @@ protected:
return n == NULL || n->IsNil() ? NULL : n;
}
const Node *FindKey(const KT key) const
const Node *FindKey(const KT &key) const
{
HashTraits Traits;
const Node *n = MainPosition(key);
@ -836,7 +836,7 @@ protected:
return n == NULL || n->IsNil() ? NULL : n;
}
Node *GetNode(const KT key)
Node *GetNode(const KT &key)
{
Node *n = FindKey(key);
if (n != NULL)

View file

@ -152,10 +152,9 @@ struct ExpVal
class FxExpression
{
protected:
FxExpression(const FScriptPosition &pos)
FxExpression(const FScriptPosition &pos):ScriptPosition(pos)
{
isresolved = false;
ScriptPosition = pos;
}
public:
virtual ~FxExpression() {}