View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003025 | FSSCP | scripting | public | 2014-03-28 06:12 | 2014-03-29 02:11 |
Reporter | niffiwan | Assigned To | niffiwan | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | Linux | ||||
Product Version | 3.7.1 | ||||
Target Version | 3.7.2 | ||||
Summary | 0003025: LUA HookVar "MouseButton" reports invalid data | ||||
Description | This HookVar (added in r10477) does not work correctly on Linux. The root cause is probably some difference in va_arg handling between the different compilers. Anyway, when hv.MouseButton is used in a LUA script random integers are returned, instead of the expected bit fields (i.e. MOUSE_* defines). Note that the return values are consistent while FSO is running, but they usually change the next time FSO is run. | ||||
Steps To Reproduce | Add a script like this: data/tables/itbroke-sct.tbm $On Mouse Released: [ ba.warning( hv.MouseButton ) ] Note the value is not any of: #define MOUSE_LEFT_BUTTON (1<<0) #define MOUSE_RIGHT_BUTTON (1<<1) #define MOUSE_MIDDLE_BUTTON (1<<2) (unless you're *super* lucky) | ||||
Additional Information | This should fix the issue. Note that the MouseButton HookVar is the 1st integer HookVar added to FSO (well, there are others but they are all commented out). diff --git a/code/parse/scripting.cpp b/code/parse/scripting.cpp index d2efbfc..1c3060f 100644 --- a/code/parse/scripting.cpp +++ b/code/parse/scripting.cpp @@ -670,6 +670,8 @@ void script_state::SetHookVar(char *name, char format, void *data) { if(format == 's') ade_set_args(LuaState, fmt, data); + else if (format == 'i') + ade_set_args(LuaState, fmt, *(int*)data); else ade_set_args(LuaState, fmt, *(ade_odata*)data); } | ||||
Tags | No tags attached. | ||||
|
Just needs some testing on Windows to ensure the proposed fix doesn't break anything. |
|
I hate the C-style varargs for stuff like this... Just tested it on Windows and it works fine. |
|
Fix committed to trunk@10543. |
Date Modified | Username | Field | Change |
---|---|---|---|
2014-03-28 06:12 | niffiwan | New Issue | |
2014-03-28 06:12 | niffiwan | Status | new => assigned |
2014-03-28 06:12 | niffiwan | Assigned To | => niffiwan |
2014-03-28 06:14 | niffiwan | Note Added: 0015689 | |
2014-03-28 06:14 | niffiwan | Status | assigned => feedback |
2014-03-28 09:08 | m_m | Note Added: 0015690 | |
2014-03-29 02:11 | niffiwan | Changeset attached | => fs2open trunk r10543 |
2014-03-29 02:11 | niffiwan | Note Added: 0015692 | |
2014-03-29 02:11 | niffiwan | Status | feedback => assigned |
2014-03-29 02:11 | niffiwan | Status | assigned => resolved |
2014-03-29 02:11 | niffiwan | Resolution | open => fixed |