瀏覽代碼

Ignore lines starting with "#" when parsing the mappings string given to love.joystick.loadGamepadMappings.

Alex Szpakowski 10 年之前
父節點
當前提交
195d41d1d9
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/modules/joystick/sdl/JoystickModule.cpp

+ 4 - 0
src/modules/joystick/sdl/JoystickModule.cpp

@@ -489,6 +489,10 @@ void JoystickModule::loadGamepadMappings(const std::string &mappings)
 		if (mapping.empty())
 		if (mapping.empty())
 			continue;
 			continue;
 
 
+		// Lines starting with "#" are comments.
+		if (mapping[0] == '#')
+			continue;
+
 		// Strip out and compare any "platform:XYZ," in the mapping.
 		// Strip out and compare any "platform:XYZ," in the mapping.
 		size_t pstartpos = mapping.find("platform:");
 		size_t pstartpos = mapping.find("platform:");
 		if (pstartpos != std::string::npos)
 		if (pstartpos != std::string::npos)