forked from 0ad/0ad
Pyrogenesis.cpp: add svn_revision to log
ScriptGlue.cpp: add svn_revision to build information in main menu Interact.cpp: fix: do not add anglebias when computed via atan2 NetMessage.cpp: fix typo This was SVN commit r6713.
This commit is contained in:
parent
5cdd802c21
commit
548db2d06e
@ -74,7 +74,7 @@ u8* CNetMessage::Serialize( u8* pBuffer ) const
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: Deserialize()
|
||||
// Desc: Loads this message from the specifie buffer parameter
|
||||
// Desc: Loads this message from the specified buffer parameter
|
||||
//-----------------------------------------------------------------------------
|
||||
const u8* CNetMessage::Deserialize( const u8* pStart, const u8* pEnd )
|
||||
{
|
||||
|
@ -1410,9 +1410,11 @@ void CBuildingPlacer::MouseReleased()
|
||||
{
|
||||
Deactivate(); // do it first in case we fail for any reason
|
||||
|
||||
m_clicked = false;
|
||||
|
||||
if( m_valid )
|
||||
{
|
||||
// issue a place object command accross the network
|
||||
// issue a place object command across the network
|
||||
CPlaceObjectMessage *msg = new CPlaceObjectMessage();
|
||||
msg->m_IsQueued = hotkeys[HOTKEY_ORDER_QUEUE];
|
||||
msg->m_Entities = g_Selection.m_selected;
|
||||
@ -1455,16 +1457,15 @@ void CBuildingPlacer::Update( float timeStep )
|
||||
CVector3D mousePos = camera.GetWorldCoordinates();
|
||||
CVector3D dif = mousePos - clickPos;
|
||||
float x = dif.X, z = dif.Z;
|
||||
if(x*x + z*z < 3*3) {
|
||||
if(x*x + z*z < 3*3)
|
||||
{
|
||||
if(m_dragged || m_timeSinceClick > 0.2f)
|
||||
{
|
||||
m_angle += timeStep * PI;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dragged = true;
|
||||
m_angle = atan2(x, z) + angleBias;
|
||||
m_angle = atan2(x, z);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1488,14 +1489,13 @@ void CBuildingPlacer::Update( float timeStep )
|
||||
if( ent && ent->m_classes.IsMember( m_template->m_socket ) ) // if it's a socket, snap to it
|
||||
{
|
||||
onSocket = true;
|
||||
m_angle = atan2f( ent->m_ahead.x, ent->m_ahead.y ) + angleBias;
|
||||
m_angle = atan2f( ent->m_ahead.x, ent->m_ahead.y );
|
||||
pos = ent->m_position;
|
||||
clickPos = ent->m_position;
|
||||
}
|
||||
}
|
||||
|
||||
// Set position and angle to the location we decided on
|
||||
|
||||
CMatrix3D m;
|
||||
m.SetYRotation(m_angle + PI);
|
||||
m.Translate(pos);
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "lib/sysdep/sysdep.h"
|
||||
#include "lib/file/path.h"
|
||||
#include "lib/path_util.h"
|
||||
#include "lib/svn_revision.h"
|
||||
|
||||
DEFINE_ERROR(PS_OK, "OK");
|
||||
DEFINE_ERROR(PS_FAIL, "Fail");
|
||||
@ -73,6 +74,8 @@ static void AppendAsciiFile(FILE* out, const char* in_filename)
|
||||
// for user convenience, bundle all logs into this file:
|
||||
void psBundleLogs(FILE* f)
|
||||
{
|
||||
fwprintf(f, L"SVN Revision: %s\n\n", svn_revision);
|
||||
|
||||
fwprintf(f, L"System info:\n\n");
|
||||
Path path1("../logs/system_info.txt");
|
||||
AppendAsciiFile(f, path1.external_file_string().c_str());
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "graphics/scripting/JSInterface_LightEnv.h"
|
||||
#include "gui/CGUI.h"
|
||||
#include "lib/timer.h"
|
||||
#include "lib/svn_revision.h"
|
||||
#include "lib/frequency_filter.h"
|
||||
#include "maths/scripting/JSInterface_Vector3D.h"
|
||||
#include "network/NetClient.h"
|
||||
@ -1025,28 +1026,44 @@ JSBool SetCameraTarget( JSContext* cx, JSObject* UNUSED(obj), uintN argc, jsval*
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Return the date/time at which the current executable was compiled.
|
||||
// params: none (-> "date time") OR
|
||||
// what to display [int]: 0 (-> "date"); 1 (-> "time")
|
||||
// returns: date and/or time [string]
|
||||
// params: none (-> "date time (svn revision)") OR an integer specifying
|
||||
// what to display: 0 for date, 1 for time, 2 for svn revision
|
||||
// returns: string with the requested timestamp info
|
||||
// notes:
|
||||
// - Displayed on main menu screen; tells non-programmers which auto-build
|
||||
// they are running. Could also be determined via .EXE file properties,
|
||||
// but that's a bit more trouble.
|
||||
// - To be exact, the date/time returned is when scriptglue.cpp was
|
||||
// last compiled; since the auto-build does full rebuilds, that is moot.
|
||||
// last compiled, but the auto-build does full rebuilds.
|
||||
// - svn revision is generated by calling svnversion and cached in
|
||||
// lib/svn_revision.cpp. it is useful to know when attempting to
|
||||
// reproduce bugs (the main EXE and PDB should be temporarily reverted to
|
||||
// that revision so that they match user-submitted crashdumps).
|
||||
JSBool GetBuildTimestamp( JSContext* cx, JSObject*, uintN argc, jsval* argv, jsval* rval )
|
||||
{
|
||||
JSU_REQUIRE_PARAM_RANGE(0, 1);
|
||||
|
||||
// no param => "date time"
|
||||
// param = 0 => "date"
|
||||
// param = 1 => "time"
|
||||
JSString* s = JS_NewStringCopyZ(cx,
|
||||
argc && argv[0]==JSVAL_ONE ? __TIME__
|
||||
: argc ? __DATE__
|
||||
: __DATE__" "__TIME__
|
||||
);
|
||||
*rval = STRING_TO_JSVAL(s);
|
||||
char buf[200];
|
||||
|
||||
// see function documentation
|
||||
const int mode = argc? JSVAL_TO_INT(argv[0]) : -1;
|
||||
switch(mode)
|
||||
{
|
||||
case -1:
|
||||
sprintf_s(buf, ARRAY_SIZE(buf), "%s %s (%ws)", __DATE__, __TIME__, svn_revision);
|
||||
break;
|
||||
case 0:
|
||||
sprintf_s(buf, ARRAY_SIZE(buf), "%s", __DATE__);
|
||||
break;
|
||||
case 1:
|
||||
sprintf_s(buf, ARRAY_SIZE(buf), "%s", __TIME__);
|
||||
break;
|
||||
case 2:
|
||||
sprintf_s(buf, ARRAY_SIZE(buf), "%ws", svn_revision);
|
||||
break;
|
||||
}
|
||||
|
||||
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, buf));
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user