The wonder victory message in the middle of the screen (a TimeNotification) displays %(player)s will have won in %(time)s.
It requires the player to check the diplomacy screen and check which player color that is, if the player assignments aren't memorized.
It would also be consistent with the rest of the GUI which colorizes usernames.
Details
- Reviewers
Imarok
- Start a game with wondermode.
- Use the "gift from the gods" cheat for fast building and resources.
- Build a wonder.
- Use the developer overlay (Alt+D) to change the perspective to another player to see the string.
- Ensure that you're not getting spammed out with sprintf errors and seeing a colorized, translated string.
Second test:
Start a match with an allied AI player and send an attack request via the diplomacy dialog to get an answer from the bot, thus seeing whether it uses the new function correctly.
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Branch
- /ps/trunk
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 379 Build 610: Vulcan Build Jenkins Build 609: arc lint + arc unit
Event Timeline
One might argue that doing the colorization in the simulation is weird, but it's not out of sync.
Build is green
Updating workspaces. Build (release)... ../../../source/gui/CChart.cpp:38:41: warning: unused parameter ‘Message’ [-Wunused-parameter] void CChart::HandleMessage(SGUIMessage& Message) ^ ../../../source/lib/tex/tex_png.cpp: In member function ‘virtual Status TexCodecPng::encode(Tex*, DynArray*) const’: ../../../source/lib/tex/tex_png.cpp:309:9: warning: variable ‘ret’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered] Status ret = ERR::FAIL; ^ Build (debug)... ../../../source/gui/CChart.cpp:38:41: warning: unused parameter ‘Message’ [-Wunused-parameter] void CChart::HandleMessage(SGUIMessage& Message) ^ Running debug tests... Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!
http://jw:8080/job/phabricator/88/ for more details.
Was wondeirng how the AI sent colorized chat messages. It is an exception in messages.js:
// special case for formatting of player names which are transmitted as _player_num for (let param in message.parameters) { if (!param.startsWith("_player_")) continue; message.parameters[param] = colorizePlayernameByID(message.parameters[param]); }
We could do the same with time notifications, but I'm dubious. Wouldn't it be cleaner to add a colorizePlayernameByID() function to the AI and simulation context, so that every message could decide on it's own? There could be multiple playernames in the string as well.
Why not have the GUI colorize player names? (Looking for "player" or "player1" or the "_player_" parameters, that way the simulation doesn't need to know anything about GUI formatting.)
Advantages of colorizing in the GUI / Thesis:
- Formatting is the department of the GUI, not of the simulation.
- because clients should be able to change their GUI without affecting the simulation
Disadvantage of colorizing in the GUI / Antithesis:
- Hardcodes meaning in the GUI, while solely the simulation connotes the meaning of the passed notification.
- Thus only players are colorized:
- In some messages, we might not want to colorize the player.
- In some messages, we might want to colorize multiple players.
- In some messages, we might want to colorize something arbitrary.
Actual Use Cases:
Can't imagine anything else but playernames to be colorized, especially since that's already the case for chat messages.
Thus the second set of disadvantages doesn't come into play and we can feasibly colorize in the GUI (while paying with the first disadvantage).
Colorize all playernames in TimeNotifications, i.e. the parameters starting with _player_ in the GUI (only used for the wonder victory notification currently).
(Notice this doesn't cause an Out-Of-Sync error, as the colorization method in the GUI only changes a CloneValueFromOtherContext of the serialized data returned from `GuiInterfaceCall.)
Build is green
Updating workspaces. Build (release)... Build (debug)... Running debug tests... Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!
http://jw:8080/job/phabricator/243/ for more details.
else committable
binaries/data/mods/public/gui/session/messages.js | ||
---|---|---|
299 | missing semicolon |
Build is green
Updating workspaces. Build (release)... Build (debug)... Running debug tests... Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!
http://jw:8080/job/phabricator/258/ for more details.