Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#3440 closed enhancement (fixed)

[PATCH] Replay menu cleanups

Reported by: elexis Owned by: elexis
Priority: Nice to Have Milestone: Alpha 20
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description (last modified by elexis)

The code is very clean already, but there are some minor things that can still be improved. Will attach multiple simple patches here.

Notice #3350 also applies to the replay menu.

Refs #3258 r17054 r17055

Attachments (5)

t3440_fix_main_menu_entry_offset_v1.patch (2.3 KB ) - added by elexis 9 years ago.
The last menu entry touched is off by 4 pixels. Noticed by niektb.
t3440_safe_delete_v1.patch (546 bytes ) - added by elexis 9 years ago.
Uses SAFE_DELETE instead of delete.
t3440_simplify_and_empty_JS_Interface_v1.patch (3.9 KB ) - added by elexis 9 years ago.
Moves StartVisualReplay from JSInterface_VisualReplay.cpp to VisualReplay.cpp, so that this file contains all the logic. Also uses early return and eliminates a variable in AutostartVisualReplay.
t3440_fix_main_menu_entry_add_warning_v2.patch (3.0 KB ) - added by elexis 9 years ago.
Adds a warning to the main menu entry, that it might take some time to load initially.
t3440_fix_compiler_warning.patch (840 bytes ) - added by elexis 9 years ago.
Fix a compiler warning, fileSize is u64.

Download all attachments as: .zip

Change History (14)

by elexis, 9 years ago

The last menu entry touched is off by 4 pixels. Noticed by niektb.

by elexis, 9 years ago

Attachment: t3440_safe_delete_v1.patch added

Uses SAFE_DELETE instead of delete.

comment:1 by elexis, 9 years ago

Description: modified (diff)

by elexis, 9 years ago

Moves StartVisualReplay from JSInterface_VisualReplay.cpp to VisualReplay.cpp, so that this file contains all the logic. Also uses early return and eliminates a variable in AutostartVisualReplay.

by elexis, 9 years ago

Adds a warning to the main menu entry, that it might take some time to load initially.

comment:2 by elexis, 9 years ago

TODO: hide or disable summary button if data is not available TODO: enhancement: Subtract the game duration of the filemoddate in case we are supplementing the timestamp on an a18 replay. This way those replays without timestamps list the start of the game instead of the end of the game.

Last edited 9 years ago by elexis (previous) (diff)

by elexis, 9 years ago

Fix a compiler warning, fileSize is u64.

comment:3 by elexis, 8 years ago

In 17313:

Corrects an offset of a menu entry. Thanks niektb for reporting. Refs #3440

comment:4 by elexis, 8 years ago

In 17314:

Visual replay code cleanup. Refs #3440.

Moves StartVisualReplay() from JSInterface_VisualReplay.cpp to VisualReplay.cpp, so that the former doesn't define any logic.
Uses replayFile.string8() instead of utf8_from_wstring(replayFile.string()).
SAFE_DELETE instead of delete.
Fixes a compiler warning in getReplayDuration().

comment:5 by elexis, 8 years ago

TODO: As mentioned by leper: void StartVisualReplay(CStrW directory);  -> const &

comment:6 by elexis, 8 years ago

Owner: set to elexis
Resolution: fixed
Status: newclosed

In 17356:

Replay menu cleanups. Fixes #3440.

Hides the summary-button in the replaymenu in case the summary wasn't saved.
Corrects the timestamp for incompatible replays.
Remove unused UNUSED from header files.
Use string8() instead of OsString().
Mention a reported compiler warning.
Use const& instead of a copy in StartVisualReplay().

comment:7 by elexis, 8 years ago

Keywords: review removed
Priority: Should HaveNice to Have
Type: defectenhancement

I couldn't find a way yet to fix the compiler warning reported by fabio on gcc 5.2, without introducing a compiler warning on my own system.

../../../source/ps/VisualReplay.cpp: In function ‘int getReplayDuration(std::istream*, const CStr8&, const u64&)’:
../../../source/ps/VisualReplay.cpp:145:102: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘u64 {aka long long unsigned int}’ [-Wformat=]
    debug_printf("At position %i of %lu after %i lines reads.\n", currentPosition, fileSize, linesRead);

comment:8 by elexis, 8 years ago

In 17359:

Renames to g_MapSizes, g_UserRating and g_SpamMonitor. Refs #3383 #3440

comment:9 by elexis, 8 years ago

In 17367:

Remove debug parser from replay menu. Refs #3440

Note: See TracTickets for help on using tickets.