Wednesday, December 23, 2009

Emulate rightclick on OpenTTD

In the original version of OTTD the right click is emulated by holding the ctrl key. Rightclick emulation can be enabled in the openttd.cfg file, by setting under the [misc] section,

rightclick_emulate = true
But the ctrl key is already mapped to othe things in the game (shared orderes for example). A very small modification to the code changes the key to shift. In /src/video/sdl_v.cpp change (line 387):


if (_rightclick_emulate && SDL_CALL SDL_GetModState() & KMOD_CTRL) {
to
if (_rightclick_emulate && SDL_CALL SDL_GetModState() & KMOD_SHIFT) {

or apply this patch file, by issuing,
patch -p1 -i right_click_emulate.diff
Then follow this post, or this one to compile. I've compiled ottd both with my shift patch and the original version.

No comments:

Post a Comment