Showing with 19 additions and 6 deletions.
  1. +1 −1 lib/framework/debug.h
  2. +1 −1 src/display3d.cpp
  3. +2 −1 src/hci.cpp
  4. +7 −2 src/qtscriptfuncs.cpp
  5. +8 −1 src/version.cpp
2 changes: 1 addition & 1 deletion lib/framework/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ bool debug_enable_switch(const char *str);
*
* Only outputs if debugging of part was formerly enabled with debug_enable_switch.
*/
#define debug(part, ...) do { if (enabled_debug[part]) _debug(__LINE__, part, __FUNCTION__, __VA_ARGS__); } while(0)
#define debug(part, ...) do { if (true) _debug(__LINE__, part, __FUNCTION__, __VA_ARGS__); } while(0)
void _debug(int line, code_part part, const char *function, const char *str, ...) WZ_DECL_FORMAT(printf, 4, 5);

#define debugBacktrace(part, ...) do { if (enabled_debug[part]) { _debug(__LINE__, part, __FUNCTION__, __VA_ARGS__); _debugBacktrace(part); }} while(0)
Expand Down
2 changes: 1 addition & 1 deletion src/display3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void drawShape(BASE_OBJECT *psObj, iIMDShape *strImd, int colour, PIELIGHT build
}
if (strImd->objanimframes)
{
const int elapsed = graphicsTime - psObj->timeAnimationStarted;
const int elapsed = GAME_TICKS_PER_UPDATE + graphicsTime - psObj->timeAnimationStarted;
const int frame = (elapsed / strImd->objanimtime) % strImd->objanimframes;
const ANIMFRAME &state = strImd->objanimdata[frame];
if (state.scale.x == -1.0f) // disabled frame, for implementing key frame animation
Expand Down
3 changes: 2 additions & 1 deletion src/hci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1786,7 +1786,8 @@ static void intAddObjectStats(BASE_OBJECT *psObj, UDWORD id)
{
fillTemplateList(apsTemplateList, (STRUCTURE *)psObj);
numStatsListEntries = apsTemplateList.size();
ppsStatsList = (BASE_STATS **)&apsTemplateList[0]; // FIXME Ugly cast, and is undefined behaviour (strict-aliasing violation) in C/C++.
if(apsTemplateList.capacity()>0)
ppsStatsList = (BASE_STATS **)&apsTemplateList[0]; // FIXME Ugly cast, and is undefined behaviour (strict-aliasing violation) in C/C++.
}

/*have to calculate the list each time the Topic button is pressed
Expand Down
9 changes: 7 additions & 2 deletions src/qtscriptfuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4296,11 +4296,16 @@ QScriptValue js_stats(QScriptContext *context, QScriptEngine *engine)
int type = callee.property("type").toInt32();
int player = callee.property("player").toInt32();
unsigned index = callee.property("index").toUInt32();
QString name = callee.property("name").toString();
QString name = "unknown";
if (callee.property("name").isValid()) {
name = callee.property("name").toString();
}
if (context->argumentCount() == 1) // setter
{
int value = context->argument(0).toInt32();
syncDebug("stats[p%d,t%d,%s,i%d] = %d", player, type, name.toStdString().c_str(), index, value);
std::string nameToStdString = name.toUtf8().constData();
const char *nameToStdStringC_str = nameToStdString.c_str();
syncDebug("stats[p%d,t%d,%s,i%d] = %d", player, type, nameToStdStringC_str, index, value);
if (type == COMP_BODY)
{
SCRIPT_ASSERT(context, index < numBodyStats, "Bad index");
Expand Down
9 changes: 8 additions & 1 deletion src/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@
#include "version.h"
#include "stringdef.h"

#include "src/autorevision.h" // Apparently must add the "src/" so make doesn't needlessly recompile version.cpp every time.
//#include "src/autorevision.h" // Apparently must add the "src/" so make doesn't needlessly recompile version.cpp every time.
#define VCS_TYPE "${VCS_TYPE}"
#define VCS_BASENAME "${VCS_BASENAME}"
#define VCS_BRANCH "${VCS_BRANCH}"
#define VCS_TAG "${VCS_TAG}"
#define VCS_EXTRA "${VCS_EXTRA}"
#define VCS_FULL_HASH "${VCS_FULL_HASH}"
#define VCS_SHORT_HASH "${VCS_SHORT_HASH}"

static const char vcs_branch_cstr[] = VCS_BRANCH;
static const char vcs_tag[] = VCS_TAG;
Expand Down